Security Group Referencing Best Practices
A security engineer is designing a security group configuration for a web application that consists of an Application Load Balancer (ALB), Amazon EC2 instances in an Auto Scaling group, and an Amazon RDS database. Which TWO actions should the engineer take to follow security best practices? (Choose TWO.)
Quick Answer
The correct answer is to configure the RDS security group to allow inbound traffic on port 3306 from the EC2 instance security group, alongside referencing the ALB security group as the source in the EC2 security group rule. This follows security group referencing best practices by using logical security group IDs rather than static IP ranges, which creates a dynamic, tightly scoped trust boundary that automatically adapts as the ALB’s elastic network interfaces scale. On the AWS Certified Advanced Networking Specialty ANS-C01 exam, this concept tests your understanding of stateful, resource-level access control versus traditional CIDR-based rules—a common trap is to mistakenly use the ALB’s private IP range, which breaks auto-scaling and introduces management overhead. Remember the memory tip: “Reference the source, not the IP—let the group do the filtering for you.”
⚠ Common exam trap
AWS often tests the misconception that security groups should be configured with IP ranges (e.g., 0.0.0.0/0) for simplicity, rather than using security group references to enforce least-privilege access between tiers.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Configure the EC2 instance security group to allow inbound traffic on port 443 from the ALB security group.
Referencing the ALB security group as the source in the EC2 security group rule ensures that only traffic originating from the ALB (and not any other source) is allowed on port 443. This follows the security best practice of using security group references instead of IP ranges, providing a tighter, more dynamic access control that automatically scales with the ALB's elastic network interfaces.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Configure the RDS security group to allow inbound traffic on port 3306 from 0.0.0.0/0.
Why it's wrong here
Should not allow all traffic.
- ✓
Configure the EC2 instance security group to allow inbound traffic on port 443 from the ALB security group.
Why this is correct
Best practice: reference security group instead of CIDR.
- ✓
Configure the RDS security group to allow inbound traffic on port 3306 from the EC2 instance security group.
Why this is correct
Best practice: restrict database access to app servers.
- ✗
Configure the ALB security group to allow inbound traffic on port 443 from the security group of the EC2 instances.
Why it's wrong here
ALB should allow inbound from internet, not EC2.
- ✗
Configure the ALB security group to allow inbound traffic on port 80 from the security group of the EC2 instances.
Why it's wrong here
ALB inbound should be from clients.
Go deeper
Related to this question
About these practice questions
Courseiva writes every ANS-C01 question from scratch — 1,621 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
Same concept, more angles
2 more ways this is tested on ANS-C01
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. A network engineer is designing a security group for a web application that must allow inbound HTTPS traffic from the internet and outbound traffic to an RDS MySQL database. The web servers are in a public subnet and the RDS database is in a private subnet. What is the most secure way to configure the security groups?
medium- ✓ A.Web SG: inbound HTTPS from 0.0.0.0/0; outbound MySQL to DB SG. DB SG: inbound MySQL from Web SG.
- B.Web SG: inbound HTTPS from 0.0.0.0/0; outbound 0.0.0.0/0. DB SG: inbound MySQL from Web SG.
- C.Web SG: inbound HTTPS from 0.0.0.0/0; outbound MySQL to DB SG. DB SG: inbound MySQL from 0.0.0.0/0.
- D.Web SG: inbound HTTPS from 0.0.0.0/0; outbound 0.0.0.0/0. DB SG: inbound MySQL from 0.0.0.0/0.
Why A: The most secure configuration. The web server security group allows inbound HTTPS from the internet (0.0.0.0/0) and outbound MySQL traffic specifically to the database security group. The database security group allows inbound MySQL only from the web server security group. This ensures that only the web servers can communicate with the database, minimizing exposure. Option B is less secure because the web server security group allows outbound traffic to 0.0.0.0/0, which is overly permissive. Option C is incorrect because the database security group allows inbound MySQL from 0.0.0.0/0, exposing the database to the internet. Option D combines both overly permissive outbound and inbound rules, making it the least secure.
Variation 2. A company is designing a network security architecture for a VPC that hosts a multi-tier application. The security team requires that the web tier can only be accessed from the internet, the application tier can only be accessed from the web tier, and the database tier can only be accessed from the application tier. Additionally, the team needs to ensure that no traffic can bypass these controls. Which THREE actions should the team take?
hard- ✓ A.Use security group rules that reference other security groups as sources.
- ✓ B.Configure security groups to allow only necessary traffic between tiers.
- ✓ C.Configure network ACLs (NACLs) to allow only necessary traffic between subnets as a defense-in-depth measure.
- D.Enable VPC Flow Logs on all subnets and send logs to Amazon S3.
- E.Attach an internet gateway to the VPC and add a default route to the internet gateway in the web tier subnet's route table.
Why A: Security group rules can reference other security groups as sources, which allows the web tier security group to permit traffic only from the application tier security group, and the application tier security group to permit traffic only from the database tier security group. This creates a logical, stateful firewall that enforces the required traffic flow between tiers without relying on IP addresses, ensuring that no traffic can bypass the controls even if subnet configurations change.
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This ANS-C01 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the ANS-C01 exam.