Set up the Environment

Architecture

Create an SSH Key

First, you’ll need to select a region. For this lab, you will need to choose either the North Virginia, Ohio, Oregon, Dublin, Tokyo, Seoul or Sydney Regions.

SSH Key Pair Instructions (expand for details)

At the top right hand corner of the AWS Console, you’ll see a Support dropdown. To the left of that is the region selection dropdown.

  1. Then you’ll need to create an SSH key pair which will be used to login to the instances once provisioned. Go to the EC2 Dashboard and click on Key Pairs in the left menu under Network & Security. Click Create Key Pair, provide a name (can be anything, make it something memorable) when prompted, and click Create. Once created, the private key in the form of .pem file will be automatically downloaded.

  2. If you’re using linux or mac, change the permissions of the .pem file to be less open.

$ chmod 400 PRIVATE_KEY.PEM

If you’re on windows you’ll need to convert the .pem file to .ppk to work with putty. Here is a link to instructions for the file conversion - Connecting to Your Linux Instance from Windows Using PuTTY

Launch the Workshop template

For your convenience, we provide a CloudFormation template to stand up the core infrastructure.

The template sets up a VPC, IAM roles, S3 bucket, and an EC2 Instance. The EC2 instance will run a Jupyter Notebook which we will leverage in Lab 2 and a small website that we will use in Lab 3. The idea is to provide a contained environment, so as not to interfere with any other provisioned resources in your account. In order to demonstrate cost optimization strategies, the EC2 Instance is an EC2 Spot Instance deployed by Spot Fleet. If you are new to CloudFormation, take the opportunity to review the cloudformation template during stack creation.

Prior to launching a stack, be aware that a few of the resources launched need to be manually deleted when the workshop is over. When finished working, please review the “Workshop Cleanup” section to learn what manual teardown is required by you.

  1. Download the cloudformation template locally.

  2. Navigate one of the supported Cloudformation regions:

  3. Click on Create Stack, select Upload Template and use the Chose File to select the local copy of the cloudformation template that was just downloaded. Create Stack Create Stack

  4. The template will automatically bring you to the CloudFormation Dashboard and start the stack creation process in the specified region. Click Next on the page it brings you to. First Screen CloudFormation PARAMETERS

    Parameters Screen CloudFormation PARAMETERS

  5. Select a password to use for the Jupyter Notebook. You will use this password in Lab 2.

  6. The default port for the Jupyter Notebook is 8888. Some corporate firewalls and VPNs will block this port. You can change the JupyterPort to 443 to get around this.

  7. Select your ssh key. >Important: On the parameter selection page of launching your CloudFormation stack, make sure to choose the key pair that you created in step 1. If you don’t see a key pair to select, check your region and try again.

  8. After you’ve selected your ssh key pair, click Next.

  9. On the Options page, accept all defaults - you don’t need to make any changes. Click Next.

  10. On the Review page, under Capabilities check the box next to “I acknowledge that AWS CloudFormation might create IAM resources.” and click Create. Your CloudFormation stack is now being created.

  11. Periodically check on the stack creation process in the CloudFormation Dashboard. Your stack should show status CREATE_COMPLETE in roughly 10-15 minutes. In the Outputs tab, take note of the Jupyter and Web Server values; you will need these in the next two labs.

    CloudFormation Complete

  12. Under the CloudFormation Outputs, click on the URLs for Jupyter and Web Server. Each should load a web page confirming that the environment has been deployed correctly. We have created a self-signed certificate for the Jupyter Notebook. You will see messages about an unsafe connection. It is safe to ignore these warnings and continue. The steps will differ depending on your browser.

    Certificate Warning

    Certificate Warning

    Jupyter

    CloudFormation Jupyter Complete

    Web

    CloudFormation Web Client Complete

If there was an error during the stack creation process, CloudFormation will rollback and terminate. You can investigate and troubleshoot by looking in the Events tab. Any errors encountered during stack creation will appear in the event log.

You’ve completed Lab 1, Congrats!