31
Getting Started Guide AWS Static Website Hosting

Awsgsg swh

Embed Size (px)

Citation preview

Page 1: Awsgsg swh

Getting Started GuideAWS Static Website Hosting

Page 2: Awsgsg swh

Getting Started Guide: AWS Static Website HostingCopyright © 2011 Amazon Web Services LLC or its affiliates. All rights reserved.

Getting Started Guide AWS Static Website Hosting

Page 3: Awsgsg swh

Overview ................................................................................................................................................ 1Getting Started ...................................................................................................................................... 4Step 1: Sign Up for the Service .............................................................................................................. 4Step 2: Create an Amazon S3 Bucket .................................................................................................... 5Step 3: Create an Amazon CloudFront Distribution ............................................................................... 8Step 4: Hosting Your Website ............................................................................................................... 13Step 5: Clean Up .................................................................................................................................. 17

Disable and Delete an Amazon CloudFront Distribution ............................................................ 17Delete Objects and an Amazon S3 Bucket ................................................................................. 18

Amazon Route 53 ................................................................................................................................ 19Pricing .................................................................................................................................................. 20Amazon S3 Cost Breakdown ............................................................................................................... 20Amazon CloudFront Cost Breakdown ................................................................................................... 22Summing It All Up ................................................................................................................................ 24Related Resources ............................................................................................................................... 26Document History ................................................................................................................................. 28

3

Getting Started Guide AWS Static Website Hosting

Page 4: Awsgsg swh

Overview

Suppose you want to build a website to offer static content such as product catalogs, images, and manualsto your customers. Amazon Web Services (AWS) has reliable, secure, scalable, and high-performanceinfrastructure upon which to store and host your website. It's easy to get started, and you can use theAWS Management Console to set up everything you need to host a static website.

This guide walks through the process of using Amazon Simple Storage Service (Amazon S3) and AmazonCloudFront to host and deploy your website. It also gives you a variation, which uses Amazon Route 53,that you can use to provide secure and reliable routing. We’ll review an example architecture of a staticwebsite hosted on AWS, and we’ll walk through the process of deploying the website by using severalkey AWS services and following best practices.You can adapt this sample to your specific needs if youwant. By the end of this walkthrough, you should be able to do the following:

• Sign up for AWS.

• Create a location to store static files for your website.

• Create a content delivery network.

• Clean up your AWS resources.

If this guide is not exactly what you are looking for, you may want to check out the following documents:

• About AWS - Provides information about AWS, with helpful links for leaning more.

• Getting Started Guide: AWS Free Usage Tier - Provides information about how to get started with thefree usage tier.

• Getting Started Guide: AWS Computing Basics for Linux - Introduces you to several key AWS servicesand components—what these services are, why they are important, and how to use them. It alsoprovides a simple example architecture on a Linux platform and walks you through a deployment thatuses this architecture.

• Getting Started Guide: AWS Computing Basics for Windows - Introduces you to several key AWSservices and components—what these services are, why they are important, and how to use them. Italso provides a simple example architecture on a Windows platform and walks you through a deploymentthat uses this architecture.

• Amazon Elastic Compute Cloud Getting Started Guide - Provides information that helps you get startedusing Amazon EC2 instances.

1

Getting Started Guide AWS Static Website Hosting

Page 5: Awsgsg swh

How Does AWS Help?If you are responsible for creating and deploying a static website, you'll face infrastructure challenges.Where will you store your files? How will you deliver your content? How will you ensure reliability andhigh performance for your website? To solve these challenges, AWS provides Amazon S3 and AmazonCloudFront for easy, seamless, and cost-effective solutions.

Using Amazon S3, you can host your website files on the same fast, reliable, and secure infrastructureAmazon uses to run its global network of websites. Amazon S3 provides a highly durable and availablestore for a variety of content, ranging from your website's HTML files to media files. It allows you to offloadyour entire storage infrastructure onto the cloud, where you can take advantage of Amazon S3’s scalabilityand pay-as-you-go pricing to handle your storage needs.

Amazon CloudFront is a web service for content delivery. It integrates with other Amazon Web Servicesto give you an easy way to distribute content to your website users with low latency, high data transferspeeds, and no commitments. Amazon CloudFront delivers your static and streaming content using aglobal network of edge locations. Requests for your files are automatically routed to the edge locationwith the lowest latency, so content is delivered with the best possible performance.

Amazon Route 53 is a highly available and scalable Domain Name System (DNS) web service. It isdesigned to give developers and businesses an extremely reliable and cost effective way to route endusers to websites by translating human readable names like www.example.com into the numeric IPaddresses like 192.0.2.1 that computers use to connect to each other.

The following table gives a brief overview of the Amazon services used in this Getting Started Guide.

BenefitsAmazon Web ServicesChallenges

Amazon Simple Storage service offersa low cost, highly reliable solution forhosting static website content.

Amazon Simple Storage ServiceNeed a low-cost,reliable onlinestorage webservice to hoststatic websitecontent.

Amazon CloudFront speeds up theloading of streaming or downloadedstatic content by caching the content viaa local edge cache at a location with thelowest latency.

Amazon CloudFrontNeed a contentdelivery network(CDN) to providelow-latency, highdata transferspeeds so endusers don'texperienceunnecessarydelays.

Amazon Route 53 allows users toaccess Internet websites by routinghuman-readable domain names tonumeric IP addresses.

Amazon Route 53Developers andbusinesses need areliable andcost-effective wayto route end usersto Internetwebsites.

2

Getting Started Guide AWS Static Website HostingHow Does AWS Help?

Page 6: Awsgsg swh

Static Website Hosting ArchitectureThe following diagram illustrates an example architecture of a static website using Amazon S3, AmazonCloudFront, and Amazon Route 53.

Amazon S3 provides secure and cost-efficient storage for your static website files. Amazon CloudFrontcaches high volume content, allowing global customers to rapidly access your website. Amazon Route53 connects user requests to infrastructure running in AWS. For a step-by-step walkthrough of how tobuild out this architecture, see Getting Started (p. 4). This walkthrough will teach you how to do thefollowing:

• Sign up for AWS.

• Create an Amazon S3 bucket and store files in the bucket.

• Create a CloudFront distribution.

• Clean up your AWS resources.

For more information on how to use Amazon Route 53 in this architecture, see Amazon Route 53 (p. 19).

3

Getting Started Guide AWS Static Website HostingStatic Website Hosting Architecture

Page 7: Awsgsg swh

Getting Started

Topics

• Step 1: Sign Up for the Service (p. 4)

• Step 2: Create an Amazon S3 Bucket (p. 5)

• Step 3: Create an Amazon CloudFront Distribution (p. 8)

• Step 4: Hosting Your Website (p. 13)

• Step 5: Clean Up (p. 17)

The following tasks will step you through how to deploy your static website using AWS. This walkthroughgives you an example that follows best practices and demonstrates how different AWS products worktogether to provide the solution you need.

Note

Typically, you would create an Amazon S3 website and make it public, and then set up yourAmazon CloudFront distribution. However, since it takes a few minutes to deploy the AmazonCloudFront distribution, you will set up your distribution first before making your website public.

Step 1: Sign Up for the ServiceIf you don't already have an AWS account, you’ll need to get one.Your AWS account gives you accessto all services, but you will be charged only for the resources that you use. For this example walkthrough,the charges will be minimal.

To sign up for AWS

1. Go to http://aws.amazon.com and click Sign Up Now.

2. Follow the on-screen instructions.

AWS notifies you by email when your account is active and available for you to use.

The credentials for your AWS account give you access to all the resources that you have deployed. Ifyou give other people access to your resources, you will probably want to control who has access andwhat they can do. AWS Identity and Access Management (IAM) is a web service that controls access to

4

Getting Started Guide AWS Static Website HostingStep 1: Sign Up for the Service

Page 8: Awsgsg swh

your resources by other people. In IAM, you create a user, which other people can use to obtain accessand permissions that you define. For more information about IAM, go to What Can I Do with IAM?

Step 2: Create an Amazon S3 BucketAmazon Simple Storage Service (Amazon S3) is a perfect solution for storing objects for your staticwebsite, such as photos, HTML pages, and documentation. Using Amazon S3, you can easily store andretrieve as many files as you like. For your static website, you can store files you are working on and onlymake public files you want your customers to see.

In Amazon S3, storage is redundant across multiple data centers. This provides very reliable durabilityfor only a few cents per gigabyte per month.Your files are stored in Amazon S3 as objects, and everyobject is stored in a bucket. Before we can store data in Amazon S3 we must create a bucket.

Note

You are not charged for creating a bucket; you are only charged for storing objects and fortransferring objects in and out of the bucket.The charges you will incur for following this exampleare minimal. For more information, go to Amazon S3 Pricing.

Amazon S3 lets you configure a bucket to be an Amazon S3 website. When you configure your AmazonS3 bucket as a website, you can utilize advanced website features, such as index and custom errordocument support.

In this step you will do the following:

• Create an Amazon S3 bucket for static content

• Configure your Amazon S3 bucket as a website

• Enable logging for your Amazon S3 bucket

To create a bucket to contain static content for your website

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

2. In the Amazon S3 console, click Create Bucket.The Create a Bucket dialog box appears.

3. Enter a bucket name in the Bucket Name field.

The bucket name you choose must be unique across all existing bucket names in Amazon S3. Oneway to do that is to prefix your bucket names with your company's name. For this example, we'll usestaticwebsite-example, however you should choose a unique name.

Your bucket name must comply with Amazon S3 requirements.There might be additional restrictionson bucket names based on the region your bucket is in or how you intend to access the object. Formore information, go to Bucket Restrictions and Limitations.

5

Getting Started Guide AWS Static Website HostingStep 2: Create an Amazon S3 Bucket

Page 9: Awsgsg swh

Note

After you create a bucket, you cannot change its name. In addition, the bucket name isvisible in the URL that points to the objects stored in the bucket. Make sure the bucket nameyou choose is appropriate.

4. In the Region drop-down list box, select a region.

By default, Amazon S3 creates buckets in the US Standard region.You can choose a region to lowerlatency (usually the closest region), minimize costs, or address regulatory requirements. Objectsstored in a region never leave that region unless you explicitly transfer them to another region. Formore information about regions, go to Regions and Endpoints.

5. Click Create.

When Amazon S3 successfully creates your bucket, the console displays your empty bucket in theBuckets panel.

For more information about Amazon S3, go to Amazon Simple Storage Service documentation.

Now that you have created a bucket, let's configure the bucket to be a website.

To configure your Amazon S3 bucket as a website

1. In the Amazon S3 console, right-click the bucket you created and select Properties.

The Properties pane appears.

2. Click the Website tab.

3. Click the Enabled check box.

6

Getting Started Guide AWS Static Website HostingStep 2: Create an Amazon S3 Bucket

Page 10: Awsgsg swh

4. Enter index.html in the Index Document field.

Enter error.html in the Error Document field.

Note

These files do not exist yet.You will create and upload these files to your Amazon S3 bucketin a later step.

5. Click Save to configure the Amazon S3 bucket as a website.

For more information about configuring your Amazon S3 bucket as a website, go to Hosting Websites onAmazon S3.

Now that you've set up your bucket as a website, let's enable logging for your bucket.

You might want to see the activity your Amazon S3 bucket is getting. Amazon S3 provides a way to enablelogging on your buckets. With logging enabled, you can track information such as data in and out of yourbucket and the IP addresses of who is accessing your bucket.

To enable logging for your bucket

1. In the Amazon S3 console, right-click the bucket you created and select Properties.

The Properties pane appears.

2. In the Properties pane:

• Click the Logging tab.

• Click the Enabled check box.

• Select the Amazon S3 bucket you just created from the Target Bucket drop-down list.

Note

You can create and select any Amazon S3 bucket to exclusively contain your log files.For the purpose of this example, you will use the same bucket to contain your log filesand static website data.

• Enter staticwebsite-example/ in the Target Prefix field.

• Click Save to enable logging.

7

Getting Started Guide AWS Static Website HostingStep 2: Create an Amazon S3 Bucket

Page 11: Awsgsg swh

Normally, you would upload your content and set permissions after this step. For this example youwill wait until you deploy your website to do this step.

Where You're AtHere's where you are at in building out your architecture.

If the people who come to your website encounter significant latency, their experience will be less thanpar. Amazon CloudFront is a good solution if you need to consider performance.

In the next step you'll create an Amazon CloudFront distribution.

Step 3: Create an Amazon CloudFrontDistribution

Amazon CloudFront is an AWS content delivery service that helps you improve the performance, reliability,and availability of your websites and applications. If you intend for your website to be hit multiple timesa day or have a global presence, Amazon CloudFront provides the infrastructure to quickly deliver yourwebsite content to customers anywhere in the world.

Amazon CloudFront works by distributing your web content (such as images, video, and so on) using anetwork of edge locations around the world.Your content is served from your configured Amazon S3bucket or custom origin to the edge location that has the lowest latency to the user who requests it.

For more information about Amazon CloudFront, go to the Amazon CloudFront Developer Guide.

The content you deliver with Amazon CloudFront will be stored on a server referred to as an origin server.In this example, our origin is our staticwebsite-example bucket where our static content is stored.Let's create our Amazon CloudFront distribution.

Note

This is an optional step.You can skip this step and continue to Step 4: Hosting Your Website(p. 13).

Before creating an Amazon CloudFront distribution, you'll need to locate and copy down the endpoint foryour Amazon S3 website.

8

Getting Started Guide AWS Static Website HostingWhere You're At

Page 12: Awsgsg swh

To locate the endpoint for your Amazon S3 website

1. In the Amazon S3 console, right-click your bucket and select Properties. The Properties paneappears.

2. Click the Website tab to locate your Amazon S3 website's endpoint.

To create a distribution with an Amazon S3 origin, we will use the AWS Management Console.

To create an Amazon CloudFront distribution

1. Open the Amazon CloudFront console at https://console.aws.amazon.com/cloudfront/.

2. In the Amazon CloudFront console, click Create Distribution.

3. In the Create Distribution Wizard, do the following:

• Click Download for the Delivery Method.

• Click Custom Origin. Enter your origin DNS name for your Amazon S3 website in the Origin DNSName field.

Your origin DNS name will be the same as your Amazon S3 website's endpoint, but without http://and the trailing /.

Note

When creating a distribution for an Amazon S3 bucket configured as a website, you mustspecify a custom origin. When creating a distribution for any other bucket, click AmazonS3 Origin to specify the bucket.

9

Getting Started Guide AWS Static Website HostingStep 3: Create an Amazon CloudFront Distribution

Page 13: Awsgsg swh

4. Click Continue. For the purpose of this walkthrough, you'll leave the other options as their defaults.

5. On the DISTRIBUTION DETAILS page, specify the following details:

a. In Allowed Connections, select HTTP and HTTPS.

b. Leave the CNAMEs field blank.

Note

The Canonical Name Record (CNAME) is a type of resource record used by the DNSto specify that one domain name is the alias of another, canonical domain name. Byspecifying a CNAME, you give permission to allow traffic from the CNAME to accessyour CloudFront distribution.

When configuring your distribution, you have the option of providing CNAMEs for yourdistribution. However, for the purposes of this tutorial you will not do this. For moreinformation, go to Using CNAMEs.

c. If you want to use a default root object with your distribution, enter the default root object toassociate with the distribution in the Default Root Object field. For this example, specifyindex.html as your default root object. We will create and add this file to your Amazon S3bucket later.

d. If you want to enable logging for your distribution, for Logging click On. Next, you can eitherselect or specify the Amazon S3 bucket where you want to save your logs. For this example,we select staticwebsite-example; you should select the bucket that you created. Specifythe log file prefix in the Log Prefix field. For this example, we use staticwebsite-example/;you should specify a prefix from the name of the bucket that you created.

e. In Comments, you can enter any comments you want to include about the distribution. We willleave this blank for this example.

10

Getting Started Guide AWS Static Website HostingStep 3: Create an Amazon CloudFront Distribution

Page 14: Awsgsg swh

f. For the Distribution Status, select Enabled if you want the distribution to accept end-userrequests for content as soon as it is deployed. Otherwise, if you prefer to enable the distributionlater, choose Disabled. For this example, select Enabled.

Note

Even if the distribution's status is Deployed, you still must enable the distribution foruse before end users can retrieve content.

6. To review your distribution settings, click Continue.

7. If you are satisfied with the distribution settings, click Create Distribution in the REVIEW dialog box.

11

Getting Started Guide AWS Static Website HostingStep 3: Create an Amazon CloudFront Distribution

Page 15: Awsgsg swh

After creating the distribution, it might take a few minutes for the distribution to deploy. The distribution'scurrent status is displayed in the console under Status. A status of InProgress indicates that the distributionis not yet fully deployed.

When your distribution is deployed, you are ready to reference your content with your new AmazonCloudFront domain name or CNAME.

Where You're AtHere's where you are at in building out your architecture.

Your Amazon CloudFront distribution takes a few minutes to deploy. While you are waiting for thedistribution to be deployed, let's move on to the next topic where you will host your website files.

12

Getting Started Guide AWS Static Website HostingWhere You're At

Page 16: Awsgsg swh

Step 4: Hosting Your WebsiteNow that you've created an Amazon S3 bucket and created a Amazon CloudFront distribution, you areready to upload your website files.

Before uploading any files, you'll need to create a root HTML file and an error HTML file for your website.Create these files on your computer and name them index.html and error.html.To test your website,you will add simple HTML to the files.

Add the following HTML to index.html:

<html> <body> <p> Hello, World! </p> </body></html>

Add the following HTML to error.html:

<html> <body> <p> This is an error page. </p> </body></html>

Save these files on your computer in a location you can easily locate.

In this step you will do the following:

• Upload your static website files to your Amazon S3 bucket

• Set public permissions for your website content

To upload your website files to your Amazon S3 bucket

1.

2. In the Amazon S3 console, select the bucket you previously created to contain your static websitefiles. In our example, we will select staticwebsite-example bucket.

3. Click Upload. The Upload - Select Files dialog box appears.

13

Getting Started Guide AWS Static Website HostingStep 4: Hosting Your Website

Page 17: Awsgsg swh

4. Click Add Files.

5. In the file dialog box, select the index.html and error.html files you created. Click Start Uploadto upload your file to your Amazon S3 bucket.

When your files have finished uploading, they will appear in the Objects and Folders panel for yourbucket.

14

Getting Started Guide AWS Static Website HostingStep 4: Hosting Your Website

Page 18: Awsgsg swh

Note

When objects are uploaded to Amazon S3 buckets, they lose the file system hierarchy found onyour local computer or on a server.You will have to change all file references in your HTML,such as references to images, to use the URL of the files in Amazon S3.

To locate the URL of any object uploaded to an Amazon S3 bucket, right-click the object andselect Properties. Locate the URL in the Properties pane under the Details tab.

After you have uploaded your index.html and error.html files, you can add any other files you wantto use for your website. None of these files are publicly viewable until you set public permissions in theAWS Management Console.

You can set the public permissions for the files all at once, or set public permissions per file. Whendeploying your static website, you might want to test each file to ensure that it works before making thempublic.

To set public permissions

1. In the Objects and Folders panel for your Amazon S3 bucket, right-click the files you want to makepublic.

Tip

You can use the SHIFT and CRTL keys to select multiple objects and folders to perform thesame action on them simultaneously.

2. Select Make Public.

3. In the message box, click OK.

It can take a few seconds for the permissions to be set by Amazon S3.

Note

If your CloudFront distribution finished deploying before you made your files public, then youmay see a 403-Forbidden error. It can take up to 5 minutes for your files to be viewable.

Your website is now publicly viewable. In your Internet browser, navigate to your website through itsAmazon S3 address or through your Amazon CloudFront distribution URL.

To locate the address of your Amazon S3 website

1. In the Amazon S3 console, right-click your bucket and select Properties. The Properties paneappears.

15

Getting Started Guide AWS Static Website HostingStep 4: Hosting Your Website

Page 19: Awsgsg swh

2. Click the Website tab to locate your Amazon S3 website address.Your website address is underEndpoint.

To locate the address of your Amazon CloudFront distribution

• In the Amazon CloudFront console, select your Amazon CloudFront distribution.Your AmazonCloudFront address is listed in the lower pane under Domain Name.

Note

Changes made to objects in your Amazon S3 bucket are not immediately cached through yourAmazon CloudFront distribution. The default time-to-live (TTL) is 24 hours.You can change thisvalue by setting the Expires metadata property on your Amazon S3 object; the minimum TTL is1 hour.

16

Getting Started Guide AWS Static Website HostingStep 4: Hosting Your Website

Page 20: Awsgsg swh

You can also test to see if your custom error page works by entering a bogus path after your Amazon S3website or Amazon CloudFront distribution URL. If your website is correctly deployed, you'll be redirectedto your custom error page.

Congratulations! You have deployed your website using AWS! Continue to customize your website, andtrack website activity through the logs created in your Amazon S3 bucket.

To avoid accruing additional charges for your billable services, you will clean up your AWS resources inthe next step.

Step 5: Clean UpTopics

• Disable and Delete an Amazon CloudFront Distribution (p. 17)

• Delete Objects and an Amazon S3 Bucket (p. 18)

Now that you've learned how to deploy a static website, it's time to terminate your environment, clean upyour resources, and avoid accruing any further charges.

Disable and Delete an Amazon CloudFrontDistributionAn Amazon CloudFront distribution can be disabled or deleted. A disabled distribution is no longerfunctional and you will no longer be charged, but it can be enabled again at any time. A deleted distributionis no longer accessible and is lost forever.

If you created an Amazon CloudFront distribution in the previous steps, you will need to first disable thedistribution and then delete it.

To disable an Amazon CloudFront distribution

1. Open the Amazon CloudFront console at https://console.aws.amazon.com/cloudfront/.

2. Select a distribution and click Disable.

A confirmation dialog box appears.

3. Click Yes, Disable.

Amazon CloudFront disables the distribution.

To delete an Amazon CloudFront distribution

1. Select a disabled distribution and click Delete.

A confirmation dialog box appears.

2. Click Yes, Delete.

Amazon CloudFront deletes the distribution.

17

Getting Started Guide AWS Static Website HostingStep 5: Clean Up

Page 21: Awsgsg swh

Delete Objects and an Amazon S3 BucketBuckets with objects in them cannot be deleted. Before deleting a bucket, all objects within the bucketmust be deleted.

You should also ensure that logging for your Amazon S3 bucket is disabled. Otherwise, logs might beimmediately written to your bucket after you delete your bucket's objects.

To disable logging

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

2. Right-click your bucket and select Properties. The Properties pane appears.

3. Click the Logging tab.

4. Deselect the Enabled check box to disable logging.

To delete an object

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

2. Click the bucket where the objects are stored.

3. Right-click the object you want to delete.A dialog box shows the actions you can take on the selected object(s).

Tip

You can use the SHIFT and CRTL keys to select multiple objects and perform the sameaction on them simultaneously.

4. Click Delete.

5. Confirm the deletion when the console prompts you to.

To delete a bucket, you must first delete all of the objects in it.

To delete a bucket

1. Right-click the bucket you want to delete.A dialog box shows the actions you can take on the selected bucket.

2. Click Delete.

3. Confirm the deletion when the console prompts you to.

You have now deleted your bucket and all its contents.

18

Getting Started Guide AWS Static Website HostingDelete Objects and an Amazon S3 Bucket

Page 22: Awsgsg swh

Amazon Route 53

AWS provides flexible services, and there are many variations you can use to host your static website.In this section, we'll discuss using Amazon Route 53 with your static website.

Amazon Route 53 is a scalable Domain Name System (DNS) web service. It provides secure and reliablerouting to your infrastructure that uses Amazon Web Services, such as Amazon Simple Storage Service(Amazon S3).You can also use Amazon Route 53 to route users to your infrastructure outside of AWS.

Amazon Route 53 automatically routes queries to the nearest DNS server in a global network of DNSservers, resulting in low latency. It is an authoritative DNS service, meaning it translates friendly domainnames like www.example.com into IP addresses such as 192.0.2.1.

You can manage your DNS records through the Amazon Route 53 API, or set account-level user andaccess management through the AWS Identity and Access Management (IAM) API. Like other AWSproducts, there are no contracts or minimum commitments for using Amazon Route 53.You pay only forthe domains you configure and the number of queries that the service answers. For more informationabout Amazon Route 53 pricing, go to Amazon Route 53 Pricing.

The following procedure explains the high-level steps you need to take to use Route 53 for this example.For more information on how to use Amazon Route 53, go to the Amazon Route 53 Getting Started Guide.For instructions on how to route queries to a website that is hosted in an Amazon S3 bucket (not usingAmazon CloudFront), go to Routing Queries to a Website That Is Hosted in an Amazon S3 Bucket in theAmazon Route 53 Developer Guide.

To use Amazon Route 53

1. Create a hosted zone for example.com.

2. Create a new DNS record for your website (e.g., www.example.com) that points to your AmazonCloudFront distribution (e.g., d18k4jybr69gw2.cloudfront.net). Check with your domain name registrarfor instructions on creating a new DNS record.

3. Confirm your requests are complete.

4. Update the registrar's name server records.

Note

Make sure you update the CNAME for the Amazon CloudFront distribution if you haven’talready set it.

19

Getting Started Guide AWS Static Website Hosting

Page 23: Awsgsg swh

Pricing

Topics

• Amazon S3 Cost Breakdown (p. 20)

• Amazon CloudFront Cost Breakdown (p. 22)

• Summing It All Up (p. 24)

The AWS Simple Monthly Calculator estimates your monthly bill. It provides a per-service cost breakdown,as well as an aggregate monthly estimate.You can also use the calculator to see an estimate andbreakdown of costs for common solutions. This topic walks you through an example of using the AWSSimple Monthly Calculator to estimate your monthly bill.

Note

AWS pricing you see in this documentation is current at the time of publication. For the latestpricing information, go to AWS Service Pricing Overview . For more information on how AWSpricing works, go to How AWS Pricing Works.

Amazon S3 Cost BreakdownThe following table shows the characteristics for Amazon S3 we have identified for this static websitehosting architecture.

DescriptionMetricCharacteristic

20 JPEG files (objects) @ 50 KB= 1 MB

Total of 1.0 MB for 20 objects =0.001 GB

0.001 GB/monthStorage

20

Getting Started Guide AWS Static Website HostingAmazon S3 Cost Breakdown

Page 24: Awsgsg swh

DescriptionMetricCharacteristic

We will plan to update the objectstwice a month. 1 PUT request *20 objects = 20 requests

(PUT requests include from anylocation including Amazon EC2)

We will transfer the objects 10times per month to each of the 10Amazon CloudFront edgelocations. 10 GET requests * 10CloudFront Nodes * 20 objects =2000 requests

(GET requests include from anylocation including Amazon EC2)

PUT requests: 20/month

GET requests: 2000/month

Requests

If the average size object is 50KB, and we make about 2000requests per month, then theaverage data transfer isapproximately 0.1 GB.

Data out: 0.1 GB/monthData Transfer

The following image shows the cost breakdown for Amazon S3 in the AWS Simple Monthly Calculator.

CalculationFormulaVariable

$0.125

x 0.001

-------

$0.00

Storage rate

x Storage Amount (GB)

----------------------

Provisioned Storage

21

Getting Started Guide AWS Static Website HostingAmazon S3 Cost Breakdown

Page 25: Awsgsg swh

CalculationFormulaVariable

$0.01

x 1

-----

$0.01

Request Rate

x Number of requests (per 1000)

-------------------------------

PUT Requests

$0.01

x 1

-----

$0.01

Request Rate

x Number of requests (per10000)

--------------------------------

GET Requests

We use the AWS Simple Monthly calculator to estimate this.With the calculator, the total cost for AmazonS3 is $0.02.

Amazon CloudFront Cost BreakdownThe following table shows the characteristics for Amazon CloudFront we have identified for this webapplication hosting architecture.

DescriptionMetricCharacteristic

Distribution of traffic acrossregions

50% US

25% EU

10% HK

15% JP

0% SA

Traffic Distribution

Type of requests that customersmake to the cached locations

HTTPRequest Type

1.0 MB x 30.5 days x 1,000hits/day

30.0 GB/monthData Transfer Out

The following image shows the cost breakdown for Amazon CloudFront in the AWS Simple MonthlyCalculator.

22

Getting Started Guide AWS Static Website HostingAmazon CloudFront Cost Breakdown

Page 26: Awsgsg swh

The total monthly cost is the sum of the data transfer out plus the requests costs for each of the regions.

CalculationFormulaVariable

30.00

0.50

x 0.12

------

$1.80

Monthly Volume (GB)

Traffic Distribution (%)

x Data Out Rate

--------------------------

Data Transfer Out for US

30.00

0.25

x 0.12

------

$0.90

Monthly Volume (GB)

Traffic Distribution (%)

x Data Out Rate

--------------------------

Data Transfer Out for EU

30.00

0.10

x 0.19

------

$0.57

Monthly Volume (GB)

Traffic Distribution (%)

x Data Out Rate

--------------------------

Data Transfer Out forHK/Singapore

23

Getting Started Guide AWS Static Website HostingAmazon CloudFront Cost Breakdown

Page 27: Awsgsg swh

CalculationFormulaVariable

30.00

0.15

x 0.201

-------

$0.90

Monthly Volume (GB)

Traffic Distribution (%)

x Data Out Rate

--------------------------

Data Transfer Out for JP

$0.0075

0.50

x (30 GB/50 KB/10K)

--------------------

$0.24

Request Rate

Traffic Distribution (%)

x (Monthly Volume/Object Size(per 10,000 requests))

----------------------------------------------------

Requests for US

$0.009

0.25

x (30.00 GB/50 KB/10K)

--------------------

$0.15

Request Rate

Traffic Distribution (%)

x (Monthly Volume/Object Size(per 10,000 requests))

----------------------------------------------------

Requests for EU

$0.0075

0.10

x (30.00 GB/50 KB/10K)

--------------------

$0.05

Request Rate

Traffic Distribution (%)

x (Monthly Volume/Object Size(per 10,000 requests))

----------------------------------------------------

Requests for HK/Singapore

$0.0095

0.15

x (30.00 GB/50 KB/10K)

--------------------

$0.09

Request Rate

Traffic Distribution (%)

x (Monthly Volume/Object Size(per 10,000 requests))

----------------------------------------------------

Requests for JP

We use the AWS Simple Monthly calculator to estimate this.With the calculator, the total cost for AmazonCloudFront is $4.70.

Summing It All UpTo calculate the total cost for this scenario, we add the cost for Amazon S3, Amazon CloudFront and theAWS Data Transfer Out, and subtract any discount that falls into the AWS Free Usage Tier.

24

Getting Started Guide AWS Static Website HostingSumming It All Up

Page 28: Awsgsg swh

The total AWS Transfer Out is an aggregate Data Transfer Out usage across Amazon S3 and any otherAmazon services you might use. For Amazon S3, we have 0.1 GB per month. Since up to 1 GB per monthof data transferred out is free, there is no charge.

The following image shows an example of your monthly estimate.

The total cost of this static website is estimated at $4.72.

25

Getting Started Guide AWS Static Website HostingSumming It All Up

Page 29: Awsgsg swh

Related Resources

The following table lists related resources that you'll find useful as you work with AWS services.

DescriptionResource

A comprehensive list of products and services AWS offers.AWS Products and Services

Official documentation for each AWS product including serviceintroductions, service features, and API references, and otheruseful information.

Documentation

Provides the necessary guidance and best practices to buildhighly scalable and reliable applications in the AWS cloud.These resources help you understand the AWS platform, itsservices and features. They also provide architecturalguidance for design and implementation of systems that runon the AWS infrastructure.

AWS Architecture Center

Provides access to information, tools, and resources tocompare the costs of Amazon Web Services with ITinfrastructure alternatives.

AWS Economics Center

From here, you will find links to developer centers that providedocumentation, code samples, release notes, and otherinformation to help you build innovative applications with AWS.

AWS Developer Resource Centers

Features a comprehensive list of technical AWS whitepaperscovering topics such as architecture, security, and economics.These whitepapers have been authored either by the Amazonteam or by AWS customers or solution providers.

AWS Cloud Computing Whitepapers

Previously recorded webinars and videos about products,architecture, security, and more.

Videos and Webinars

A community-based forum for developers to discuss technicalquestions related to Amazon Web Services.

Discussion Forums

The home page for AWS Technical Support, including accessto our Developer Forums, Technical FAQs, Service Statuspage, and AWS Premium Support. (subscription required).

AWS Support Center

26

Getting Started Guide AWS Static Website Hosting

Page 30: Awsgsg swh

DescriptionResource

The primary web page for information about AWS PremiumSupport, a one-on-one, fast-response support channel to helpyou build and run applications on AWS Infrastructure Services.

AWS Premium Support Information

This form is only for account questions. For technicalquestions, use the Discussion Forums.

Form for questions related to your AWSaccount: Contact Us

Detailed information about the copyright and trademark usageat Amazon.com and other topics.

Conditions of Use

27

Getting Started Guide AWS Static Website Hosting

Page 31: Awsgsg swh

Document History

This document history is associated with the 2011-10-07 release of: Getting Started Guide: AWS StaticWebsite Hosting. This guide was last updated on March 19, 2012.

Release DateDescriptionChange

07 October2011

Created new document.New content

28

Getting Started Guide AWS Static Website Hosting