I used this little bash script to pop a hole in the firewall from my current address:
#!/bin/sh AWS_IP=$(curl http://checkip.amazonaws.com) aws ec2 authorize-security-group-ingress --group-name my-security-group \ --protocol tcp --port 22 \ --cidr $AWS_IP/32
However, this leads to the fact that the security group is filled with holes from Swiss cheese from random IP addresses, so you will want to ask a question later on how to not have a security group with temporary addresses that are no longer yours. One way to answer this problem is to set up a VPN that has a (relatively) stable endpoint for the IP address, and then only allow this single address through the security group.
source share