Launching instances with EC2 in AWS

Dolly Desir
5 min readDec 26, 2020

Like many of us recent bootcamp grads, we’re all desperately searching for jobs, heavy on the desperate. My recent interview involved me deploying an app to a VM & 2 weeks ago I had no idea what a VM was. How real world applications function and get deployed was something I just brushed over and very little knowledge of but this blog will be all about the things I learned.

What is a VM? VM stand for virtual machine. Virtual machines allow you to run an operating system on your desktop/laptop that behaves like a full, separate computer. You can use them to play around with different operating systems, run software your main operating system can’t, and try out apps in a safe, sandboxed environment. It empower users to go beyond the limitations of hardware to achieve their end goals. A virtual machine is a computer file, typically called an image, that behaves like an actual computer. In other words, creating a computer within a computer.

Literally me finding out about virtual machines

So how did I get a virtual machine going? For this particular job there were several options, I chose to run mine using AWS EC2. Firstly I made an AWS account, you are given two options for an account. The first option is Root user which is made when the AWS account is created & an IAM user which are created by the root user or an IAM administrator for the account.

When first making an account, choose Root user
Once signed in your given options to get started

The first option will bring you to a list of different operating systems to choose from. You can choose from Amazon Linux, macOS Catalina or Mojave, Red Hat, several different options of Microsoft and a couple of others. I chose Ubuntu because I wanted to try something I’ve never used before plus my amazing mentor James told me it’s very similar to the Mac’s CLI just with different syntax to run commands. “Ubuntu is a complete Linux operating system, freely available with both community and professional support. The Ubuntu community is built on the ideas enshrined in the Ubuntu Manifesto: that software should be available free of charge, that software tools should be usable by people in their local language and despite any disabilities, and that people should have the freedom to customize and alter their software in whatever way they see fit.” — help.ubuntu.com

The first 12 months of your AWS account, you are eligible for the AWS free tier. The next page brings you to your instance type, the t2.micro option is automatically chosen for free tier eligibility. Depending on what you are going to be doing, you can either choose to Review and Launch which will choose security options based on your previous choices. In my specific situation, I had to configure my security group. The AWS EC2 security group acts like a firewall which controls the traffic allowed into your instances, since any IP address can now access it. By default your machine is deployed on Amazon’s cloud and in order to gain access to it we need to open permissions on their machine through security group that will allow us to host on our machine (your desktop/laptop) to gain access of that device. I had to edit the rule for SSH(secure shell) source option to anywhere. An SSH client is a software which uses the SSH protocol to connect to a remote computer. In general SSH protocol can be used for two purposes, file transfers and terminal access.

Me falling down a rabbit hole of things I’ve never heard of.

After hitting Launch, you are then prompted to create or add an existing key pair. AWS uses public key cryptography to encrypt and decrypt login information. AWS only stores the public key, and we store the private key in our machine. When creating a keypair you have to enter a name for it, I suggest something you can remember because it is then downloaded to your computer. Anyone can decrypt this keypair so it is important to download it to a secure location on your machine. After doing this your instance should now be launched.

do not forget to check the box!
I’ve launched many instances, but the one running is the one I created for the purpose of this blog.

Once your instance is running, you can now connect it. You will then be prompted with directions on how to connect your machine to the VM using the SSH client.

Open up your terminal and cd into whichever directory you downloaded your keypair to. I am the only person that uses my laptop so I kept my key in the Downloads folder. These are the steps to connect your machine to the VM.

Connected !

As you can see in the picture my terminal which usually has my name, now says Ubuntu with my public IP which I blocked out because you can never be too cautious. Now that you’re connected to your VM you can build a new application or launch an existing one. Using Amazon EC2 eliminates your need to invest in hardware up front, so you can develop and deploy applications faster.

Unfortunately I didn’t get the job but I was exposed to a side of software engineering that I didn’t even know existed. Once I figured how to get things working, it was actually pretty fun. In the future I would like to write a blog about actually getting an application deployed which isn’t as easy as connecting to an instance! Thanks for reading, gimme my claps!

--

--