SHARE
TWEET

Untitled

a guest Jul 16th, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. [ $# -ne 1 ] && echo "Usage: $0 <security group id>" && exit 1
  3.  
  4. SG_ID=$1
  5. MY_IP=$(dig +short myip.opendns.com @resolver1.opendns.com)
  6.  
  7. aws ec2 authorize-security-group-ingress --group-id ${SG_ID} \
  8.     --ip-permissions IpProtocol=tcp,FromPort=22,ToPort=22,IpRanges="[{CidrIp=${MY_IP}/32,Description='Open 22 port with awscli'}]"
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