AWS static website with SSL and

custom domain name




AWS flowchart for CloudFront, S3, and Route 53


Creating an AWS static website. Complete with SSL and custom domain name. We will take you step by step, from creating an account with permissions, to using Route 53, S3 buckets, Certificate Manager, and CloudFront.






In this tutorial we will be establishing a website with AWS:


AWS Services is a large scale solution for enterprises. AWS has a large amount of documentation. ( I printed over 200 pages for this project!) It took me a week to set up new accounts, and create a solution. Only a small portion of what AWS provides was used. In the end I had an SSL enabled static website, with a custom domain name. Most of the resources used are free. It costs $13 per year for a .com domain name, and $1 to $3 per month for the hosting. The following is an outline of what we will be doing. You must read all online details on the AWS console as you progress through the outline.

We will use the following AWS resources:



1.0 Create Root and Management Accounts

1.1 Create and activate a new AWS account.

  1. Search Google for Sign up for a free AWS account and click on Create a Free Account. Follow the online instructions. (When asked, Activate IAM Access.)
  2. It is suggested to create an account name of the following form steve-larson-admin. Where admin is the purpose of the account.
  3. Verify your email address. Wait a couple minutes for the verification email.
  4. Create your password and confirm the password.
  5. Add contact information. Accept the AWS Customer Agreement and choose Continue.
  6. You will receive a confirmation email. You can sign in with your new account.
  7. Add a payment method. On the Billing information page enter your payment method, can choose Verify and Add.
  8. Verify your phone number. Enter the PIN you receive. Choose Continue.
  9. Choose an AWS Support plan. Choose Complete sign up.
  10. Wait up to 24 hours for account activation. You will receive a confirmation email.
  11. When you sign up for the AWS account, a root user is created. The root user has access to all AWS services and resources in the account. Eventually you will need to provide MFA (multi-factor authentication) for the root account. I use two forms of MFA. The first is Google Authenticator on my phone, and the second is a YubiKey 5 NFC device.
  12. This is the way your console home page will look after all services are added at the end of your project. The red arrow points to the Services icon. It is here that you can select services.


Screenshot of AWS console home page.

1.2 Getting started with IAM Identity Center

  1. Select IAM Identity Center from the Services icon at the top left of your page. Choose US-East(N. Virginia) Region, to be consistent with where you will create SSL certificates. Click on Enable.
  2. You will be prompted to join an Organization. Click on Create AWS organization. You will receive an email to verify your email address for AWS Organizations. Wait a few minutes for AWS Organizations and AWS IAM Identity Center to be enabled. You will see the IAM Identity Center Dashboard.
  3. Click on Choose your identity source. The identity source will be set to Identity Center Directory.

1.3 Create an administrative user in AWS IAM Identity Center

  1. Here we are going to add you, the root user, as an a regular user. You will have two user accounts: root user, and regular user.
  2. Open the IAM Identity Center console. Choose Users.
  3. Choose Add user. Provide a Username. I suggest a name with all small characters and no spaces. Something easy to remember.
  4. For the Password choose the default method. Send an email with the password setup instructions. This option automatically sends an email to the new account.
  5. Enter the email address for the new account and verify. Enter you first and last name.
  6. Choose Next.

1.4 Enable or Disable MFA for a User

  1. Go to the IAM Identity Center console.
  2. In the left navigation pane choose Users. Select the user you are interested in.
  3. In the left navigation pane, choose Settings.
  4. On the Settings page, choose the Authentication tab.
  5. In the Multi-factor authentication section, choose Configure.
  6. On the Configure multi-factor authentication page, choose one of the following authentication modes based on the level of security that your business needs:
    a. Only when their sign-in context changes (context-aware)
    b. Every time they sign in (always-on)
    c. Never (disabled) While in this mode, all users will sign in with their standard user name and password only. Choosing this option disables IAM Identity Center MFA.
  7. Choose Save changes.

1.5 Create an administrative permission set

  1. In the IAM Identity Center navigation pane, under Multi account permissions, choose Permission sets.
  2. Choose Create permissions set.
    a. Select permission set type. On the Select permission set type page, keep the default settings and choose Next. The default setting grants full AdministratorAccess.
    b. Specify permission set details. Keep the defaults and click Next.
    c. Review the permission set and confirm that it says AdministrativeAccess. Choose create.

1.6 Granting the administrative permission set to the new user account

  1. In the IAM Identity Center under Multi-account permissions, choose AWS accounts.
  2. Select the new user account you will give administrative permission to.
  3. Choose Assign users or groups.
    a.Select users and groups. On the Assign users and groups to “AWS-account-name” page, do the following. On the Users tab select the user you want to grant administrative permissions to. Choose Next.
    b. Select permission sets, on the “AWS-account-name” page. UnderPermission sets, select the AdministratorAccess permission set. Choose Next.
    c. Review and Submit, on the “AWS-account-name” page.
  4. Wait for the user assignment process to complete. It may take a couple minutes.

1.7 Exit the root account, and login with the administrator account you just created as IAM user.

Use the administrator account from now on. Login using the URL given in your email.


1.8 Create and join an Organization with your new account. Enable all features.

  1. Open the AWS Organization console. An organization should have been created when you setup IAM Identity Center. AWS creates the organization and shows you the AWS accounts.
  2. On the Settings page choose Begin process.
  3. On the Enable all features choose Begin process.
  4. An email will be sent to your invited account. Approve the request in the email you receive.
  5. Finalize the process to enable all features. Accept. If the invited account accepts the request. On Settings, choose Go to finalize in the green box.
  6. On the Enable all features page, choose Finalize. In the confirmation dialog box, choose Finalize again.
  7. The organization now has all features enabled.

2.0 Your account is setup. Start the website setup.

2.1 Use AWS to register a domain name

It simplifies website creation if you acquire your domain name through AWS. It costs $13 per year for .com domain name.

  1. Navigate to Route 53. Click on Get started.
  2. Select Register a domain. Click on Get started.
  3. Choose a domain name. Check the name. Add it to the shopping cart. Continue.
  4. Enter contact details for your domain name. Check details. Continue.
  5. A verification email may be sent. Confirm.
  6. Registration may take up to 3 days. You will receive an email confirming registration.

2.2 S3 Bucket

In this section, we are going to create an S3 bucket, open the bucket for public acess, set it up for static website hosting and upload a simple static website to it. We will test viewing our website from outside of AWS.

2.2.1 First, we are going to create an S3 bucket:

2.2.2 Then we need to open the bucket to public:

2.2.3 Finally, we have to edit the Bucket Policies.



Screenshot of console and Edit Bucket Policy.

Screenshot of online AWS Policy Generator Screenshot of online Bucket Policy

That is all for our S3 Bucket setup. Open your bucket. Under Permissions you should see a red bubble with white text Publicly accessible under the name of your bucket. If you do, everything is correct and we can proceed.

Screenshot of online Bucket Permissions Overview.

2.2.4 Next, we’re going to upload dummy website files into the bucket & test access to it:

2.3 AWS Certificate Manager (ACM)

Screenshot of console Certificate Manager. Screenshot of console Request for Public Certificate.

2.4 CloudFormation IAM Roles

2.4.1 Setup permissions for Stack Sets Operations

In order to add an AWS account, the administrator account needs to have permission to create, update, and delete any stack sets in all target accounts. (Only needs to performed one time, upon account creation). IAM roles need to be created in both the administrator and the target accounts. Amazon has simplified this process by utilizing an AWS Cloud Formation template. Complete steps 1 and 2 before proceeding with AWS Cloud Formation.

Step 1 - Create IAM role for administrator account

  1. From AWS Services menu, search and click on CloudFormation.
  2. Click on Stacks in left navigation menu.
  3. Click on Create stack, and select With new resources(standard).
  4. In Specify template section, select Amazon S3 URL. Under it copy and paste the following hyperlink URL: https://s3.amazonaws.com/cloudformation-stackset-sample-templates-us-east-1/AWSCloudFormationStackSetAdministrationRole.yml, and click Next.

  5. Screenshot of console Create Stack.
  6. In the Stack name field, give any Stack name, then click Next.
  7. In Step-3: Configure Stack options, scroll down, and click Next.
  8. In Step-4: Review, scroll down, check to acknowledge AWS CloudFormation to create IAM resources, then click Create stack to complete the process.

Note that the IAM role name for the administrator account must be AWSCloudFormationStackSetAdministrationRole.

Step 2 - Create IAM role for each target account

  1. From AWS Services menu, search and click on CloudFormation.
  2. Click on Stacks in left navigation menu.
  3. Click on Create stack, and select With new resources(standard).
  4. In Specify template section, select Amazon S3 URL. Under it copy and paste the following hyperlink URL: https://s3.amazonaws.com/cloudformation-stackset-sample-templates-us-east-1/AWSCloudFormationStackSetExecutionRole.yml, and click Next.
  5. In Stack name field, give any Stack name.
  6. In Parameters field, enter the administrator account ID. The ID is given when clicking on Administrator in the upper right corner. Then click Next.
  7. In Step-3: Configure Stack options, scroll down, and click Next.
  8. In Step-4: Review, scroll down, and check to acknowledge AWS CloudFormation to create IAM resources, then click Create stack to complete the process.

Reference: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-prereqs.html

2.5 CloudFront Distribution

In this section, we are going to create a CloudFront distribution with an S3 bucket so that when anyone tries to access our distribution, they will be accessing the S3 bucket.

2.5.1 Create CloudFront distribution

2.5.2 CloudFront SSL certificate:

We are almost done, we have S3, CloudFront SSL certificate, but there's one more step we need to take. If you go ahead and try to load your domain name in your web browser, you'll notice that the page can't be loaded. We have to create a record in Route 53. Basically we tell it to direct traffic from your domain to your CloudFront distribution.

2.6 Route 53 Create Records

Route 53 Define Simple Record 1.
Route 53 Define Simple Record 2.

And that's it. All you have to do now is wait a few minutes for the DNS records to update and try to load your domain name. If everything went correctly, you should see your static website distributed via CloudFront. If you get error messages, you made an error. Google the error and make corrections.


3.0 References







Introduction to Engineering Python: For First Year Engineering Students