Created
August 19, 2021 03:15
-
-
Save indiejoseph/e96c3cce39ac1ef7b0c8002d96a49b40 to your computer and use it in GitHub Desktop.
auto whitelist local ip into AWS security group
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# script to pull my current public IP address | |
# and add a rule to my EC2 security group allowing me SSH access | |
curl v4.ifconfig.co/ip > ip.txt | |
awk '{ print $0 "/32" }' < ip.txt > ipnew.txt | |
export stuff=$(cat ipnew.txt) | |
aws ec2 authorize-security-group-ingress --group-name NewGroup \ | |
--protocol tcp --port 22 --cidr $stuff |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment