Setting Up Amazon EC2 Server

"Cloud [computing] is about how you do computing, not where you do computing." - Paul Maritz, CEO of VMwareAmazon AWS is one of the largest cloud service providers and has

2 years ago

Latest Post Cloud Development Kit for Kubernetes (cdk8s) by Tyler Moon
"Cloud [computing] is about how you do computing, not where you do computing."
- Paul Maritz, CEO of VMware

Amazon AWS is one of the largest cloud service providers and has dozens of different services and platforms available to developers. The most basic of these, and the one covered in this article, is the AWS Elastic Compute Cloud (EC2) server. This service allows users to provision Linux and, to a lesser degree, Windows virtual servers. These VMs can be used for a variety of tasks and many of Amazons other services are built off these same servers.


Provisioning an Instance

Lets suppose that you are wanting to run a very simple Node.js API off of a server. You could run it off your local machine but what if you wanted other people to connect to it? They would not be able to when your machine is off so it would be useful to run it on a machine that is never off. This is where the virtual server comes into its own.

To start login to the AWS console at

While this interface may not be the most exciting or modern looking, it does get the job done and after a little wandering around is not too bad to navigate. Next click on the EC2 link under the Compute section to bring up the EC2 Dashboard.

Once on the dashboard click the Launch Instance button to configure a new server.

EC2 Dashboard

Next select which operating system the server should run. Ubuntu 18.04 is a personal favorite and has a lot of support and software available. After selecting an OS you need to choose an Instance Type. This basically defines how many resources will be devoted to your server, and therefore how much it will cost. The t2.micro server size is in the free tier and will handle a lot of small projects with light server loads. Click the Review And Launch and then Launch buttons to confirm the rest of the details. For a single server use for small projects the defaults should be fine and can be adjusted later if needed. After clicking Launch a modal will appear asking you to create a keypair. This will generate a .pem file which is the only way to SSH and connect to your server so download it to a place where you will remember it. After confirming the keypair dialog the server will actually be provisioned and after a few minutes of setup available to connect to.

Connecting Via SSH

Back at the EC2 Dashboard there should be a new server instance listing available. Click on the checkbox next to it and then the big Connect button to view the needed connection information.

Connection Dialog

Now open up your terminal emulator of choice. Personally Hyper is my favorite because it is cross platform, simple to setup, and customizable. Enter cd <directory_with_pem> to change to the directory that you saved your private keypair file in the last section. Then enter the following commands to connect to the server via SSH. If you forget these commands at any time the Connect dialog shows the same ones and also has the Public DNS name for your server instance.

chmod 400 <private_key_name>.pem
sudo -i "<private_key_name>.pem" ubuntu@<public_ip_address>

And there you go you should now have a working Ubuntu 18.04 (or whatever OS you choose) server where you have complete control and can install whatever software you want.

Tyler Moon

Published 2 years ago