Serving S3 content via Cloudfront CDN
- Create a S3 bucket and upload a image in that bucket
- Make sure image uploaded in S3 bucket has public access
- After the upload is complete, you can navigate to the item by using its URL. For example:
https://
<bucket name>
.s3-<AWS Region>
.amazonaws.com/<object name>
-
To create a CloudFront distribution
- Open the CloudFront console at https://console.aws.amazon.com/cloudfront/.
- Choose Create Distribution.
- On the Select a delivery method for your content page, in the Web section, choose Get Started.
- On the Create Distribution page, for Origin Domain Name, choose the Amazon S3 bucket that you created earlier. For Origin Path, Origin ID, Restrict Bucket Access, and Origin Custom Headers, accept the default values.
- Under Default Cache Behavior Settings, accept the default values. CloudFront will:
- Under Distribution Settings, choose the values for your distribution:
- Choose Create Distribution.
- After CloudFront creates your distribution, the value of the Status column for your distribution changes from In Progress to Deployed. This typically takes between 20 and 40 minutes.
- Test Your Link: For example, if your domain name was
d111111abcdef8.cloudfront.net
and your object wasimage.jpg
, the URL for the link would this:https://d111111abcdef8.cloudfront.net/image.jpg
.If your object is in a folder within your bucket, include the folder in the URL. For example, ifimage.jpg
is located in an images folder, the URL would be this:https://d111111abcdef8.cloudfront.net/images/image.jpg
Comments are closed, but trackbacks and pingbacks are open.