How can you restrict ALB traffic to CloudFront at the network layer?

A company is using an Amazon CloudFront distribution that is configured with an Application Load Balancer (ALB) as an origin. A network engineer needs to implement a solution that requires all inbound traffic to the ALB to come from CloudFront. The network engineer must implement the solution at the network layer rather than in the application. Which solution will meet these requirements in the MOST operationally efficient way?

  1. Add an inbound rule to the ALB's security group to allow the AWS managed prefix list for CloudFront. Source Reference Answer
  2. Add an inbound rule to the network ACLs that are associated with the ALB's subnets. Use the AWS managed prefix list for CloudFront as the source in the rule.
  3. Configure CloudFront to add a custom HTTP header to the requests that CloudFront sends to the ALB.
  4. Associate an AWS WAF web ACL with the ALB. Configure the AWS WAF rules to allow traffic from the CloudFront IP set. Automatically update the CloudFront IP set by using an AWS Lambda function.

Community Votes

A
85%
C
15%

85% of anonymous learners picked answer A. Votes are pick records left by other test-takers — they are not the verified answer.

Community Insight

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.

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.

Community Discussion (9 comments)

veyisceylan 👍 6
It 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.
AzureDP900 👍 2 Selected: A
A 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.
woorkim 👍 1 Selected: A
AWS 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 👍 1
C - This defines the solution https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/restrict-access-to-load-balancer.html
[Removed] 👍 3 Selected: A
Question explicitly ask for changes at network layer.
Akshay0403 👍 3 Selected: A
Option 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.
Blitz1 👍 2 Selected: A
A because is saying at network layer. https://aws.amazon.com/about-aws/whats-new/2022/02/amazon-cloudfront-managed-prefix-list/
rdiaz 👍 2 Selected: C
cloudfront header and alb condition
AXH 👍 2
Voting for C.

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

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

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.

Related Analysis

Practice All ANS-C01 Questions

Access 137 questions with complete answers and detailed explanations.

View Full ANS-C01 Practice Test →

← Back to ANS-C01 Study Guide