Amazon Cloud Front is a web service that speeds up distribution of your static and dynamic web content, such as .html, .css, .php, and image files, to your users.
Cloud Front delivers your content through a worldwide network of data centers called edge locations.
When a user requests content that you’re serving with Cloud Front, the user is routed to the edge location that provides the lowest latency (time delay),
If the content is already in the edge location with the lowest latency, Cloud Front delivers it immediately. If the content is not in that edge location, Cloud Front retrieves it from an Amazon S3 bucket or an HTTP server (for example, a web server) that you have identified as the source for the definitive version of your content.
This dramatically reduces the number of networks that your users’ requests must pass through, which improves performance. Users get lower latency—the time it takes to load the first byte of the file—and higher data transfer rates. You also get increased reliability and availability because copies of your files (also known as objects) are now held in multiple edge locations around the world.
Cloud Front Configuration:-
Will host a website in an s3 bucket then will create cloud front web distribution
- Once you login in to the AWS console, click on services select S3.
2. Click on create a bucket, then give bucket name region( where you want to create, click on create.
3. Then upload the file (index.html) which having the content from your local machine.
4. Make the file as public.
5. Click on bucket name go to permission and click on bucket policy
6. Go to services select route 53
7. Click on created hosted zone, then it will ask you your domain name and click on create.
8. Copy the name values and paste in domain account
9. Go to AWS console click on services, click on cloud front, then we can find screen like this
10. Click on create distribution then click on get started
11. Select the domain name and origin ID
12. Here we can go with default cache behavior settings
13. Here we can select distribution settings, where we want to store the cache, and give cnames and default root object then click on create.
14. Once you done you can find this screen and copy domain name and paste in route 53
15. Go to route 53, open hosted zone click on record set, click on alias yes paste domain name at alias target place.
16. To restrict our website in particular region go to route 53, click on distribution settings.
17. Then go to restrictions and click on edit
18. enable Geo restrictions, check black list, select countries click on add and click on yes and edit.
19. Once status become deployed, create one instance on Singapore try to search your domain you will get error.(blocked by cloud front)
20. On other regions you can able to access.