Creating an EC2 Linux Server
In this chapter, you will learn how to:
- Create your first EC2 Linux server
- Connect to the Linux instance
Steps to Create an EC2 Linux Server
1. Log in to the AWS Management Console
Use the following link to log in:
2. Navigate to EC2
After signing in, use the search bar at the top to search for EC2.
Click on EC2 from the search results.

Once inside the EC2 Dashboard, click on Instances.

3. Launch an EC2 Linux Server
Click on the Launch Instance button.

3.1 Configuring the Instance
- Instance Name: Enter any name of your choice.
- Amazon Machine Image (AMI): For simplicity, choose Amazon Linux, which is a distro provided by AWS.
- Instance Type:
- Choose t3.micro, which costs $0.024 per hour while running.
- This is an On-Demand Instance, meaning you are charged only when it's running.
- When you no longer need it, you can stop the instance to avoid charges.

- Key Pair: Use the key pair you created in the last chapter or create a new one.
- This key pair is very important, so keep it safe and secure.

- Network Settings: Keep everything as default.

- Storage: Set it to 8GB.

4. Launch the Instance
After completing the configurations, click on the Launch Instance button.
5. Checking the Instance
Once the instance is launched, go back to the AWS Console. You will see that your instance has been created.
Locate the Public IPv4 address, as we will use it to connect to the instance.

6. Connect to the Instance
Since the instance runs Linux, we will use SSH (Secure Shell) to securely connect to it.
This connection happens over port 22, so keep this in mind as we will discuss security groups in later chapters.
How to Connect to an EC2 Linux Instance Using SSH
Step 1: Locate Your Key Pair
When you launched your EC2 instance, you created or selected an SSH key pair (.pem
file).
This file is required to authenticate your connection.
Step 2: Find the Public IP Address of Your Instance
- Go to the AWS EC2 Dashboard.
- Click on Instances.
- Locate your instance and copy the Public IPv4 address.
Step 3: Connect Using SSH
Use the following command from your local machine (Mac, Linux, or Windows using WSL/Git Bash):
ssh -i /path/to/your-key.pem ec2-user@your-instance-ip
Example: In my case, the command would be:
ssh -i /Users/tungnguyen/development/dalabs-server.pem ec2-user@3.106.218.201

- Installing applications
- Setting up a VPN
- Deploying an application
In the upcoming chapters, we will explore more advanced configurations and security settings