Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1 #!/bin/bash
- 2
- 3 ##
- 4 ## Create instances based on an AMI
- 5 ##
- 6
- 7 set -u
- 8 set -e
- 9
- 10 KEYPAIR="$1"
- 11
- 12 ## check if sshkey exists in the region
- 13 check-key-pair() {
- 14 cmd=(aws ec2 describe-key-pairs --key-names $1)
- 15 ${cmd[@]} >/dev/null 2>&1
- 16
- 17 return $?
- 18 }
- 19
- 20 keypair_exists="$(check-key-pair $KEYPAIR)"
- 21 echo "keypair exists=$keypair_exists"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement