Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  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'}]"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement