How To Setup Amazon Linux On AWS 2021

Published: December 1, 2025 (Updated: Dec 1, 2025)

Enjoying this content? Subscribe to the Channel!

The Ultimate Guide to Launching Amazon Linux 2 on AWS EC2

Hi there! This is Darren O’Neal from Darren’s Tech Tutorials, and I’m thrilled to guide you through one of the most fundamental tasks in cloud computing: setting up the robust and reliable Amazon Linux operating system on Amazon Web Services (AWS).

The Amazon Linux AMI (Amazon Machine Image) is Amazon’s own supported and maintained Linux distribution, specifically optimized to run securely and efficiently on Amazon EC2 (Elastic Compute Cloud). If you want a stable, high-performance environment for your applications, this is the place to start!

In this quick, comprehensive guide, we’ll go step-by-step from logging into the console to securely connecting to your new server.


Step 1: Getting Started in the AWS Console

Before we launch our server, you need to be logged into your AWS Management Console.

  1. Navigate to EC2: Once logged in, click on Services and select EC2 (Elastic Compute Cloud).
  2. Launch an Instance: On the EC2 dashboard, click the prominent Launch Instance button.

Step 2: Selecting the Amazon Linux 2 AMI

The first step in launching your instance is choosing the operating system image.

  1. Choose the AMI: Amazon Linux 2 is usually the very first option listed. Confirm that you select the image labeled Amazon Linux 2 AMI (HVM), ensuring it is marked as Free tier eligible.
  2. Choose Instance Type: We recommend leaving the instance type set to the default t2.micro (or whatever the current free tier option is). This ensures you stay within the AWS Free Tier limits while testing.
  3. Click Next: Configure Instance Details.

Step 3: Configuring Network and Storage

In this section, we fine-tune where and how our server runs.

  1. Network Settings (VPC and Subnet): Keep the default settings for the VPC (Virtual Private Cloud). Crucially, ensure that you assign the instance to a Public Subnet and enable Auto-assign Public IP. This is essential so you can access the server from the internet.
  2. Storage: The default 8 GB of General Purpose SSD storage is usually fine for a test server. If you need more, you can increase it here, but we will leave it as the default. Click Next: Add Tags.
  3. Add Tags (Organization): Tags are essential for managing your resources. Add a simple Name tag so you can easily identify the server later.
    • Key: Name
    • Value: My Test Server
  4. Click Next: Configure Security Group.

Step 4: Configuring Security and Launching the Instance

Security is paramount. We must lock down our server access immediately.

  1. Create a New Security Group: We will create a new security group tailored for this instance.
  2. Lock Down SSH: By default, port 22 (SSH) is open to the world (0.0.0.0/0). This is unsafe!
    • In the Source dropdown, select My IP. AWS will automatically fill in your current public IP address. This ensures that only your computer can attempt to connect to the server via SSH.
  3. Click Review and Launch.
  4. Launch the Instance: After reviewing your settings, click Launch.
  5. Create a Key Pair: You will be prompted to select or create a key pair. Since this is a new setup, choose Create a new key pair.
    • Name your key pair (e.g., my-test-key).
    • Click Download Key Pair. Save this .pem file immediately and securely! You cannot connect without it.
  6. Click Launch Instance.

Your server is now launching! It will take a few minutes for the status to change from pending to running.

Step 5: Preparing Your Key for Connection (Windows Users)

If you are using Windows and PuTTY to connect, you cannot use the downloaded .pem file directly. You must convert it into the PuTTY-compatible format (.ppk) using a free tool called PuTTYgen.

(If you are on macOS or Linux, you can skip this step and use the built-in SSH command line.)

  1. Download PuTTYgen: If you don’t have it, download the PuTTY package, which includes PuTTYgen.
  2. Load the Private Key: Open PuTTYgen.
    • Click Load. You may need to change the file filter dropdown to All Files (*.*) to see your downloaded .pem file (e.g., my-test-key.pem).
  3. Save the PPK: Once loaded, click Save private key.
    • You will be asked if you want to save without a passphrase. For basic testing, you can click Yes.
    • Name and save your new file (e.g., my-private-key.ppk). Keep this file safe.

Step 6: Connecting to Your New Amazon Linux Server

Now we connect using PuTTY!

  1. Retrieve the Public IP: Return to the EC2 console, click on your running instance, and locate its Public IPv4 address. Copy this address.
  2. Open PuTTY:
  3. Enter the IP: Paste the Public IP address into the Host Name (or IP address) field.
  4. Load the Private Key: In the left sidebar navigation, expand SSH and click on Auth.
  5. Click the Browse button and select the .ppk file you created in the previous step (e.g., my-private-key.ppk).
  6. Open the Connection: Click Open.

When the terminal window pops up, it will ask for a username. The default username for the Amazon Linux AMI is:

ec2-user

Type in ec2-user and hit Enter. If all steps were followed correctly, you will be logged into your new, secure Amazon Linux machine!


That was a fast, comprehensive look at setting up Amazon Linux 2 on AWS! You now have a stable, secure foundation ready for development.

If you encountered any issues while following along or have questions about next steps, please comment below. I always do my best to help out.

Happy coding, and thank you for watching! If this tutorial helped you get started in the cloud, make sure to like and subscribe to Darren’s Tech Tutorials for more clear, actionable guides!