DEV Community

Cover image for šŸš€ How I Launched My First EC2 Instance on AWS (A Beginner's Guide)
Kaustav Dey
Kaustav Dey

Posted on

šŸš€ How I Launched My First EC2 Instance on AWS (A Beginner's Guide)

Cloud computing can feel intimidating at firstā€Š-ā€Šall the talk of regions, instances, VPCs, and security groups might seem like another language. But launching an EC2 instance on AWS? Surprisingly simple.
In this post, I'll walk you through how I created a basic EC2 instance, what I learned along the way, and how you can do it tooā€Š-ā€Ševen if you're using Windows with PuTTY to connect.


🧠 What is an EC2 Instance?

Amazon EC2 (Elastic Compute Cloud) is a virtual server in Amazon's cloud. You can use it to host websites, run code, experiment with server setups, or even train ML models.
Think of it like renting a computer in the cloudā€Š-ā€Šyou control everything about it.


**

šŸ› ļø Step-by-Step: How I DidĀ It

**
1. Logged into AWSĀ Console
First, I signed in to the AWS Management Console. If you don't have an account, sign up at aws.amazon.com.
2. Navigated to EC2 Dashboard
From the AWS Services menu, I selected EC2. This took me to the EC2 Dashboard, where I could manage instances, volumes, security groups, and more.
3. Clicked "Launch Instance"
On the dashboard, there's a big blue button: Launch Instance. That's where it begins.
4. Configured theĀ Instance

Here's what I chose:

  • Name: my-first-ec2
  • Amazon Machine Image (AMI): Amazon Linux 2 (free-tier eligible)

Image description

  • Instance Type: t2.micro (1 vCPU, 1GB RAM – perfect for starters)
  • Key Pair: I created a new key pair and downloaded theĀ .pem file for SSH access.
  • Network Settings: I allowed SSH (port 22) so I could log in remotely.

5. LaunchedĀ It
Clicked "Launch Instance" and waited ~30 seconds. Boomā€Š-ā€Šmy first cloud server was live!


šŸ”’ Setting Up Security Groups (Allowing InboundĀ Traffic)

One of the most important steps was configuring inbound traffic via a security group. A security group acts like a virtual firewall, controlling traffic to and from your instance.

For inbound rules, I allowed SSH (port 22) from my IP address only so I could connect to the instance securely via PuTTY. I also enabled HTTP (port 80) and HTTPS (port 443) from anywhere (0.0.0.0/0) to allow future web traffic to reach the server, in case I want to host a website or run a web app. This setup ensures I can access the server securely while also keeping the door open for standard web traffic.

Image description

šŸ’” WhyĀ These?
SSH lets me connect to the instance remotely.
HTTP & HTTPS are needed if I plan to host any kind of web content or server.

āš ļø Tip: Restrict SSH access to your IP for security._ Never leave port 22 open to the world unless absolutely necessary.

_

🚪 Launched the Instance
Once the security group was configured, I clicked Launch Instance and within 30 seconds, I had my cloud server running.


šŸ” Connecting to the EC2 Instance on Windows usingĀ PuTTY

Since I was using a Windows system, I connected to my instance using PuTTY, a free SSH client.

Here's what I did:

  • Converted theĀ .pem file toĀ .ppk:
  • Downloaded and opened PuTTYgen.
  • Clicked Load, selected theĀ .pem file.
  • Clicked Save private key and saved the file as my-key.ppk.

Opened PuTTY and entered connection details:

  • Host Name (or IP address): ec2-user@
  • In the left menu, under Connection > SSH > Auth, I browsed to the my-key.ppk file.

Connected:

  • Clicked Open and accepted the SSH security prompt.
  • I was now logged into my EC2 instance via the command line!

Image description


🧼 Cleaning Up (IMPORTANT!)
After testing, I stopped and terminated the instance to avoid unexpected charges. Always shut down resources you're not using.


šŸ’” What IĀ Learned

  1. Cloud isn't as scary as it seems.
  2. AWS gives you a lot of controlā€Š-ā€Šwhich means you must manage it responsibly.
  3. On Windows, PuTTY and PuTTYgen are your best friends for connecting via SSH.
  4. Always save your private key fileā€Š-ā€Šand never share it.

5.

🧭 What's Next?

  1. Hosting a static website using EC2.(Wair, alreday did thatĀ , check it outĀ :https://medium.com/@deykaustav357/how-i-made-my-first-static-website-using-amazon-s3-as-an-aws-beginner-476a9232f360 )
  2. Attaching an EBS volume for persistent storage.
  3. Learning about AMIs and how to create custom images.

šŸŽÆ FinalĀ Thoughts
Launching an EC2 instance is like a rite of passage in the cloud world. It's the gateway to a huge universe of cloud computing possibilities.
If you've been hesitant, just try itā€Š-ā€ŠAWS's free tier gives you 750 hours/month of t2.micro usage. Play, break things, and learn.

If I can do it, so can you.

Top comments (0)