Menu
Getting Started with AWS
Hosting a Static Website

Step 1: Create the Buckets for Your Website

You can use Amazon Simple Storage Service (Amazon S3) to store all the content that makes up your static website, including HTML pages, images, CSS files, videos, and JavaScript files. Each file is stored in Amazon S3 as an object in a location called a bucket.

In this tutorial, you do the following:

  • Create the buckets for your website

  • Configure your buckets

  • Deploy your website

  • Clean up

If you plan to associate a domain name with your website, you can perform the following additional tasks, which are optional for this tutorial:

  • Register your domain name

  • Associate a domain name with your website

  • Speed up your website

Bucket Requirements

Amazon S3 requires that you give your bucket the same name as your domain. This requirement is so that Amazon S3 can properly resolve the host headers sent by web browsers when a user requests content from your website.

In addition to creating the example.com root domain bucket, you will create the logs.example.com bucket and www.example.com subdomain bucket. Be sure to create these buckets in the same AWS region where you created the example.com bucket. Amazon S3 stores log information about traffic to your website in the logs.example.com bucket. You'll set up the www.example.com bucket so that you can redirect traffic to the root domain bucket if a user specifies the www subdomain.

Buckets and Website URLs

When you host a website on Amazon S3, AWS assigns it a URL based on the name of the bucket that you create to store the website files and the region where you created the bucket. For example, if you create the bucket example.com in the US East (N. Virginia) region, the default URL for your website is as follows:

Copy
http://example.com.s3-website-us-east-1.amazonaws.com/

For more information, see Amazon Simple Storage Service Website Endpoints.

If this URL is acceptable for your purposes, such as creating a prototype website for a client to review, you can simply use the default URL and skip the steps in this tutorial that are related to registering a custom domain name and associating it with your website.

Creating the Buckets

To create the buckets for your website, use Amazon S3 to complete the following procedure. Note that you must replace example.com with the name of your domain.

To create the buckets for your website

  1. Open the Amazon S3 console at https://console.aws.amazon.com/s3/.

  2. Choose Create Bucket to open the Create Bucket dialog box.

  3. In the Create a Bucket dialog box, do the following:

    1. For Bucket Name, type a name for the bucket. Later in this tutorial, you'll upload the files for your website into this bucket (that is, the bucket for the root domain).

      Important

      You must use the same name that you intend to use for your domain. This name must also be unique across all existing bucket names in Amazon S3. In some AWS regions, there might be additional restrictions on bucket names. For more information, see Bucket Restrictions and Limitations in the Amazon Simple Storage Service Developer Guide.

    2. For Region, choose a region. By default, Amazon S3 creates buckets in the US Standard region. To reduce latency, minimize costs, or address regulatory requirements, you can choose a region that is closer to the users for your website. Objects that you store in a region never leave that region unless you explicitly transfer them to another region.

    3. Choose Create.

  4. After Amazon S3 creates your bucket, the console displays it in the Buckets pane, similar to the following.

  5. Repeat step 3 to create two additional subdomain buckets, logs.example.com (for the log files) and www.example.com (for the www subdomain). When you are finished, the console displays all three buckets, which should look similar to the following.