An Amazon EC2 instance in a private subnet needs to make outbound HTTPS requests to an external API. The security group associated with the instance is configured with an outbound rule that allows traffic to any destination on port . There are no inbound rules configured on the security group. How does the security group handle the response traffic from the external API?
- The response traffic is automatically allowed because security groups are stateful.Answer
- BThe response traffic is blocked because security groups are stateless and require an explicit inbound rule for port .
- CThe response traffic is blocked because security groups operate at the subnet level and must allow return traffic for the entire CIDR block.
- DThe response traffic is blocked by default because AWS Shield Standard blocks all inbound internet traffic to private subnets.
Answer
The response traffic is automatically allowed because security groups are stateful.
The correct answer is that the response traffic is automatically allowed. Because security groups in Amazon VPC are stateful, any traffic that is explicitly allowed outbound is automatically allowed back inbound, bypassing the need for a corresponding inbound rule.
Step-by-Step Solution
Key Concept
Security Group Statefulness