DEV Community

Dharshinisri G
Dharshinisri G

Posted on • Edited on

AWS EC2 + IAM + S3: Using putty

🚀 AWS EC2 + IAM + S3: A Step-by-Step Guide

This guide will walk you through setting up an EC2 instance, configuring Putty, creating an IAM role, and uploading files to S3.


📌 Step 1: Launch an EC2 Instance

1️⃣ Open EC2 Dashboard

Navigate to the AWS ConsoleEC2 Dashboard.

EC2 Dashboard

2️⃣ Create an EC2 Instance

  • Click Launch Instance
  • Enter a name and select an OS

Launch Instance

Select OS

3️⃣ Create & Select a Key Pair

  • Generate a key pair for secure SSH access
  • Select the created key pair

Create Key Pair

Select Key Pair

  • Click Launch Instance 🚀

📌 Step 2: Configure Security Group & Connect

1️⃣ Configure Inbound Rules

  • Select your instance → SecuritySecurity Groups
  • Edit Inbound Rules to allow SSH (Port 22)

Security Group

Edit Inbound Rules

2️⃣ Connect to Instance

  • Select the instance → ConnectSSH Client

Connect to EC2


📌 Step 3: Install & Use Putty

1️⃣ Install Putty

Download and install Putty from here.

Install Putty

2️⃣ Convert .pem to .ppk

  • Open PuttyGen
  • Click Load → Select .pem file
  • Save the private key (.ppk)

3️⃣ Connect to EC2 via Putty

  • Open Putty
  • Copy and paste Public IP in the Host field
  • Go to SSH → Auth → Credentials
  • Browse and select the .ppk file

Putty Connection

Putty Authentication

  • Click Open and login as:
ec2-user
Enter fullscreen mode Exit fullscreen mode

Login


📌 Step 4: Create an IAM Role

1️⃣ Open IAM Dashboard

  • Navigate to AWS IAM DashboardRoles

IAM Roles

2️⃣ Create a New IAM Role

  • Select Create Role
  • Attach AmazonS3FullAccess permission policy

Create IAM Role

S3 Full Access

  • Name and create the IAM Role

IAM Role Name

3️⃣ Attach IAM Role to EC2

  • Select Modify IAM Role → Attach the created IAM role

Attach IAM Role

IAM Role Name


📌 Step 5: Upload a File to S3

1️⃣ Create a Text File in EC2

Run the following command in Putty:

echo "This is a test file" > testfile.txt
Enter fullscreen mode Exit fullscreen mode

Create File

2️⃣ Upload File to S3

aws s3 cp testfile.txt s3://your-bucket-name/
Enter fullscreen mode Exit fullscreen mode

Upload to S3

3️⃣ Verify Upload in S3

Check your S3 bucket to confirm the file is uploaded successfully.

File Uploaded


🎯 Conclusion

Congratulations! 🎉 You have successfully:
✅ Launched an EC2 instance
✅ Connected via Putty
✅ Created and attached an IAM role
✅ Uploaded a file to S3

This guide provides a simple yet comprehensive way to manage EC2, IAM, and S3 effectively.

💬 Got questions? Let me know in the comments! 🚀

Top comments (0)