dotfiles/zsh/.local/share/zsh/functions/aws-publish-ssh-key

11 lines
434 B
Plaintext

aws-publish-ssh-key() {
local key_name="${1:-jswank-$(hostname)}"
local key_file="${2:-$HOME/.ssh/id_ed25519.pub}"
[[ -f "$key_file" ]] || { echo "Key file not found: $key_file" >&2; return 1; }
aws ec2 import-key-pair \
--key-name "$key_name" \
--public-key-material "fileb://$key_file"
}