SHARE
TWEET

Untitled

a guest Feb 14th, 2020 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   1 #!/bin/bash
  2.   2
  3.   3 ##
  4.   4 ## Create instances based on an AMI
  5.   5 ##
  6.   6
  7.   7 set -u
  8.   8 set -e
  9.   9
  10.  10 KEYPAIR="$1"
  11.  11
  12.  12 ## check if sshkey exists in the region
  13.  13 check-key-pair() {
  14.  14     cmd=(aws ec2 describe-key-pairs --key-names $1)
  15.  15     ${cmd[@]} >/dev/null 2>&1
  16.  16
  17.  17     return $?
  18.  18 }
  19.  19
  20.  20 keypair_exists="$(check-key-pair $KEYPAIR)"
  21.  21 echo "keypair exists=$keypair_exists"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top