Skip to content

linking s3bucket to subdomain to be cdn

-1

please help im trying to set up my s3bucket to my assets.website. and i have created the bucket got the ec2 instance up and everything but none of my images are showing up on my domain and every time i goto the url it redirects me straight to the domain it self its not actually doing anything im trying to do or if it does it i get a security warning and i have a certificate i had a distribution but i deleted it just knwo because im doing something wrong thanks for your help i have a ec2 ngnix vite discordbot and trying to have all my images on my s3 bucket to help with ram it has to be https btw

4 Answers
0

i got everything done but i cant create the A record for my subdomain pointing to my bucket the only thing i can do is put one in for my distribution the transfer to s3 cloud thing isnt showing up

answered a month ago
  • Have you tried setting a cname instead?

0

To set up your S3 bucket as a CDN for assets.website.com with HTTPS, here's what you need to configure:

S3 Bucket Configuration:

  • Your bucket name must exactly match your subdomain: "assets.website.com"
  • Enable static website hosting on the bucket
  • Configure appropriate bucket permissions to allow public read access for your assets

Route 53 DNS Setup:

  • Create an alias record in Route 53 for "assets.website.com" that points to your S3 bucket
  • Ensure the hosted zone record name matches your bucket name exactly

CloudFront Distribution (Required for HTTPS): You mentioned deleting your distribution, but you actually need CloudFront to serve S3 content over HTTPS. S3 static website endpoints don't support HTTPS directly. Here's what to do:

  1. Create a CloudFront distribution with your S3 bucket as the origin
  2. Set the alternate domain name (CNAME) to "assets.website.com"
  3. Attach your SSL/ACM certificate to the CloudFront distribution
  4. Update your Route 53 alias record to point to the CloudFront distribution (not directly to S3)

Common Issues:

  • If images aren't showing, check your bucket's CORS configuration to allow requests from your main domain
  • Verify your EC2 application is referencing the correct URLs (https://assets.website.com/image.jpg)
  • The redirect you're experiencing suggests either incorrect DNS configuration or missing CloudFront setup

The security warning you saw was likely because you were trying to access S3 over HTTPS without CloudFront, which isn't supported for static website hosting endpoints.
Sources
Point Route 53 to an S3 static website | AWS re:Post

answered a month ago
EXPERT
reviewed a month ago
0

Hello.

As stated in the AI ​​automated response from re:Post Agent, S3's static website hosting feature does not allow delivery via HTTPS with a custom domain.
Therefore, CloudFront is required.
When using CloudFront as a CDN, delivery can be achieved by configuring the bucket policy to allow OAC (Open Access Control) instead of using S3's static website hosting.
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-s3.html

The following blog is very helpful for configuring CloudFront and OAC.
https://awstut.com/en/2022/11/27/deliver-s3-content-via-cloudfront-using-oac-en/

Please refer to the following documentation for instructions on configuring a custom domain for CloudFront.
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html

EXPERT
answered a month ago
EXPERT
reviewed a month ago
-1
Accepted Answer

ok on the static settings what do i do ?

answered a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.