Infrastructure Security

Amazon Inspector identifies unnecessary internet access to TCP port 22 on an EC2 instance whose intended SSH source is a corporate CIDR. One attached security group permits SSH from that CIDR, while another permits all TCP traffic from 0.0.0.0/0; which change removes public SSH access while preserving public HTTPS?

Show the answer

Correct answerA. Replace the all-TCP rule with a rule permitting TCP port 443 from 0.0.0.0/0.

AWhy this is right: Removing the broad TCP permission eliminates public SSH while retaining public HTTPS and corporate SSH.

BWhy not this: The other security group's all-TCP rule would still permit public SSH access.

CWhy not this: Removing the internet route would also disrupt the required public HTTPS access.

DWhy not this: Security groups support allow rules, not explicit deny rules.

Permissions from attached security groups are combined, so the broad all-TCP rule exposes SSH despite the restricted rule. Replacing it with HTTPS-only access preserves public HTTPS; narrowing the other group's SSH rule does not remove the broad permission.