Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

https on S3 WITHOUT cloudfront possible?

We currently want to start hosting all our assets through AWS S3 and we also want to server everything over https. I understand I can use the Amazon Certificate Manager (ACM) with Cloudfront to server assets over https. The problem is that we are in the medical industry and we are legally prohibited to host anything outside the EU. With S3 I can choose a location (Frankfurt for us), but with Cloudfront I just get this option:

enter image description here

So I thought that I could maybe use Letsencrypt to generate my own certs. But I think I then still need to use ACM which only works with Cloudfront, which means I still can't use it.

Does anybody know if I can somehow setup S3 with https but without cloudfront?

like image 223
kramer65 Avatar asked Feb 24 '17 15:02

kramer65


People also ask

Can I use S3 without CloudFront?

You can use the S3 domain with the Amazon SSL certificate like: https://my-example-bucket.s3-website-us-east-1.amazonaws.com . If you want to use a custom domain with SSL, and you can't use CloudFront, then you will need to look into placing some other proxy in front of S3 like your own Nginx server or something.

Can S3 serve HTTPS?

Amazon S3 does not support HTTPS access to the website. If you want to use HTTPS, you can use Amazon CloudFront to serve a static website hosted on Amazon S3.

Is CloudFront necessary?

From this you can conclude that if the users are limited are from the same region as your S3 is hosted on, then you do not require to go for CloudFront, and if the number of users is increased on global level then you should definitely use CloudFront for better latency and traffic control.


2 Answers

Unfortunately you can't use an SSL certificate with your custom domain with S3. You can use the S3 domain with the Amazon SSL certificate like: https://my-example-bucket.s3-website-us-east-1.amazonaws.com.

If you want to use a custom domain with SSL, and you can't use CloudFront, then you will need to look into placing some other proxy in front of S3 like your own Nginx server or something.

like image 197
Mark B Avatar answered Oct 01 '22 04:10

Mark B


In AWS API Gateway, you can create a proxy resource /{proxy+} that maps to s3-website.

Be sure to map not to s3 alone, but s3-website, so you get PATH/TO/DIR/index.html returned for PATH/TO/DIR, and possibly other things working as desired.

API Gateway is served over HTTPS, optionally under your own domain.

This is not very good option though, because you have to manually add all allowed HTTP return codes, and there's a limit of 10MB payload in a request, as this service is aimed at REST APIs.

like image 30
atablash Avatar answered Oct 01 '22 05:10

atablash