How To Create An Ubuntu Server On AWS EC2

Ubuntu is very popular on the server for all kinds of applications in cloud computing. In this tutorial, we’ll take a look at how to install Ubuntu Server on an AWS EC2 instance in a simple and straightforward way.

The EC2 Global View

You’ll want to bring yourself to the AWS EC2 console and click on the Launch Instance button. In order to get to the EC2 console, you’ll either simply search for EC2 in the search bar at the top of the AWS console or you can click on the Services dropdown and select EC2.

Launch A Server

After you click “Launch Instance”, you’ll be provided a list of AMIs (Amazon Machine Images) that you can use to launch an EC2 instance. At the very top of the AMIs, you’ll see Amazon Linux, macOS, Ubuntu, Windows, and RedHat. We’ll choose the Ubuntu option.

t2.micro

We can select the t2.micro instance type. This is a free tier eligible instance type.

SSH keys

In order to connect to the instance once it is launched, we’ll need to select a key pair. If you already have a key pair, you can select it from the dropdown. If you don’t have a key pair, you’ll need to create one. You can do this by clicking on the “Create a new key pair” link. You’ll be prompted to enter a name for the key pair. You’ll also be prompted to download the key pair. You’ll need to save this key pair to a safe location on your computer. You’ll need it to connect to the instance.

Here we are going to create a new key pair so we can see how to complete the procedure. A name is required for the key pair, we’ll simply name it “lemp” for this tutorial.

If you’re following along, when you click the “create key pair” button, a file with the name “lemp.pem” will download automatically to your machine. Put this in a folder you are familiar with. In our case, we simply have a local folder named “aws” and we’ll place the file in there.

The next step is Network settings. This section will display a network VPC, subnet, firewall security groups, and storage options. For the most part, we can simply take the defaults in this section. For the purposes of this tutorial, we will Create a security group and allow ssh traffic, allow HTTPS traffic, and allow HTTP traffic from the internet. The CIDR dropdown can contain a value of 0.0.0.0/0, i.e., Anywhere. The storage default is 1X 8 GIB gp2 root volume and we will leave that as is. When you are ready, click “Launch Instance”.

View All Instances

Now we can click on the View all instances button on the lower right-hand side of the screen. This will bring us to the Instances view of the Instances menu on the left side of the screen. Other options under instances include Launch Templates, Spot Requests, Savings Plans, Reserved Instances, Dedicated Hosts, Scheduled Instances, and Capacity Reservations. The status checks at first will likely say “Initializing.” After a short time and a refresh of the instance page, we should see that 2/2 checks passed and the instance state is at Running.

Clicking the instance ID will display a new screen with a plethora of information about the newly created Ubuntu instance. Some of the things you’ll notice are the instance ID, public IPv4 address, private IPv4 address, Instance State, public IPv4 DNS, hostname type, private IP DNS name for IPv4 only, instance type, auto-assigned IP address, VPC ID, Subnet ID, and more for the Instance Summary pane.

The other panes include Details, Security, Networking, Storage, Status Checks, Monitoring, and Tags. In this case, the Details page shows that the Platform is Ubuntu (Inferred) with Platform details of Linux/UNIX. We’ll see an AMI name of ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-20220609.

How To Create An Ubuntu Server On AWS EC2 Summary

This article covered the basics of getting an Ubuntu 22.04 AMD 64 Server running on an Amazon EC2 Instance. From here we’ll learn How To SSH To Ubuntu Server On EC2 in a follow-up article.

Learn More