Set up EC2 instance for grading JupyterHub

Follow the instructions below to setup an AWS EC2 instance which will be used to host and serve the grading JupyterHub (where the teaching team will perform grading and where the autograding will be done).

  1. Log into the AWS Management console and search for EC2 in the AWS services search bar:


  2. Scroll down and click on the orange “Launch Instance” button:


  3. Search for the Centos 7.8 Community Amazon machine image (AMI) that has the id ami-0252eebc56636a56b:


    and select it:


  4. Select an instance type (we use a t2.large) and click “Next: Configure Instance Details”:


  5. Leave these settings as is, and click on “Next: Add Storage”:


  6. Click the “Add New Volume” button to add an additional EBS volume for Docker. Edit the sizes to both be 30. Click the “Next: Add Tags” button:


  7. Add a key and value pair to easily identify the machine later on your EC2 console (we used the key “Course” and value “workflows” here, but you can choose whatever is meaningful to you). Click the “Next: Configure Security Group” button:


  8. Click the “Add Rule” button three times to add three additional security groups. Choose the one each of the following types: HTTP, HTTPS and All ICMP - IPv4. For the All ICMP - IPv4 security group, edit the value for the Source to be Custom and Click the blue “Review and Launch” button:


  9. Review your settings, and if satisfied, click the blue “Launch” button:


  10. Choose “Create a new key pair” and create a “Key pair name” (here we used jupyterhub). Click “Download Key Pair” and then the blue “Launch Instance” button:


    Save the key pair somewhere intentional on your laptop (e.g., ~/.ssh/) and then type the following to update the permissions of the key:

    chmod 400 ~/.ssh/jupyterhub.pem
  11. If successful, you should see this screen:


  12. Go back to the EC2 Dashboard (reminder: you can get there via searching for EC2 in the AWS services search bar) and click on the “Running instances” link:


  13. Select the instance you just launched and under the “Description” tab note (and record somewhere for future reference) the Public DNS (IPv4) value (which will be used to ssh into the instance) and the IPv4 Public IP address (which will be used by ansible and for mapping your custom domain name to the server):


  14. Add the Ansible machine’s (e.g., your laptop’s) public key to ~/.ssh/authorized_keys on the EC2 instances. To do this you need to ssh into the EC2 instance using the private key you downloaded from Amazon earlier (jupyterhub.pem in this example):

    ssh -i ~/.ssh/jupyterhub.pem

    And then use The UNIX vi editor to add your public key the ~/.ssh/authorized_keys file. To do this type the following to open vi:

    sudo vi ~/.ssh/authorized_keys

    Then press i to enter insert mode and paste your key using your OS’s paste keyboard shortcut. Then press ESC + w + q to write the file and exit. Now you are are ready to move onto using Ansible to build the student JupyerHub.