How can you restrict ALB traffic to CloudFront at the network layer?
Short answer
A Add an inbound rule to the ALB's security group to allow the AWS managed prefix list for CloudFront.
Question
Key Takeaways
This question tests whether you can distinguish network-layer controls (security groups, NACLs) from application-layer controls (custom headers, WAF) and recognize AWS managed prefix lists as the most operationally efficient option.
To restrict an ALB to CloudFront traffic at the network layer, reference the AWS managed prefix list for CloudFront in the ALB's security group. The community strongly favors option A (85%) because it is operationally efficient and aligns with the network-layer requirement, while option C is an application-layer workaround.
Common mistake: Choosing C (custom HTTP header) is the most common mistake because AWS documentation commonly recommends it for restricting ALB access, but it is an application-layer mechanism, not a network-layer one.
Expert Analysis
Understanding the requirement
The company needs to ensure that all inbound traffic to the Application Load Balancer comes only from CloudFront. The key qualifiers are "network layer" and "most operationally efficient". In AWS, network-layer controls include VPC security groups and network ACLs that filter packets based on IP addresses, protocols, and ports. Application-layer controls, on the other hand, rely on HTTP headers, AWS WAF rules, or ALB listener logic.
Why option A is correct
Option A adds an inbound rule to the ALB's security group with the AWS managed prefix list for CloudFront as the source. A managed prefix list is a set of CIDR blocks that AWS maintains automatically for CloudFront edge locations. This means the security group will only accept traffic from CloudFront IP ranges, and AWS handles updates to those ranges. This is a network-layer enforcement because security groups filter traffic at the instance/ENI level.
This approach is also operationally efficient: there is no Lambda function, no custom header configuration, and no application changes. As community commenter [3] noted, the managed prefix list "can be used in the ALB's security group to restrict access to only traffic originating from CloudFront without manually managing IP ranges." Commenter [5] also emphasized that the question "explicitly ask[s] for changes at network layer," making option A the natural fit.
Why option B is incorrect
Option B appears network-related, but it has several problems. Network ACLs are stateless, so you would need to manage both inbound and outbound rules, including ephemeral ports for return traffic. More importantly, NACLs are attached to subnets, not to the ALB specifically, so they affect all traffic in those subnets, including traffic to other resources. Additionally, AWS managed prefix lists are not supported in network ACL rules; they are designed for security groups and route tables. Therefore, option B is not a valid solution, and even if it were, it would be less operationally efficient and less targeted than option A.
Why option C is incorrect
Option C uses a custom HTTP header that CloudFront adds to requests before forwarding them to the ALB. You would then configure an ALB rule to only forward traffic that contains that header. This is a valid and commonly documented approach for restricting access to an ALB, but it is an application-layer (Layer 7) solution. The question specifically requires implementation at the network layer, so option C fails the primary requirement. Community commenter [4] referenced the official AWS documentation for this approach, and commenter [8] voted for C, but they did not account for the explicit network-layer constraint. This is the classic trap in this question.
Why option D is incorrect
Option D uses AWS WAF with an IP set for CloudFront, updated by a Lambda function. WAF is a Layer 7 firewall, not a network-layer control. In addition, maintaining a WAF IP set and a Lambda updater introduces significant operational overhead. It is neither a network-layer solution nor the most operationally efficient way to meet the requirement. The managed prefix list in option A provides the same IP-based restriction with far less complexity and no custom automation.
Final conclusion
Option A is correct because it uses an AWS managed prefix list in the ALB's security group, meeting both the network-layer and operational-efficiency requirements. It avoids application changes, avoids stateless NACL complexity, and leverages AWS-managed IP updates. As community commenter [7] pointed out, the AWS announcement for the CloudFront managed prefix list confirms this is the intended solution.
Official Reference
- https://aws.amazon.com/about-aws/whats-new/2022/02/amazon-cloudfront-managed-prefix-list/
- https://docs.aws.amazon.com/vpc/latest/userguide/working-with-aws-managed-prefix-lists.html
- https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/restrict-access-to-load-balancer.html
- https://docs.aws.amazon.com/vpc/latest/userguide/vpc-network-acls.html
These links open the official vendor documentation in a new tab.
Exam Strategy
Look for qualifiers like "network layer" and "most operationally efficient" — they are designed to eliminate the common application-layer solution. When an AWS managed prefix list is available for CloudFront, the simplest and most correct answer is usually to reference it in a security group rule rather than building custom Lambda or WAF automation.
Community Votes
85% of anonymous learners picked answer A. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 9 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 9
-
veyisceylan 👍 6It is asking a solution at network layer rather than application layer. Therefore it is A in my opinion. A managed prefix list is a set of one or more CIDR blocks. You can use prefix lists to make it easier to configure and maintain your security groups and route tables.
-
Akshay0403 👍 3 Answered AOption A is the most operationally efficient solution as it leverages AWS managed prefix lists, ensuring up-to-date and secure traffic management to the ALB from CloudFront. Security groups provide a straightforward way to enforce network layer restrictions without additional administrative overhead or application changes. This aligns well with the requirement to implement a solution strictly at the network layer.
-
[Removed] 👍 3 Answered AQuestion explicitly ask for changes at network layer.
-
AzureDP900 👍 2 Answered AA is right Adding an inbound rule to the ALB's security group to allow the AWS managed prefix list for CloudFront ensures that only traffic coming from CloudFront is allowed to reach the ALB. This meets the requirement of having all inbound traffic to the ALB come from CloudFront.
-
Blitz1 👍 2 Answered AA because is saying at network layer. https://aws.amazon.com/about-aws/whats-new/2022/02/amazon-cloudfront-managed-prefix-list/
Show 4 more comments
-
rdiaz 👍 2 Answered Ccloudfront header and alb condition
-
woorkim 👍 1 Answered AAWS Managed Prefix List for CloudFront: AWS provides a managed prefix list that includes the IP ranges for CloudFront edge locations. By using this list in the ALB's security group, the network engineer can restrict access to only traffic originating from CloudFront without manually managing IP ranges. Operational Efficiency: This approach is operationally efficient because: The managed prefix list is automatically updated by AWS whenever CloudFront's IP ranges change. Security groups are simple to configure and maintain compared to other options like network ACLs or AWS WAF.
-
Spaurito 👍 1C - This defines the solution https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/restrict-access-to-load-balancer.html
-
AXH 👍 2Voting for C.
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All ANS-C01 Questions
Access 137 questions with complete answers and detailed explanations.
View Full ANS-C01 Practice Test →