
Part 04: Launch Your First EC2 Instance on AWS – A Complete Beginner's Guide
Ready to launch your first cloud server? Learn how to create an Amazon EC2 instance step by step, choose an operating system, configure security settings, connect to your virtual machine, and understand the basics of cloud server management.
Series: AWS Zero to Cloud Builder (8 articles)
- …
- 3Part 04: Launch Your First EC2 Instance on AWS – A Complete Beginner's Guide This article
Part 04: Launch Your First EC2 Instance on AWS – A Complete Beginner's Guide
Have you ever wanted to run your own server without purchasing a physical computer?
What if you could create a virtual server in just a few minutes and access it from anywhere?
That's exactly what Amazon EC2 allows you to do!
In our previous articles, we explored AWS, created our first AWS account, and learned about AWS Regions and Availability Zones.
Now it's time to get practical.
In this article, we'll learn how to launch our first Amazon EC2 instance, understand its configuration, explore security settings, and connect to our cloud server.
Don't worry if you're a complete beginner. We'll go through everything step by step.
Let's get started!
1. What Is Amazon EC2?
Amazon EC2 stands for Amazon Elastic Compute Cloud.
It is an AWS service that allows you to create and manage virtual servers in the cloud.
These virtual servers are called EC2 Instances.
Think of an EC2 instance as a computer that runs in an AWS data center instead of sitting on your desk.
Just like your personal computer, an EC2 instance has:
- CPU for processing.
- RAM for running applications.
- Storage for saving data.
- An operating system.
- Network connectivity.
You can use an EC2 instance to host websites, run applications, develop software, manage databases, and perform many other computing tasks.
Why Do Developers Use Amazon EC2?
Here are some important benefits:
1. Scalability
You can choose different instance sizes depending on your application's requirements.
2. Flexibility
You can select operating systems such as Linux or Windows and configure your server according to your needs.
3. Pay for Usage
EC2 offers different pricing options. Depending on the instance and pricing model, you generally pay for the compute capacity you use.
4. Global Availability
You can launch instances in supported AWS Regions around the world.
5. Control
You have control over the operating system, software, applications, and server configuration.
2. Important EC2 Concepts You Should Know
Before launching your first instance, let's understand a few important terms.
1. Amazon Machine Image (AMI)
An AMI is a template used to launch an EC2 instance.
It contains the operating system and other software configurations needed to start your virtual server.
For example, you can choose an Amazon Linux AMI or a Windows Server AMI.
Think of an AMI as the starting blueprint for your virtual machine.
2. Instance Type
An instance type determines the computing resources available to your virtual server.
It defines the amount of CPU, memory, networking capacity, and other resources.
Different instance types are designed for different workloads.
For beginners, a small general-purpose instance that is eligible under their AWS account's current Free Tier benefits is a sensible starting point.
3. Key Pair
A key pair is used to securely authenticate when connecting to an EC2 instance.
It consists of:
- Public Key
- Private Key
AWS stores the public key on the instance, while you keep the private key.
Never share your private key with anyone.
4. Security Group
A Security Group acts like a virtual firewall for your EC2 instance.
It controls which network traffic is allowed to reach your server and which outbound traffic is allowed.
For example:
- SSH (Port 22): Used to connect to Linux servers.
- RDP (Port 3389): Used to connect to Windows servers.
- HTTP (Port 80): Used for regular web traffic.
- HTTPS (Port 443): Used for secure web traffic.
You should only allow the network traffic that your application actually needs.
5. EBS Storage
Amazon Elastic Block Store (EBS) provides block storage for EC2 instances.
You can think of it as the virtual hard drive of your cloud server.
It stores your operating system, applications, and files.
3. What Do You Need Before Launching an EC2 Instance?
Before starting, make sure you have:
- An active AWS account.
- Access to the AWS Management Console.
- An administrative identity with the required EC2 permissions.
- Basic knowledge of the AWS Management Console.
- An understanding of your account's available Free Tier credits and usage limits.
Important: AWS account plans, eligible instance types, and available credits can vary. Always check the current pricing and eligibility displayed in your AWS account before launching anything.
4. How to Launch Your First EC2 Instance
Now comes the practical part!
Follow these steps to create your first cloud server.
Step 1: Open the AWS Management Console
Visit:
Sign in to your AWS account.
Once you're inside the console, use the search bar at the top and search for:
EC2 Select Amazon EC2 from the search results.
You will now enter the EC2 Dashboard.
Step 2: Click on Launch Instance
On the EC2 Dashboard, find the Launch instance option.
Click it to open the instance configuration page.
This page allows you to configure your virtual server before launching it.
Step 3: Give Your Instance a Name
Under the Name and tags section, enter a name for your instance.
For example:
My-First-EC2-Instance Naming your instance is optional, but it helps you identify your resources when managing multiple servers.
Step 4: Choose an Operating System
Now find the section called:
Application and OS Images (Amazon Machine Image)
Here, you can select the operating system for your virtual server.
For your first Linux instance, I recommend exploring Amazon Linux.
Choose an Amazon Linux image from the Quick Start options.
Make sure you check the AMI details and its eligibility for your account before continuing.
Step 5: Select an Instance Type
Next, find the Instance Type section.
This determines how much computing power your virtual server will have.
For a beginner experiment, choose a small general-purpose instance type that is eligible under your current AWS Free Tier benefits.
Do not select a larger or expensive instance type just for learning.
Step 6: Create a Key Pair
Now you'll see the Key Pair (login) section.
Click on Create new key pair if you don't already have one.
Enter a name such as:
my-first-ec2-key Select the appropriate key pair type and private key file format supported by your connection method.
For a typical Linux SSH connection from Windows, the .pem format is a common choice.
Click Create key pair.
Your private key file will be downloaded to your computer.
Very important:
- Keep your private key safe.
- Never upload it to GitHub.
- Never share it publicly.
- Don't delete it if you still need it to connect to your instance.
Step 7: Configure Network Settings
Next, open the Network Settings section.
Here you can configure how your instance communicates with the internet and other resources.
For a basic Linux learning setup:
- Choose an appropriate VPC and subnet.
- Enable a public IP only if you need direct internet connectivity.
- Create or select a Security Group.
- Allow SSH access only from your own IP address.
Avoid selecting SSH access from Anywhere (0.0.0.0/0) for a real server because it exposes the SSH port to the entire internet.
For this beginner exercise, keep your network configuration simple and secure.
Step 8: Configure Storage
Now you'll reach the Configure Storage section.
AWS provides a root storage volume for your instance.
This is where your operating system and other required files are stored.
For your first experiment, the default storage configuration is generally sufficient.
Before changing storage settings, check the applicable EBS pricing and your account's usage limits.
Step 9: Review Your Configuration
Before launching the instance, carefully review your settings.
Check the following:
- Instance name.
- Operating system.
- Instance type.
- Key pair.
- Network configuration.
- Security Group.
- Storage.
Also review the estimated costs and Free Tier eligibility.
Once everything looks correct, click:
Launch instance
Congratulations! AWS will now start creating your virtual server.
5. How to Check Whether Your EC2 Instance Is Running
After launching your instance, AWS will show a success notification.
Click View all instances or open Instances from the EC2 navigation menu.
You should now see your newly created instance.
Look at the Instance State column.
Initially, it may show:
Pending After the instance starts successfully, it should change to:
Running You can also check the Status Checks tab to verify whether the instance has passed its health checks.
Your first EC2 instance is now running!
6. How to Connect to Your EC2 Instance
Launching a server is only half the work. Now let's learn how to access it.
For this example, we'll use a Linux EC2 instance.
Using EC2 Instance Connect
If your instance and account meet the requirements for EC2 Instance Connect, you can connect directly through your browser.
Follow these steps:
- Open the EC2 Dashboard.
- Select Instances.
- Select your running EC2 instance.
- Click Connect.
- Open the EC2 Instance Connect tab.
- Choose the appropriate connection option.
- Verify the username, commonly
ec2-userfor Amazon Linux.
- Click Connect.
If the configuration is correct, a browser-based terminal will open.
You are now connected to your Linux cloud server!
Try Your First Linux Commands
Once connected, try these basic commands:
Check the current user:
whoami Display the current directory:
pwd Show files and folders:
ls Check system information:
uname -a Check disk usage:
df -h These commands will help you become familiar with your new Linux environment.
7. Understanding Your EC2 Instance Details
After launching an instance, AWS provides several useful details.
Here are some important ones:
Instance ID
Every EC2 instance receives a unique identifier.
For example:
i-0123456789abcdef0 This helps AWS identify your instance.
Public IPv4 Address
This is the public IP address assigned to your instance, if configured.
It can be used to reach your instance over the internet when the network and security settings permit it.
Private IPv4 Address
This is the internal IP address used for communication within the private network.
Instance State
This tells you whether your instance is pending, running, stopped, shutting down, or terminated.
Instance Type
This shows the computing configuration selected for your virtual server.
Explore these details in the EC2 console. Understanding them will help you manage your cloud resources more confidently.
8. Important: How to Avoid Unexpected AWS Charges
This is one of the most important sections of this tutorial.
Many beginners launch an EC2 instance for learning and forget to manage it afterward.
Remember that a running EC2 instance can incur charges even when you are not actively using it.
Here are some important precautions:
- Check your AWS Free Tier eligibility and available credits.
- Choose an eligible, low-cost instance type.
- Monitor your resource usage.
- Check EBS storage charges.
- Review your billing dashboard.
- Delete resources that you no longer need.
Stop vs Terminate: What's the Difference?
These two options are very important.
Stop Instance
Stopping an instance shuts down its compute activity.
You can generally start it again later.
However, attached EBS storage can continue to incur charges. Other resources, such as public IPv4 addresses, may also have separate charges.
Terminate Instance
Terminating an instance permanently deletes that EC2 instance.
You cannot start it again after termination.
Depending on your EBS deletion settings, attached storage may also be deleted.
Before terminating an instance, back up any data you want to keep.
My Recommendation
If you are only experimenting and don't need the server anymore, terminate it after checking that you have saved anything important and removed any resources you no longer need.
This is a good habit for every beginner working with AWS.
9. Your First EC2 Learning Challenge
Now it's your turn!
Try completing this small practical challenge:
- Open the AWS Management Console.
- Find Amazon EC2.
- Launch a small eligible Linux instance.
- Give your instance a meaningful name.
- Create and download a key pair.
- Configure SSH access securely.
- Check the instance state.
- Connect using EC2 Instance Connect, if supported.
- Run the
whoamiandpwdcommands.
- Stop or terminate your instance when you're finished.
Don't worry if something takes a little time.
The goal is to understand how virtual servers work and become comfortable using the AWS Console.
Conclusion
Congratulations! You've now learned the basics of launching your first Amazon EC2 instance.
We explored what EC2 is, how AMIs and instance types work, why key pairs and Security Groups are important, and how to launch and connect to a virtual server.
Amazon EC2 is one of the most useful services to understand when starting your cloud computing journey.
It gives developers the ability to run applications, host websites, and manage virtual servers without purchasing physical hardware.
Remember, don't just read about cloud computing. Try it, experiment with it, and learn from the experience.
Your first cloud server is the beginning of something bigger!
What's Next?
In the next article of our AWS Zero to Cloud Builder series, we'll explore another important AWS service.
Part 05: How to Host a Website Using Amazon S3 – A Beginner's Practical Guide
We'll learn how to upload website files to Amazon S3, configure static website hosting, and make a simple website accessible online.
Keep learning, keep experimenting, and keep building! 🚀
Series: AWS Zero to Cloud Builder (8 articles)
- …
- 3Part 04: Launch Your First EC2 Instance on AWS – A Complete Beginner's Guide This article
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article