Loading....
Lab
Cloud Vendor Amazon AWS
Proficiency Level Cloud Enthusiast
Tags AutomationCI/CDCloudFormationS3

Summary

In this lab, you will create an AWS S3 Bucket using AWS CloudFormation template. You will use the AWS Management Console to upload the template and create the bucket.

Each exercise below builds upon the previous one. You should start each new exercise from the last step of the previous exercise unless it is explicitly written otherwise.

 

Learning Objectives

After completion of this lab, you will be able to:

Prerequisites

To complete this lab, you will need the following:

  • Reliable internet connection
  • AWS account used to access Amazon AWS Management Console

Exercise #1: Create an AWS CloudFormation Template

In this exercise, you will create an AWS CloudFormation Template in YAML format.

Steps

  1. Open a code editor and paste the following code in it
    Resources:
      S3Bucket:
        Type: AWS::S3::Bucket
        Properties:
          AccessControl: PublicRead
          BucketName: [first_name_and_initials]-static-website
          MetricsConfigurations: 
            - Id: EntireBucket
          WebsiteConfiguration:
            IndexDocument: index.html
            ErrorDocument: error.html
            RoutingRules:
            - RoutingRuleCondition:
                HttpErrorCodeReturnedEquals: '404'
                KeyPrefixEquals: out1/
              RedirectRule:
                HostName: ec2-11-22-333-44.compute-1.amazonaws.com
                ReplaceKeyPrefixWith: report-404/
        DeletionPolicy: Retain
    Outputs:
      WebsiteURL:
        Value: !GetAtt [S3Bucket, WebsiteURL]
        Description: URL for website hosted on S3
      S3BucketSecureURL:
        Value: !Join ['', ['https://', !GetAtt [S3Bucket, DomainName]]]
        Description: Name of S3 bucket to hold website content
  2. Make the following modifications to the code
    Line 6 → Replace  [first_name_and_initials] with your first name and initials
  3.  Milestone step:  At this point, you have learned how to create a new AWS CloudFormation template
  4. Save the file in your home folder with the following name
    cf-template.yaml

Exercise #2: Create a Stack Using the AWS CloudFormation Template

In this exercise, you will create an AWS CloudFormation Template in YAML format.

Steps

  1. Sign in to the AWS Management Console at https://aws.amazon.com/console/ using your AWS Account
  2. In the Find Services search box, type CloudFormation, and press Enter
  3. On the new page, click on the button
  4. On the next screen, in the section Prerequisites – Prepare template, select the radio button
  5. In the section Specify template, select the radio button and click on the button
  6. Select the cf-template.yaml template file from the home folder on your local machine, and click on the button
  7. On the next screen, in the section Stack name, type the following for the stack name
    automationlab01-stack
  8. Click on the button
  9. On the next screen, in the Tags section, add the following tags
    Nameautomationlab01-stack
    Roleweb
    Labautomationlab01
    Owner<your name>
    OwnerEmail<your email>
  10. Click on the button
  11. On the next screen, review the information and click on the  button
  12. Wait until the deployment is complete
  13.  Milestone step:  At this point, you have learned how to create a new stack using AWS CloudFormation template and AWS Management console
  14. Click on the button in the upper left corner of the AWS Management Console
  15. In the Find Services search box, type S3, and press Enter
  16. Verify that your static web site bucket is in the list of buckets
  17.  Milestone step:  At this point, you have learned how to verify the AWS CloudFormation template is successful using the AWS Management console

Last Update: November 5, 2019  

November 5, 2019   297   Toddy Mladenov    Cloud Management    
Total 0 Votes:
0

Tell us how can we improve this post?

+ = Verify Human or Spambot ?

Back To Top