Course menuSAA-C03

Exams / SAA-C03 / Study guide / Security groups and network ACLs

Security groups and network ACLs: SAA-C03 study notes and practice questions

What to know about Security groups and network ACLs for the SAA-C03 exam, from the Design Secure Architectures domain (30% of the exam guide), then 3 free questions to test it. Part of the SAA-C03 study guide.

Last verified against current AWS documentation ·How we write our questions

What to know for the exam

Network security questions on SAA-C03 usually come down to one of three choices: security group or network ACL, public or private subnet, and internet path or private path (VPC endpoint).

Security groups vs network ACLs

Security group Network ACL
Applies to Elastic network interfaces (instances, load balancers, RDS, Lambda in a VPC) A whole subnet
Rules Allow only Allow and deny
State Stateful: return traffic is allowed automatically Stateless: return traffic needs its own rule (ephemeral ports)
Evaluation All rules together In order, lowest rule number first; first match wins
Can reference Other security groups CIDR ranges only

Key facts

  • To block a specific IP range, use a network ACL deny rule numbered lower than the allow rule. Security groups can’t deny.
  • Reference security groups, not IP addresses, between tiers: allow the app tier only from the load balancer’s security group, and the database only from the app tier’s. It keeps working as instances come and go.
  • Private subnets have no route to an internet gateway. Instances there reach the internet outbound through a NAT gateway in a public subnet, and nothing can start a connection to them from the internet.
  • Gateway endpoints (S3 and DynamoDB only) add a route to the route table, are free, and keep traffic off the internet. Interface endpoints (AWS PrivateLink) put an ENI in your subnet for most other services, cost per hour and per GB, and can be reached from on premises over VPN or Direct Connect.
  • Endpoint policies and bucket policies work together: an S3 bucket policy with aws:SourceVpce can refuse any request that didn’t come through your endpoint.

Common traps

  • Using a security group to “deny” traffic. Not possible; remove the allow or use a network ACL.
  • Forgetting ephemeral ports on a network ACL. Responses leave on high-numbered ports, so a stateless ACL that only allows port 443 inbound breaks replies unless outbound 1024-65535 is allowed.
  • Sending S3 traffic through a NAT gateway. It works, but costs more and leaves the VPC; a gateway endpoint is cheaper and more private.
  • Putting web servers in a public subnet “for the load balancer”. Only the load balancer needs to be public.

Try the 3 practice questions

Question 1

Medium · choose 2 ·Link to this question (question 1)

A retailer is launching a web application with the network design shown in the diagram. An internet-facing Application Load Balancer (ALB) in the public subnets forwards HTTPS requests to web servers in two Availability Zones.

A security review of the first test deployment found that the launch template puts the web servers in the public subnets with public IPv4 addresses, and that their security group allows HTTPS from 0.0.0.0/0.

The web servers must be reachable only through the ALB.

Which TWO actions should a solutions architect take? (Choose two.)

Architecture diagram: users on the internet reach an Application Load Balancer in two public subnets, which forwards traffic to web servers in two private subnets, one in each of two Availability Zones.
Read a full description of the diagram

A VPC spans two Availability Zones. Each zone has a public subnet and a private subnet. An internet gateway is attached to the VPC. The Application Load Balancer has a node in each public subnet. Web servers on EC2 sit in each private subnet. Arrows show user traffic going from the internet, through the internet gateway, to the load balancer, and then to the web servers.

Choose two answers.

  1. A. Change the web servers' security group so that it allows inbound HTTPS only from the security group that is attached to the ALB.
  2. B. Update the launch template to use the private subnets and to stop assigning public IPv4 addresses to the web servers.
  3. C. Add a network ACL rule to the private subnets that allows inbound HTTPS only from the ALB's security group, and deny everything else.
  4. D. Recreate the ALB with the internal scheme so that its nodes have only private IP addresses inside the VPC.
  5. E. Keep HTTPS open to 0.0.0.0/0 on the web servers, and attach an AWS WAF web ACL to the ALB to filter requests.
Show the answer and explanation

Answers: A, B

Explanation

Use two layers. Placing the web servers in private subnets without public IP addresses removes any direct path from the internet, and allowing inbound HTTPS only from the ALB's security group means that even traffic from inside the VPC must come through the load balancer. Network ACLs cannot reference security groups, an internal ALB would cut off customers, and AWS WAF does not protect traffic that bypasses the ALB.

Study

A news website runs on Amazon EC2 instances in one public subnet, and the instances use several different security groups.

Monitoring shows a flood of malicious requests from the address range 203.0.113.0/24 to every instance in the subnet. The subnet's network ACL has inbound rule 100, which allows HTTPS from 0.0.0.0/0.

The team wants one change that blocks the range for the whole subnet while legitimate readers keep access.

What should a solutions architect do?

Choose one answer.

  1. A. Add inbound rule 50 to the subnet's network ACL that denies all traffic from 203.0.113.0/24.
  2. B. Add inbound rule 200 to the subnet's network ACL that denies all traffic from 203.0.113.0/24.
  3. C. Add an inbound rule that denies traffic from 203.0.113.0/24 to each of the security groups used by the instances.
  4. D. Remove the 0.0.0.0/0 HTTPS rules from the security groups, and allow only the address ranges of known readers.
Show the answer and explanation

Answer: A

Explanation

Network ACLs are stateless, subnet-level filters that support both allow and deny rules, evaluated in order from the lowest rule number. A deny for 203.0.113.0/24 numbered below the existing allow rule blocks the range for every instance in the subnet with one change. Security groups are allow-only and apply per instance.

Study

A company runs AWS Lambda functions in private subnets of a VPC so that they can query an Amazon RDS database in the same subnets.

The functions must now also read and write items in an Amazon DynamoDB table. The security team does not allow any route from these subnets to the internet, and the company wants the lowest ongoing cost.

What should a solutions architect do?

Choose one answer.

  1. A. Add a NAT gateway in a new public subnet, and route the private subnets' traffic for DynamoDB through the NAT gateway.
  2. B. Create an interface VPC endpoint for DynamoDB in each Availability Zone used, with a security group that allows HTTPS from the functions.
  3. C. Create a gateway VPC endpoint for DynamoDB, and add it to the route tables of the private subnets that the functions use.
  4. D. Remove the VPC configuration from the functions so they reach DynamoDB directly, and connect to the database through an RDS Proxy.
Show the answer and explanation

Answer: C

Explanation

Gateway VPC endpoints for Amazon S3 and DynamoDB add a route table entry that sends traffic for the service over the AWS network, with no internet gateway, NAT gateway or extra charge. DynamoDB also supports interface endpoints, which are needed for on-premises or cross-Region access but cost more. Moving the functions out of the VPC would cut them off from the database.

A gateway VPC endpoint for S3 or DynamoDB beside a NAT gateway An application in a private subnet uses a route table. Traffic for the S3 or DynamoDB prefix list goes to a gateway endpoint, which is free and can carry an endpoint policy, and reaches the service over the AWS network. Any other internet traffic still goes through a NAT gateway. Private subnets Application private subnet Route table prefix list → endpoint Gateway endpoint free, endpoint policy NAT gateway other traffic only S3 or DynamoDB AWS network Internet
A gateway endpoint for DynamoDB adds a route, so the functions reach the table with no NAT gateway and no extra charge.

Study

Want more on Security groups and network ACLs? The 5 full-length practice sets have 10 more Security groups and network ACLs questions, 325 in all, none of them in the free exam. One payment of $14.99, no subscription. See the practice sets

Study Security groups and network ACLs

More Design Secure Architectures topics