How to install Ubuntu on AWS

Published: January 6, 2021 (Updated: Jan 6, 2021)

Enjoying this content? Subscribe to the Channel!

Launch Ubuntu on AWS EC2: The Ultimate Step-by-Step Setup Guide (with Putty/Puttygen)

Hi there! This is Darren from Darren’s Tech Tutorials, and today we’re tackling one of the most fundamental skills in cloud computing: getting an Ubuntu Linux server up and running on Amazon Web Services (AWS) EC2.

If you’re a Windows user, we’ll also cover the essential step of converting your secure key so you can easily connect using Putty. Let’s dive right in and get your virtual server deployed!


1. Getting Started with AWS EC2

The first step is locating the service that hosts our virtual servers.

  1. Navigate to EC2: Once logged into your AWS Console, click on Services and search for EC2 (Elastic Compute Cloud). This is where we manage our virtual servers.
  2. Launch Instance: On the EC2 dashboard, click the Launch Instance button.
  3. Select the Ubuntu AMI: You will now be asked to choose an Amazon Machine Image (AMI). In the search bar, type ubuntu and hit Enter.
  4. Choose the Free Tier Eligible Image: Select the official Ubuntu Server image that is marked as Free Tier Eligible. Click Select.

2. Configuring Instance Details

We will keep the instance size small and ensure we can connect externally.

  1. Choose Instance Type: We’ll stick with the t2.micro type, which is also Free Tier Eligible. Click Next: Configure Instance Details.
  2. Ensure Public IP: Leave most settings at their defaults, but it is critical to ensure that Auto-assign Public IP is enabled. This public IP address is how we will access the server later.
  3. Add Storage: Click Next: Add Storage. The default 8 GB is usually sufficient for a test server, but you can always add more here if needed.
  4. Add Tags (Optional but Recommended): Click Next: Add Tags. Adding tags helps you organize your resources. A good starting tag is Key: Name and Value: Darren’s Test Server.

3. Configuring Security and Generating the Key Pair

Security is paramount. Before launching, we need to create a secure key and lock down the connectivity.

Restrict SSH Access

The default rule allows SSH (Port 22) access from anywhere, which is a major security risk. We need to lock this down to only our current location.

  1. Click Next: Configure Security Group.
  2. Select Create a new security group.
  3. In the rule list, find the SSH (Port 22) rule. Under the Source dropdown, change the setting from ‘Anywhere’ to My IP.
  4. AWS will automatically detect your current public IP address and restrict access to just you. This is critical for security!

Launching the Instance and Downloading the Key

  1. Click Review and Launch. Verify all your settings, and then click Launch.
  2. Create a New Key Pair: When prompted, select Create a new key pair. Give it a memorable name, such as Darren’s New Key.
  3. Download Key Pair: Click Download Key Pair. This file (a .pem file) is your only way to securely access the server. Save it somewhere safe!
  4. Click Launch Instance.

Your instance should now be in a ‘pending’ state. Give it a minute or two to start up and transition to the ‘running’ state.

4. Converting the PEM Key to PPK using Puttygen

Windows users connecting via Putty cannot use the standard .pem file directly. We need to convert it into the Putty Private Key (.ppk) format using a tool called Puttygen.

Need Putty? You can download Putty and Puttygen from the official source: https://www.putty.org/

  1. Open Puttygen: Launch the Puttygen application.
  2. Load the Key: Click the Load button. You might need to change the file type filter in the bottom right corner from “Putty Private Key files” to “All Files (*.*)” to see your downloaded .pem file.
  3. Select Darren’s New Key.pem and click Open.
  4. Save the Private Key: Click Save private key. When prompted about saving without a passphrase, click Yes (though adding a passphrase is recommended for production servers).
  5. Name the new file something like Darren’s Test Key.ppk and save it.

You now have the key format needed for Putty!

5. Connecting to Your Ubuntu Instance via Putty

With the instance running and the key converted, it’s time to establish our SSH connection.

  1. Get the Public IP: Return to your EC2 Instances dashboard. Select your running instance and copy the Public IPv4 Address.
  2. Open Putty: Launch the Putty application.
  3. Paste IP: Paste the Public IPv4 Address into the Host Name (or IP address) field. Ensure the Port is set to 22 and Connection Type is SSH.
  4. Load the PPK File: In the left-hand navigation pane, expand SSH, then click on Auth.
  5. Click Browse and select the .ppk file you just saved (Darren’s Test Key.ppk).
  6. Open Connection: Navigate back to the top Session pane, and then click Open.
  7. Login: A terminal window will open. If you receive a security alert about the host key, click Yes. When prompted for login as:, type the default Ubuntu username: ubuntu.

If everything was configured correctly, you will now be logged into your new Ubuntu server running securely on AWS EC2!

Conclusion

And there you have it—a fully operational Ubuntu server running in the cloud! We walked through the critical steps, from launching the instance and securing port 22 to converting the key and establishing a connection using Putty.

This powerful setup is the foundation for virtually any project you want to run in AWS.

If you found this tutorial useful, please consider giving the video a like and subscribing to Darren’s Tech Tutorials for more clear, practical guides. Your support helps us keep the tutorials coming!