How to deploy EC2 Ubuntu 22.04 LTS on AWS

Deploying an Amazon EC2 instance is a straightforward process that can be done in just a few steps. Here’s a step-by-step guide to help you get your new Ubuntu 22.04 LTS instance up and running on AWS.

Prerequisites

Before you start, make sure you have the following:

Step 1: Log In to the AWS Management Console

To begin, navigate to the AWS Management Console and log in using your AWS account credentials.

Step 2: Access the EC2 Dashboard

  1. Once logged in, find the Services menu at the top of the console.
  2. Click on EC2 under the Compute section to open the EC2 Dashboard.
  3. Don’t forget to select the specific Region that closest to your client’s user base to minimize latency.
How to deploy EC2 Ubuntu 22.04 LTS on AWS - Select EC2 Service

Step 3: Launch a New Instance

On the EC2 Dashboard:

  1. Click on the orange Launch Instances button that will use to create new instance.
  2. Provide Name and tags for your EC2 instance, simply click Add additional tags and add the following sample tags in the screenshots for your EC2 instance.
How to deploy EC2 Ubuntu 22.04 LTS on AWS - EC2 dashboard

Note: A tag is a label that you assign to an EC2 instance or any AWS resource. Each tag consists of a key and an optional value, both of which you define. For more details, refer to AWS official guide for tagging your AWS resources.

How to deploy EC2 Ubuntu 22.04 LTS on AWS - Add instance tagging

Step 4: Choose an Amazon Machine Image (AMI)

  1. You’ll see a list of AMIs to choose from.
  2. Search for Ubuntu in the search bar.
  3. Select the Ubuntu Server 22.04 LTS (HVM), SSD Volume Type AMI.
How to deploy EC2 Ubuntu 22.04 LTS on AWS - Select instance AMI

Step 5: Choose an EC2 Instance Type

  1. After selecting your AMI, you’ll be prompted to choose an Instance Type.
  2. For a typical use case, t2.micro or t3.micro instances are a cost-effective choice, eligible for the free tier if you qualify.
  3. Scroll down to setup keypair for EC2 instance Access.
How to deploy EC2 Ubuntu 22.04 LTS on AWS - Select instance type

See also EC2 instance type pricing per hour for specific t2.micro instance type in us-east-1 (Virginia), refer to AWS official guide for EC2 instance type pricing.

EC2 Instance typeSoftware/hrEC2/hrTotal/hr
t2.micro$0.21$0.012$0.222
Note: The t2.micro EC2 instance type is one of the cheapest options on AWS and can be good for testing development projects.

Step 6: Select a Key Pair

  1. Choose an existing key pair or create a new one.
  2. To create a new key pair:
    • Select Create a new key pair from the dropdown.
    • Name your key pair.
    • Click Download Key Pair to save the private key file (.pem).
How to deploy EC2 Ubuntu 22.04 LTS on AWS - Create key pair

Select your key pair from the Key pair name required field, refer to AWS official guide about Amazon EC2 key pairs.

How to deploy EC2 Ubuntu 22.04 LTS on AWS - Add key pair

After downloading the new key pair, ensure file permissions are set correctly if you’re using a UNIX-based system:

chmod 400 /path/to/your-key-pair-name.pem

Step 7: Configure Network Settings

Configure your instance details according to your requirements, such as:

  1. The VPC and subnets are automatically set by default. If you want to change the default VPC and subnets, simply click the Edit button at the right corner.
  2. The instance public IP addresses are automatically assigned by default.
  3. To create a security group, select Create security group and enable traffic for SSH (port 22) for remote server access. Additionally, allow traffic for HTTP (port 80) and HTTPS (port 443) if necessary for web server access.
How to deploy EC2 Ubuntu 22.04 LTS on AWS - Network Settings

Refer to this AWS official guide if you want more details on What is Amazon VPC and How Amazon VPC works.

Step 8: Add Storage

  1. By default, an 8GB volume is provided. You can modify the size of the root volume if necessary or add additional volumes.
How to deploy EC2 Ubuntu 22.04 LTS on AWS - Add storage

Volume Pricing

Volume TypeRateEC2/hr
EBS General Purpose SSD (gp2) volumes$0.10 per GB-month of provisioned storage$0.012
Note: You pay once every month for these storage volumes, but don’t worry because it’s not too expensive if you use small one, unless you need large storage for big computations.

Step 9: Review and Launch

  1. Set number of instances to 1 by default. Adjust as needed for multiple instances.
  2. Go over all settings one last time.
  3. If everything looks correct, click Launch instance.
How to deploy EC2 Ubuntu 22.04 LTS on AWS - Review and Launch

Step 10: View Your Instance and Connect

  1. Once successfully launched, click on the Instance ID to view instances
  2. You will be redirected to the Instances dashboard where you can monitor the launch status of your new instance.
How to deploy EC2 Ubuntu 22.04 LTS on AWS - Instance Creation Success
How to deploy EC2 Ubuntu 22.04 LTS on AWS - Instance Status Running

After your instance state turns to “running,” you can connect to your newly created Ubuntu server via SSH using the downloaded key pair and the public IPv4 address or Public IPv4 DNS provided by AWS.

How to deploy EC2 Ubuntu 22.04 LTS on AWS - Access to EC2 instance via SSH

Note: You can use any Linux terminal to connect to your AWS EC2 via SSH. In this tutorial, I’m using the Git Bash terminal since it is a Linux-compatible terminal capable of executing SSH commands.

Final Step: Terminate Instance

In case you need to terminate your instance to save cost on AWS, simply click on the EC2 instance you want to delete, go to “Instance state,” and choose “Terminate instance” from the dropdown menu. This action will redirect you to the verification page.

How to deploy EC2 Ubuntu 22.04 LTS on AWS - Terminate instance

Congratulations! You’ve successfully deployed a new EC2 Ubuntu 22.04 LTS instance on AWS. Remember to monitor and manage your instance to ensure optimal performance and security compliance.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.