← Back to Labs
Fundamental00:30:00

Introduction to Amazon CloudFormation

Task 1

Task 1: Sign in to AWS Management Console

↑ Top
  1. Click on the open console button, and you will get redirected to AWS Console in a new browser tab.
  2. On the AWS sign-in page,
  3. Leave the Account ID as default. Never edit/remove the 12 digit Account ID present in the AWS Console. otherwise, you cannot proceed with the lab.
  4. Now copy your User Name and Password in the Lab Console to the IAM Username and Password in AWS Console and click on the Sign in button.
  5. Once Signed In to the AWS Management Console, Make the default AWS Region as US East (N. Virginia) us-east-1.
Task 2

Task 2 : Exploring templates in an S3 Bucket

↑ Top
  1. Make sure you are in the US East (N. Virginia) us-east-1 Region.
  2. Navigate to the services menu in the top, click on S3 in the Storage section.
  3. You can see the bucket present with a name similar to lab.1400.54051021. In your case, the name of the bucket might be different numerics.
  4. Open that bucket and you will see LAMP_template.json file.
  5. Now copy the Object URL and save it in notepad.
  6. Task 2 : Exploring templates in an S3 Bucket
  7. This given LAMP_template.json contains the JSON code for launching the LAMP Server using Cloudformation.
Task 3

Task 3 : Create Cloudformation Stack

↑ Top
  1. Navigate to CloudFormation. Click services, click on CloudFormation in the Management and Governance section.
  2. On the CloudFormation dashboard, click on create stack. Prerequisite - Prepare template : Select Choose an existing template Specify Template : Template source: Select Amazon S3 URL Amazon S3 URL: Paste the URL copied from earlier steps.
  3. On the CloudFormation dashboard, click on create stack.
  4. Prerequisite - Prepare template : Select Choose an existing template
  5. Specify Template : Template source: Select Amazon S3 URL Amazon S3 URL: Paste the URL copied from earlier steps.
  6. Specify Template :
  7. Template source: Select Amazon S3 URL
  8. Amazon S3 URL: Paste the URL copied from earlier steps.
  9. Task 3 : Create Cloudformation Stack
  10. Click on Next.
  11. Specify stack Details Stack name: Enter a unique stack name - MyFirstCFStack Parameters DB Name : Enter a database name - MyDatabase DB Password : Enter a database password - labdb123 DB Root Password : Enter database root password - labdbroot123 DB User : Enter the database username - labDBUser Instance Type : Select t2.micro Key Name : Select the key from the list name lab-key SSH Location : Enter 0.0.0.0/0 Click on Next.
  12. Specify stack Details
  13. Stack name: Enter a unique stack name - MyFirstCFStack
  14. Parameters DB Name : Enter a database name - MyDatabase DB Password : Enter a database password - labdb123 DB Root Password : Enter database root password - labdbroot123 DB User : Enter the database username - labDBUser Instance Type : Select t2.micro Key Name : Select the key from the list name lab-key SSH Location : Enter 0.0.0.0/0 Click on Next.
  15. Parameters
  16. DB Name : Enter a database name - MyDatabase
  17. DB Password : Enter a database password - labdb123
  18. DB Root Password : Enter database root password - labdbroot123
  19. DB User : Enter the database username - labDBUser
  20. Instance Type : Select t2.micro
  21. Key Name : Select the key from the list name lab-key
  22. SSH Location : Enter 0.0.0.0/0
  23. Click on Next.
  24. Task 3 : Create Cloudformation Stack
  25. Configure stack options : Tags: Click on add new tag Key : Enter Name Value : Enter MyCF Permissions: No need to select for this lab, leave it blank. Leave all other configuration fields as default. Click on Next.
  26. Configure stack options :
  27. Tags: Click on add new tag Key : Enter Name Value : Enter MyCF
  28. Tags: Click on add new tag
  29. Key : Enter Name
  30. Value : Enter MyCF
  31. Task 3 : Create Cloudformation Stack
  32. Permissions: No need to select for this lab, leave it blank.
  33. Leave all other configuration fields as default.
  34. Click on Next.
  35. Review: Review your stack details and click on Submit.
  36. Once you have clicked the create button, you will be redirected to the CloudFormation stack list. A sample screenshot is provided below.
  37. Task 3 : Create Cloudformation Stack
  38. Status: You will see the status CREATE_IN_PROGRESS.
  39. You need to wait around 1-5 minutes to complete the stack resource creation.
  40. Click on the refresh button to see the updates.
  41. Once your stack status changes to Create Complete.
  42. Task 3 : Create Cloudformation Stack
Task 4

Task 4 : Testing

↑ Top
  1. Navigate to the outputs tab and you will be able to see an URL similar to below. Click on the URL. This will take you to your server's home page. http://ec2-3-89-73-251.compute-1.amazonaws.com
  2. Navigate to the outputs tab and you will be able to see an URL similar to below. Click on the URL. This will take you to your server's home page.
  3. Task 4 : Testing
  4. http://ec2-3-89-73-251.compute-1.amazonaws.com
  5. If you see the PHP info and your database connection, it means you have completed a LAMP server setup with AWS CloudFormation. Sample screenshot provided below:
  6. Task 4 : Testing
  7. By using CloudFormation, you can manage your infrastructure more efficiently, reduce manual effort, ensure consistency, and achieve faster and more reliable deployments. It provides a scalable and flexible approach to infrastructure provisioning and management, making it a valuable tool for both small and large-scale AWS deployments.
Task 5

Task 5 : Validation Test

↑ Top
  1. Once the lab steps are completed, please click on the Validation button on the right side panel.
  2. This will validate the resources in the AWS account and displays whether you have completed this lab successfully or not.
  3. Sample output :
  4. Task 5 : Validation Test
  5. You have successfully created a Lamp server setup using a new Cloudformation Stack with the help of the JSON template provided in the S3 bucket.
  6. You have successfully tested the new lamp server created by CloudFormation.
  7. Sign out from the AWS Management Console.
  8. Click on End Lab button from the lab console and wait till the process gets completed.
← Back to Labs