How to set up AWS EC2 so you can access it from a public library computer

Many people do not have their own laptop. Whether you've only got your phone and work laptop or you share a computer with your family, sometimes you're not allowed to install things on it. This makes developing difficult.

If you're interested in web applications there are many online development environments that set up your stack and give you a pre-configured environment. If that's your interest I recommend from RedHat. Because I like the company, not because it's the best.

If you're more interested in mobile development or enterprise software you'll need a more unrestricted dev environment, this is hard to find for free. One thing you can do is make a new AWS account. AWS (Amazon Web Services) is a business that hosts a collection of services, one of these services is something called an EC2 instance. You get an online development machine that is free for a year. Once you initialize your EC2 instance online you can SSH into it and set up your dev environment just like we did in tetris_2.

Here's how to set up your EC2 instance so that you can access it from a public library computer.

What You Need:

Step 1 - Create an AWS Account

Create an AWS account and login. You will need to provide a credit card. This is how Amazon guarantees you're not a robot.

AWS Create EC2

You'll be met with a webpage that looks like this. All the AWS services are used in business and are definitely worth learning. For now click on the link that says "Launch a virtual machine", we're going to create a virtual computer using EC2.

EC2 Linux 2

First select the Amazon Linux 2 AMI.

AMI means Amazon Machine Image. Machine images are something that have been around a while. In the virtual machine world VirtualBox has its VDI file type, QEMU uses qcows, you can even make your own if you're on Linux. Plug in your flash drive and a quick dd if=/dev/sda of=/dev/sdx and you've now got your entire computer on your flash drive!

Note: The above command will break things. Do not use it until you know what it does. This is a nice tutorial.

Review and Launch

The t2.micro should already be selected for you. If not, select it yourself then click "Review and Launch". This will skip the configuration steps and give you a default security group and 8GB of storage. Now click Launch.

Download Keypair

You have to download a key pair, this will be saved as a .pem file, use it to ssh in to your EC2 instance.

Step 2 - SSH into EC2

Ok now we're going to ssh into the virtual computer EC2 instance we created. SSH just stands for Secure SHell, but it's essentially the way to log in to a computer over the internet. Want to log in to your coffee maker? Secure SHell. Want to log in to your Tesla? Secure SHell. Want to log in to your neighbors laptop and break things? You just need to know their username, password, and hostname (ip address).

EC2 Instances

Anyway, Head to your EC2 dashboard, if you can't find it click on "Services, EC2" then "Instances", that should get you to this page. This page allows you to manage your EC2 instances. You can turn them off, turn them on, delete them, or create new ones. We're here for the hostname. Its Public DNS. Copy it.

Now to SSH you need 3 things, a username, password, and hostname. The default EC2 username is ec2-user, you just copied the hostname, and the password is that .pem file we downloaded. SSH with the command ssh -i ${MY_PEM_FILE} ${USERNAME}@${HOSTNAME}


Step 3 - Replacing your PEM file with a password

Most public library computers do not give you terminal access. A lot of them just boot you into a web browser and don't let you leave it. They're like chromebooks, except you're stuck running Windows XP and using IE6. This is why we need to remove the PEM file requirement on our instance. serFISH is the only free browser ssh client I could find, and it does not accept RSA keys.

Remove PEM

To get here I followed the directions on this forum post. After changing the PasswordAuthentication line you'll want to set a password for ec2-user using the command sudo passwd ec2-user and restart the SSH service with the command sudo systemctl restart sshd. My final terminal looks like this.

Config Commands

And now we can use serFISH.