Skip to content

Instantly share code, notes, and snippets.

@jsbonso
Last active February 27, 2023 22:36
Show Gist options
  • Save jsbonso/6c6ca23373d0516d7a55a9aeaeaa26ff to your computer and use it in GitHub Desktop.
Save jsbonso/6c6ca23373d0516d7a55a9aeaeaa26ff to your computer and use it in GitHub Desktop.
Shell Script to add your IP to your EC2 Security Group using AWS CLI
MY_IP=`curl checkip.amazonaws.com`
echo $MY_IP
aws ec2 authorize-security-group-ingress \
--group-id sg-01298cde13c80c75 \
--protocol tcp \
--port 22 \
--cidr $MY_IP/32 \
--region us-east-1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment