Option 1: no inbound SSH at all (Session Manager)
AWS Systems Manager Session Manager gives shell access through the AWS API, with no open port. It is a great default for EC2, but it does not help with databases, admin panels or third-party services that also need an allowlist.
Option 2: update the rule automatically
A small script can replace the rule with your current IP before you connect. It works for one person, but it is fragile for a team and leaves old IPs behind.
MYIP=$(curl -s https://checkip.amazonaws.com)
aws ec2 authorize-security-group-ingress \
--group-id sg-0123456789abcdef0 \
--protocol tcp --port 22 --cidr "$MYIP/32"Option 3: one static IP for the whole team
Give everyone a WireGuard config on a server with a fixed IPv4, and allow only that address. When someone leaves, revoke their config; the security group never changes.
aws ec2 authorize-security-group-ingress \
--group-id sg-0123456789abcdef0 \
--protocol tcp --port 22 --cidr 203.0.113.42/32Route only AWS traffic through the tunnel
If people should keep their normal internet connection, change AllowedIPs in their WireGuard config to just the addresses they need, for example your instances' public IPs or a load balancer:
[Peer]
# ...
AllowedIPs = 10.66.0.1/32, 198.51.100.10/32, 198.51.100.11/32Good practice
- One config per person, named in your password manager, so offboarding is one click.
- Use the same static IP for GitHub, Google Workspace and database allowlists.
- Keep Session Manager for break-glass access.
Skip the setup
A dedicated server and static IPv4 in 38 cities, ready in about 3 minutes. WireGuard for people, SOCKS5/HTTP proxy for code. From $9.99/month.