Follow the step-by-step instructions below to host the Example Corp. website. Click on each step number to expand the section.
Step 1. Select a Region
You can deploy this web portal in any AWS Region that supports all the services used, which include Amazon AppStream 2.0, Amazon S3, Amazon SES, AWS IAM, AWS Lambda, and Amazon API Gateway. The supported Regions that you can choose from are:
Type your email address or your AWS account ID, and choose Next.
Type your AWS account password, and choose Sign In.
In the menu in the upper right corner of the console, select the AWS Region that you want.
Step 2. Create a new Amazon S3 bucket
In the Bucket name list, choose the name of the bucket that you created in the previous step.
In a window other than the console window, navigate to the Web/Web directory on your local computer. Select all of the files and folders under that directory. Verify that the Web directory itself is not selected.
In the Amazon S3 console window, on the Overview tab, choose Upload.
Drag and drop your selections into the Upload dialog box.
Wait for the upload to complete, and verify that the correct files and folders appear in the list on the Overview tab.
Step 4. Enable static website hosting for your Amazon S3 bucket
On a static website, individual webpages include static content. They might also contain client-side scripts. By contrast, a dynamic website relies on server-side processing, including server-side scripts such as PHP, JSP, or ASP.NET. Amazon S3 does not support server-side scripting. Complete the following steps to enable static website hosting for your bucket.
With your Amazon S3 bucket selected in the Amazon S3 console, choose the Properties tab.
Choose Static website hosting, and then choose Use this bucket to host a website.
For Index Document, type index.html. When you configure a bucket for website hosting, you must specify an index document.
Make a note of the Endpoint URL at the top of the Static website hosting dialog box. After you enable your bucket for static website hosting, web browsers can access all of your content through the Amazon S3 website endpoint for your bucket.
Step 5. Enable public read access for your Amazon S3 bucket
When you configure a bucket as a website, you must make the objects that you want to serve publicly readable. To do this, complete the following steps to create a bucket policy that grants everyone s3:GetObject permission.
With your Amazon S3 bucket selected in the Amazon S3 console, choose the Permissions tab.
Choose Edit to change the public access settings for the bucket.
Clear all of the check boxes on the tab, and then choose Save.
When you’re prompted for confirmation, type confirm. This field is case-sensitive.
Choose Confirm to save your changes.
On the Permissions tab, choose Bucket Policy.
In the bucket policy editor text box, copy and paste the following policy: