Please read my 2 previous articles Use Amazon CloudFront for dynamic Websites -1 and Use Amazon CloudFront for dynamic Websites -2
In this article, I am going to show you how to create the CloudFront Distribution and test it.
Let’s get started!
Please visit my GitHub Repository for S3 articles on various topics being updated on constant basis.
5. Create the CloudFront Distribution.
- CloudFront is a content delivery network (CDN) that caches and serves content from multiple edge locations worldwide.
- When you create a CloudFront distribution with the Application Load Balancer as the origin, it accelerates the delivery of the dynamic PHP webpage, reducing latency and improving user experience.
1.
2. Origin Domain Name: Select the Load balancer my-LB
that you created
- take defaults
3.
Note: enable the query string forwarding because our server can accept the query string parameter ID
Note: The TTL option will be in disabled for dynamic contents by setting it to 0.
4.
Take all defaults
Click on the Create distribution
5. Status column shows Deploying, and then shows Last Modified Date for your distribution. Wait for the deployment to complete.
Note: Wait for This process will take around 4-5 minutes.
6. Test the distribution.
1. test the CloudFront distribution to verify that it is correctly serving content from the EC2 instances through the Application Load Balancer.
- Copy the CloudFront distribution Domain name and paste it in the browser and hit [enter].
2. refresh the page and see the instance ID change, and the time will keep incrementing.
3. Pass the query string parameter to CloudFront domain.
http://<domain name>/?id=CloudFront
http://dua7m5h1l3jyg.cloudfront.net/?id=CloudFront
Cleanup
- Delete Security Group and EC2 instance
- Remove index.php file from S3 bucket
- Delete Target Group and Load Balancer
- Delete Cloudfront Distribution
What we have done so far
- We have successfully created and tested the CloudFront Distribution with the Application Load Balancer as the origin.
- It show how it accelerates the delivery of the dynamic PHP webpage, reducing latency and improving user experience.
Top comments (0)