Setting Up An Ubuntu EC2 Instance From Scratch on AWS

Written by
AuthorDevarshi
Published onJuly 6, 2023

Introduction

In this article, we will be setting up an Ubuntu EC2 instance from scratch on AWS. Amazon EC2 is a web service that provides scalable and inexpensive compute power in the cloud. Feel free to checkout the below video I made for this tutorial as well.

Steps To Create Ubuntu Instance on AWS

Amazon EC2 makes it easy to set up a virtual machine (VM) running Ubuntu on AWS.

Selecting AWS Region

To create a Ubuntu instance on AWS, you first need to select an EC2 region. In this tutorial we will be using the ap-south-1 region as it has low latency and availability for us.

aws-region

Configuring Our AWS Instance

Now you'll need to name your AWS Instance and select the Operating System(OS) to run on your AWS Instance. For this tutorial, we'll be going with the Ubuntu 22.04 LTS Version which is also part of the AWS Free Tier.

aws-instance-name

aws-instance-os

Now, You need to choose an instance type and instance size. You will have to choose how many CPUs and how much memory you want for your Ubuntu instance. You can also change this later on but it is not recommended unless you know what you are doing. I am going with the t2.micro instance size for this tutorial.

aws-instance-size

Now you will be prompted to assign a key pair to access your instance. Select Create A New Key Pair. Enter a name to your key. Click Create.

aws-keypair-1

aws-keypair-2

Important: Save the key pair, if you miss this key you wont be able to access your instance using SSH.

Now select the Disk Size you want, you can choose different disk type as well and select tags for your instance.

aws-instance-disk

Then click on "launch" button and wait until it connects with AWS servers in few minutes. After that your Ubuntu EC2 Instance is ready!

aws-instance-launch

Let it setup itself, takes approx few seconds to minutes. It should show Pending and once it's ready, it's state should change to Running

aws-launch-pending

aws-launch-running

Connecting to our AWS Instance

Now we'll head to the instance details and click on Connect. Ideally you would want to use ssh to connect to your EC2 instance but for this tutorial, we'll be using the WebUI. The default username is ubuntu so click Connect.

aws-connect

YAY!!🥳 And there's our welcome message to Ubuntu which is running on AWS.

aws-welcome

Extra

Now we'll install neofetch and check system configuration of the virtual machine. Run the following commands.

sudo apt update

sudo apt upgrade -y

sudo apt install neofetch -y

And there you go! Now it shows up our virtual machine specification in the terminal and in friendly design-style.

aws-neofetch

Conclusion

Setting up an Ubuntu EC2 instance from scratch on AWS is a fun little project. It's relatively easy, and it gives you an opportunity to learn some more about AWS and the command line.

Thank you for reading! If you found this blog post helpful, please consider sharing it with others who might benefit. Feel free to check out my other blog posts and visit my socials!

Read more

Share this article: