Using VPC Origins With AWS CloudFront

Vinayak Pandey
2 min readNov 21, 2024

--

Reference: https://aws.amazon.com/blogs/aws/introducing-amazon-cloudfront-vpc-origins-enhanced-security-and-streamlined-operations-for-your-applications/

Recently AWS announced support for VPC Origins with CloudFront. Earlier we could use EC2 instances and Load balancers only if they had public IP associated with them. With this new feature, we can use internal load balancers/EC2 instances as CloudFront origin.

So let’s explore how to implement this feature.

Pre-requisite: Launch an EC2 instance and install httpd. Once installed, start the service and create a couple of web pages.

Step 1: In the security group associated with EC2 instance, allow acces to port 80 from CloudFront origin prefix list.

Step 2: Go to CloudFront->VPC origins and create a new origin. For Origin ARN, provide EC2 instance ARN.

Step 3: Now add a CloudFront origin. For origin domain, select your VPC origin id. For VPC origin domain, can specify private DNS address of your EC2 instance

Step 4: That’s all we need to do. Now try accessing CloudFront URLs and you should see the response from EC2 instance.

--

--

Vinayak Pandey
Vinayak Pandey

Written by Vinayak Pandey

Experienced Cloud Engineer with a knack of automation. Linkedin profile: https://www.linkedin.com/in/vinayakpandeyit/

No responses yet