An Amazon S3 bucket is very suitable to serve your static content in an serverless way. You don´t have to waste even a single thought on scaling. It makes no difference if you must serve one file per second or thousands and you pay only for the traffic your site is generating.

This post provides an overview of how to use S3 as an Webserver for static Content. It starts with the most simple way and goes down to more advanced options.

Enable Website Hosting for a Bucket

This is the most trivial option to use an S3 bucket to serve the static content of a website is to enable this feature on the „Properties“ Tab for that S3 bucket or to use the CLI.


aws s3 website s3://my-bucket/ –index-document index.html

This solution has several drawbacks and is also not the AWS preferred way.

  • The URL ist not very readable
  • Only HTTP is supported
  • The S3 bucket and every object that should be served must be public

Using Route 53 and enabled Website Hosting

Option Two is a combination of enabled Website Hosting and the use of Amazon Route 53.

Route 53 is Amazons DNS Service. If your Site domain is managed by Route 53 it is possible to configure a S3 bucket as an DNS alias e.g to serve your content under The picture shows that configuration for my private domain. The only prerequisite is that the S3 bucketname is equal to your DNS Record Name. For the domain the bucketname must be also Because bucketnames are globally it is possible that your needed name is already used by an other user.


With this option we get a more convenience url, but your content is also available under the S3 default URL, HTTPS is not supported and all Content must be public readable.

Use CloudFront and Route 53 to deliver Content from S3

At the End the most advanced options that gives plenty of options and is the AWS preferred way for deliver static content from an S3 bucket. We use CloudFront and Route 53 in combination. The following picture shows that solution.

With such a setup it is possible to map every bucketname to your domain name, the bucket can be private and we can restrict the access to allow only https.

For a more detailed Description and an example read the following blogpost.



Alle Beiträge von Marco Buss

Schreibe einen Kommentar