0
votes

I have my s3 bucket website being hosted at 'http://.s3-us-west-2.amazonaws.com/index.html' but i want it to be hosted at https:// without the long name of it. How can i get this working?

In origin of the CloudFront distribution i have tried using the URL of the Static Website hosting which includes 'website' as well as the AWS recommended one and also the URL which works for me. I have tried using CloudFront but the website just doesn't load up anything when i access the URL with 'https://'. Is there any changes to be made in my CloudFront distribution or is there any other alternatives other than CloudFront?

Any help is appreciated.

3

3 Answers

0
votes

Hosting a static website on S3 and serving it with Cloudfront and a custom domain with SSL is one of the most popular uses of AWS.

The docs have some great tutorials on how to set this up, but the master reference is the AWS whitepaper on Hosting Static Websites on AWS.

0
votes

Sort of answered here: Setting up a CNAME for an S3 bucket using Amazon Route 53 . But in general it sounds like you are asking first how to redirect to or setup a TLS/SSL proxy to an S3 bucket, and second how use your own domain name instead of amazonaws.com. There might even be a third aspect, how to use your own HTTPS/SSL certificate with AWS. If the issue is specifically with Cloudfront, then this Amazon page might help with options for custom SSL certificates: https://aws.amazon.com/cloudfront/custom-ssl-domains/ .

0
votes

If it is just about hosting an S3 bucket from a custom domain, you should read the corresponding S3 docs. [1]

If you really need SSL then you must use CloudFront as described in another SO thread. [2]
If you follow the "Using Amazon S3 Buckets Configured as Website Endpoints for Your Origin" section in the docs, it should be possible to connect S3 and CloudFront. [3]
Then, you can set a custom domain name via CNAME in CloudFront. [4]

References

[1] https://docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-custom-domain-walkthrough.html
[2] How to Configure SSL for Amazon S3 bucket
[3] https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistS3AndCustomOrigins.html#concept_S3Origin_website
[4] https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html