For your project and homeworks you may want to use Amazon Web Services to run a virtual machine for your code.

Setting Up an AWS VM

Follow the instructions here

A few things to keep in mind:

  • Follow the steps carefully! For example, when doing this in Lab many students incorrectly chose Ubuntu 20.04 as the VM type. This can result in other steps not working as expected.
  • If you plan to use VS Code to remotely log into your VM, you should use a Medium instance type and follow the instructions below for configuring an Elastic IP.

If you want to speed up the process of installing software in a new VM, you can use this script. The easiest way to do that is get a connection to your VM with VS Code and use these commands to download and run the script:

curl https://cs2541-21s.github.io/aws/ec2setup.sh -o "ec2setup.sh"
# fill in your desired username and password
bash ec2setup.sh -u USERNAME -p PASSWORD

Changing your Instance Type

Some students have reported issues with their VMs seeming to freeze while connected using VS Code. There are a few unresolved bugs in VS Code which can cause this (e.g., here), but in many cases it happens because the VM runs out of memory.

Here is a video which will go through the steps of changing your instance type and setting up an Elastic IP, or follow the steps below.

  • Log into AWS Educate
  • Go to your AWS console and then the EC2 Service
  • In the EC2 dashboard, click Instances to see your running VM
  • Right click on your VM and select “Stop Instance”. Then hit the refresh button until the Instance State changes to Stopped.
  • Right click on your VM and select “Change Instance Type” as shown below

  • In the menu of instance types, change it to a “medium” type for the same base instance class you used previously (i.e., if you previously used t2.micro change it to t2.medium, but if you used t3.micro then change it to t3.medium). This will give you a VM with 4GB of RAM.
  • Back in the Instances page, right click your VM again and choose “Start instance”

In most cases, this will resolve your issue. However, it poses two new problems:

  • The new VM has a higher cost, so you might run out of AWS credits if you aren’t careful.
  • Every time you restart your VM, it will get a new IP address and host name, so you will need to modify your SSH configuration settings to be able to reach it.

You can resolve these two issues by using an Elastic IP, as described in this guide: https://aws.amazon.com/premiumsupport/knowledge-center/ec2-associate-static-public-ip/ (Follow steps 1 and 2 in the Resolution section)