01.01.setup
- 1.1 Setup Learning Environment
- Learning Objectives
- EXERCISE: (Windows Only) Download and Install Putty
- EXERCISE: Login to your AWS account
- EXERCISE: Create a New Key Pair
- EXERCISE: Launch an AWS Utility instance using CloudFormation
- EXERCISE: Create an S3 bucket to host credentials
- EXERCISE: Create an S3 bucket to host artifacts
- EXERCISE: Apply a bucket policy using CloudFormation
- EXERCISE: Setup your GitHub Account
- EXERCISE: Upload SSH keys
- CLASS EXERCISE: Tools, Commands
- CLASS EXERCISE: About the sample applications
1.1 Setup Learning Environment
Learning Objectives
By the end of this lesson you will be able to:
- Setup your environments.
- Launch a CloudFormation stack.
- Create a Key Pair.
- Create an S3 bucket.
- Access GitHub repos.
- Establish SSH keys.
- Launch and SSH into an EC2 instance.
- Review course resources.
EXERCISE: (Windows Only) Download and Install Putty
- Follow the instructions for using Putty in Windows http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/putty.html. You will download putty, pscp and puttygen from http://www.chiark.greenend.org.uk/\~sgtatham/putty/download.html
EXERCISE: Login to your AWS account
- Verify that you’re able to login to your assigned student account by going to http://aws.amazon.com/console?region=us-east-1 and enter your username and password. Your username is student01, student02 or other similar pattern. Your password will be given to you by the instructor.
EXERCISE: Create a New Key Pair
- Go to the list of key pairs by logging into http://aws.amazon.com/console?region=us-east-1 and going to the EC2 tab in the Management console. Then, select the Key Pairs link on the left panel.
- Select the Create Key Pair button and enter cd29 in the Key Pair Name field and the Create button (where 29 is your student id). Save the file onto your computer for future use. Click the Close button.
EXERCISE: Launch an AWS Utility instance using CloudFormation
- Login to CloudFormation. Click the Create New Stack button. Enter AWSCLI29 (where 29 is your student id) in the Stack Name field and https://s3.amazonaws.com/filescdcourse/templates/base.template* in the Provide a Template URL field. This template is provided courtesy of AWS Training.*
- Click Continue.
- In the KeyName field, enter the key pair (i.e. cd29) that you created in the previous section. Select the checkbox next to I acknowledge that this template may create IAM resources and click Continue.
- Click Continue again, then Close.
- Once the status in CloudFormation is CREATE_COMPLETE, select the checkbox next to AWSCLI29. (where 29 is your student id)
- Select the Outputs tab in the bottom panel and copy the DNS name for the instance into your clipboard
- (*.nix-only environments) Find the cd29.pem file on your computer (where 29 is your student id). If you are are a *nix-based computer, you will need to modify the permissions to 400.
1
|
|
- From the directory where your cd29.pem (where 29 is your student id) is located, enter the command below to SSH into the utility instance. In the example below, modify PUBLIC_DNS to your the public DNS provided as a value when selecting Outputs tab for the AWSCLI CloudFormation template you created.
1
|
|
- Enter yes to the security prompt.
EXERCISE: Create an S3 bucket to host credentials
- Create a new S3 bucket and call it cd29creds (where 29 is your student id). Use https://console.aws.amazon.com/s3/home and click the Create Bucket button. IMPORTANT: Be sure to choose US Standard in the Region dropdown box.
EXERCISE: Create an S3 bucket to host artifacts
- Create a new S3 bucket and call it cd29artifacts (where 29 is your student id). Use https://console.aws.amazon.com/s3/home and click the Create Bucket button. IMPORTANT: Be sure to choose US Standard in the Region dropdown box.
EXERCISE: Apply a bucket policy using CloudFormation
- Login to CloudFormation. Click the Create New Stack button. Enter policy29 (where 29 is your student id) in the Stack Name field and *https://stelligentlabs.s3.amazonaws.com/templates/account_bucket_policies.template* in the Provide a Template URL field.
- Click Continue.
- Enter the name of the bucket you just created (e.g. “cd29artifacts” – where 29 is your student id) and click Continue.
- Click Continue again, then Close.
- Once the status in CloudFormation is CREATE_COMPLETE, the policy has been applied to your S3 bucket.
EXERCISE: Setup your GitHub Account
- Login to your account by going to https://github.com/login
- Go to https://github.com/stelligent/continuous_integration_example
- Click the Fork button. A message will display “Where do you want to fork this to?”. Click on the button that says Fork to YOURUSERID.
- Go to https://github.com/stelligent/devopsinthecloud
- Click the Fork button. A message will display “Where do you want to fork this to?”. Click on the button that says Fork to YOURUSERID.
- Go to https://github.com/stelligent/sample_app
- Click the Fork button. A message will display “Where do you want to fork this to?”. Click on the button that says Fork to YOURUSERID.
- Go to https://github.com/stelligent/devcenter-embedded-tomcat
- Click the Fork button. A message will display “Where do you want to fork this to?”. Click on the button that says Fork to YOURUSERID.
- Go to https://github.com/stelligent/ciexample_jenkins
- Click the Fork button. A message will display “Where do you want to fork this to?”. Click on the button that says Fork to YOURUSERID.
- Create an SSH keypair by SSH’ing to the AWSCLI instance you created when launching the CloudFormation stack in the section above. In the example below, you will use the email address that’s registered with your GitHub account. You can find yours by going to https://github.com/settings/profile/. Accept the defaults after running this command below. NOTE: Use your student id instead of 29. For example, student03@stelligent.com
1 2 |
|
- Display the contents of the public key and copy the contents to your clipboard.
1 2 |
|
- After logging into your GitHub account, go to your GitHub SSH Keys settings at https://github.com/settings/ssh/. Click on the Add SSH Key button, give it a name and paste the contents of the public key into the Key text field. Then, click the Add key button. Enter your GitHub password when prompted.
- Go back to the AWS CLI instance, go to the root directory and type the following from the command line. Replace student29 with your GitHub userid.
1 2 |
|
- Go back to the AWS CLI instance, go to the root directory and type the following from the command line. Replace student29 with your GitHub userid.
1 2 |
|
- Go back to the AWS CLI instance, go to the root directory and type the following from the command line. Replace student29 with your GitHub userid.
1 2 |
|
- Go back to the AWS CLI instance, go to the root directory and type the following from the command line. Replace student29 with your GitHub userid.
1 2 |
|
- Go back to the AWS CLI instance, go to the root directory and type the following from the command line. Replace student29 with your GitHub userid.
1 2 |
|
- From the home directory on the AWSCLI, type ls from the command prompt. You should see continuous_integration_example, devopsinthecloud, sample_app, devcenter-embedded-tomcat and ciexample_jenkins as subdirectories.
EXERCISE: Upload SSH keys
- Mac: Secure copy the SSH key files to your computer. Your Public DNS will be different. This example assumes you’re installing to your Desktop folder on your Mac.
1 2 3 4 |
|
- Windows: Secure copy the SSH key files to your computer. Your Public DNS will be different. This example assumes that pscp.exe and cd29.ppk are installed at c:\putty. Modify the locations if yours are different.
1 2 3 |
|
- In https://console.aws.amazon.com/s3/home, go to the bucket you created above (e.g. cd29creds).
- Click on the Upload button.
- Click Add Files and add the id_rsa, id_rsa.pub and known_hosts files from the commands above to the cd29creds S3 bucket (where 29 is your student id).
- Click Start Upload.
CLASS EXERCISE: Tools, Commands
- Tools: Tools used in Course.
- Command-Line Options: Commonly-used Commands.
CLASS EXERCISE: About the sample applications
- Java App – This example application uses Java, Ant/Maven, MySQL, Tomcat on Linux. All of the application code, infrastructure, configuration and data is located at https://github.com/stelligent/continuous_integration_example/.
- Ruby App – This example application uses Rails, Rake, HSQL, Passenger on Linux. All of the application code and data is located at https://github.com/stelligent/sample_app/. All of the infrastructure and configuration is located at https://github.com/stelligent/devopsinthecloud/
- Maven Example – This example application uses Java, Tomcat and Maven. All of the application code is located at https://github.com/heroku/devcenter-embedded-tomcat/.