You operate multiple AWS accounts and need to audit whether any security group is open to 0.0.0.0/0 on SSH. How do you do it at scale?
AdvancedScenarioVPC & Cloud Network Design
Answer
Situation read → You need continuous detection, not a one-off script.
What I'd do →
- Enable AWS Config rule
restricted-sshin all accounts via an aggregator - Query with
aws ec2 describe-security-groups --filters Name=ip-permission.from-port,Values=22 Name=ip-permission.cidr,Values=0.0.0.0/0 - Use Security Hub findings and EventBridge to auto-remediate or page
- Block creation with an SCP or Terraform policy check (OPA, Checkov)
Why → Detective control plus preventive control in CI closes the loop.
Interview tip → Say remediation by auto-revoking is only safe after teams were warned.
More on VPC & Cloud Network Design
What makes a subnet public versus private in AWS?BeginnerExplain internet gateway versus NAT gateway and when you use each.BeginnerPrivate instances need to pull packages from the internet but must not be reachable from it. What do you set up?BeginnerWhy shouldn't production run in the default VPC?BeginnerPublic IP, Elastic IP and private IP: how do they differ on EC2?BeginnerWhy use SSM Session Manager instead of a bastion host?Beginner