Skip to content

How the **** do I actually spin up an Ubuntu AWS EC2 instance?

Published: at 09:10 AM

At , we got a generous AWS package that lets us use some of their services for free. The problem is… I had no experience whatsoever with AWS and their UI is a nightmare (totally a subjective opinion) . So… how did I do this thing?

This is a 2part article:

  1. How to spin up an EC2 instance
  2. How do I connect to the EC2 instance


Feel free to skip this.

For our MVP we wanted to keep it simple, only a handful of users are going to test the MVP so scaling won’t be a problem. That’s when we decided to keep it simple, a simple Ubuntu machine + Docker should suffice.

Introducing EC2!

EC2 is a VPS (Virtual Private Server) just like a Digital Ocean Droplet or a Raspberry Pi in your home.

How to spin up an EC2 instance

1. Head on to

I’m in EU, remember to change your region if necessary.

2. Click on “Launch Instance”

3. Set the name of the Instance

There’s a name field under “Name and tags”. Honestly, whatever you like, I called mine Peter .

Image description

4. Select the Image type

I really enjoy deploying in Ubuntu, it’s not the lightest OS for web-dev, but I’m super familiar with it and comes with a lot of utilities I use right of the bat.

For this, I selected the 64-bit Ubuntu Server 22.04 instance type:

Image description

5. Select the instance type

How much CPU and RAM do I need? You ask.

Just start with the free one and scale if needed. I say.

Seriously, don’t sweat it, start with the free tier and monitor your server load. Increase CPU/RAM as you go.

Image description

6. Generate a new key pair

Hit “Create new key pair”, it will download a .pem file to your computer. Save that somewhere secure, you’re gonna need it.

Image description

7. Set routing rules

  1. Enable SSH

You will need SSH, since you will need to connect to the server to manage everything.

2. Enable HTTPS or HTTP as needed

I’m deploying a Django app (in Docker) so I actually want to allow HTTPS traffic into the server.

Image description

I do NOT recommend allowing SSH from anywhere, this can make your server more prone to attacks. AWS allows you to select your computer’s IP so please do that:

Image description

8. Select storage

I just use 64gb of gp2 (it’s shared SSD storage), works completely fine. Set the storage size to whatever you want. If you’re going to deal with a lot of heavy files increase it accordingly.

Image description

9. Execute!

You’re ready now! On the right of the screen, hit “Launch Instance”

Image description

Ok, great, how the * * * * do I connect to my EC2 instance?

Easy there cowboy.

We will use SSH.

1. Set up the keys

Remember that .pem file you downloaded in step 6? Open it with your favorite text editor (go go notepad+ + ) and copy the private key inside.

I connect via SSH from my Ubuntu WSL in windows, but you can use terminal in MAC just fine:

Create a new file:

nano PeterKeys.pem

(I use nano, so what, fight me)

Paste the key you copied and save using ctrl+x or cmd+x .

2. Gather connection data

Go to your AWS EC2 instance details and copy the public IPv4 DNS:

Image description

3. Connect!

The default user for an Ubuntu instance is ubuntu .

Run the following:

ssh -i PeterKeys.pem ubuntu@ipv4-address-you-just-copied

Done! You should be inside your EC2 instance.

What I like to do now is create my user and add my local machine’s SSH keys to authorized_keys so I can connect directly to my user. This will be explained in another post.