Reputation: 95
I have an application hosted on EC2 instance. Now I want to fetch all the static content used in application from Cloudfront. Read from a source that Cloudfront uses S3/EC2 or private servers to get the static files. I can't come to solution what exactly to use? Can I use same EC2 instance for this purpose? Any better option for this implementation?
Upvotes: 0
Views: 2421
Reputation: 1
simply Amazon s3 is used for cloud storage where as Amazon EC2(elastic cloud) is used to server web pages(hosting) same as like godaddy.com.
Upvotes: 0
Reputation: 270154
Amazon CloudFront sits "in front" of your application on Amazon EC2 and/or your content in Amazon S3. It caches content in 50+ locations when people access your application.
For example, let's say you had a web app running on an EC2 instance serving HTML pages, and also some pictures in S3.
You would create a CloudFront distribution and configure two origins: one for your web server and one for your S3 bucket. Behaviours can be configured to tell CloudFront when to use each origin -- for example, serve *.htm
URLs from EC2 and *.jpg
URLs from S3.
Your users would then access your application via the supplied CloudFront URL. Content will be cached (if appropriate) at one of the 50+ CloudFront locations around the world that is closest to each of your users, resulting in faster response times for your user.
You can also use your own domain name with CloudFront so that it has a more-friendly URL than the one supplied on the CloudFront distribution (which looks like d3i7tv8nzqzfbt.cloudfront.net).
Upvotes: 3