Launching Your First Instance
Head to the EC2 dashboard and click the big orange "Launch Instance" button. You'll be guided through a step-by-step wizard. Let's walk through each step together.
First, give your instance a name — something descriptive like "my-first-server" so you can find it later. Names make life easier when you have dozens of instances running.
Choosing an AMI and Instance Type
Select Amazon Linux 2 or Ubuntu Server as your AMI — both are free-tier eligible and beginner-friendly. Then pick t2.micro as your instance type since it's free for 12 months.
The AMI is your operating system. Amazon Linux 2 is AWS's own flavor, while Ubuntu is a popular community choice. Either works great — pick whichever you're more comfortable with.
Configuring Security Groups
A security group is like a bouncer for your server. It controls who can talk to your instance and on which ports. By default, SSH (port 22) is open so you can connect remotely.
For a web server, you'd also open ports 80 (HTTP) and 443 (HTTPS). For now, keep the defaults — SSH only. We'll cover security groups in more detail later. Always remember: open only what you need.
Creating and Using a Key Pair
During launch, AWS will ask you to select or create a key pair. Create a new one, give it a name, and download the .pem file. This file is your only way to log in — guard it with your life.
On Linux or Mac, set proper permissions before using it:
chmod 400 my-key.pem
On Windows, you'll convert the .pem to a .ppk file using PuTTYgen, or use the AWS EC2 Instance Connect feature for browser-based access.
Connecting to Your Instance
Once the instance is running, select it and click "Connect." If you're using Amazon Linux 2, the connection command looks like this:
ssh -i "my-key.pem" ec2-user@your-public-ip
Replace "my-key.pem" with your key file name and "your-public-ip" with the instance's public IP address. If everything is set up correctly, you'll see a welcome message and a command prompt. Congratulations — you now have a server in the cloud!