Search code examples
amazon-web-servicesamazon-s3amazon-route53

AWS route subdomain to s3 static hosting


Lets say I have a hosted zone - hostabc.com and have an SSL Acm on that hosted zone.

  1. I created a S3 bucket name static-site with static hosting - static-site.s3-us-east-1.amazonaws.com.
  2. I create a subdomain - static.hostabc.com and route the alias to the S3 bucket

However when I access to some of the assets static.hostabc.com/style.css. The address url wasn't set SSL on it. How do I resolve this?


Solution

  • Unfortunately, you can't use an SSL certificate with an S3 static website and a custom domain.

    I would recommend using AWS CloudFront to handle this. You can point your sub domain to the CloudFront Distribution, which in turn resolves to your S3 static website. You can associate a CloudFront Distribution with an SSL certification in ACM.