3. Use CloudFront distribution url instead of S3 object url

Replace a url domain to CloudFront when providing a response to client.

S3 object url: https://our-company-lunch-3e8r.s3.ap-northeast-2.amazonaws.com/d155279f-96e7-48e3-aa23-2e7189a3eb16.png

CloudFront url: https://d3goaavn4i3bvn.cloudfront.net/d155279f-96e7-48e3-aa23-2e7189a3eb16.png

Now I can get an image from a CloudFront url using caching and compression functionality.

circle-info

If a client is a website, I need to check out CORS setting.

Go to S3 - Buckets - Select a bucket - Permissions tab - CORS - Edit.

Last updated