Skip to content

Latest commit

 

History

History
35 lines (26 loc) · 2.54 KB

Exercise2.md

File metadata and controls

35 lines (26 loc) · 2.54 KB

Exercise 2

Cloud Formation templating

In this exercise we will build a cloud formation template to provision the security group and EC2 instance pair that we manually created in Exercise 1

Goals

  • Gain exposure to AWS powershell API
  • Get hands dirty building a CloudFormation template
  • Launch a security group and EC2 instance via powershell - Infrastructure as code!

Prior to starting

To complete this exercise you'll need to add an appropriate set of credentials to your SDK Credential Store - run ResetCredentials.bat from the repository root with appropriate parameters to do this

Instructions

  1. Navigate to .\Exercise2 and open Deploy.ps1 in Powershell ISE
  2. Spend a some time getting familiar with what it is doing
  • How does the template get from our local machine to AWS?
  • How do we supply parameters that our CloudFormation template requires?
  1. Open .\Exercise2\Parameters.ps1. Update the ResourcePrefix parameter to your initials, and take note of the other parameters provided
  2. Create an empty file named Webserver.template in .\Exercise2\Templates
  3. Build your template's Skeleton Structure
  4. Define your Security Group Template
  1. Define your EC2 Instance Template
  2. Kick off .\Deploy.ps1 by F5-ing it in ISE, and open the CloudFormation section of the AWS console
  3. Monitor your stack's creation by opening the 'Events' tab for a running summary of progress
  4. If something fails, analyse the error. What went wrong? Double check your template, and the template documentation. Feel free to grab someone to rubber duck!
  5. If it is all green, jump into the EC2 console and try to remote into your instance
  6. Great success!

Note: If you installed the Visual Studio Tooling you can use an "AWS CloudFormation project" to work with your template, which will give you some intellisense out of the box.