🚀 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 Console → EC2 Dashboard.
2️⃣ Create an EC2 Instance
- Click Launch Instance
- Enter a name and select an OS
3️⃣ Create & Select a Key Pair
- Generate a key pair for secure SSH access
- Select the created key pair
- Click Launch Instance 🚀
📌 Step 2: Configure Security Group & Connect
1️⃣ Configure Inbound Rules
- Select your instance → Security → Security Groups
- Edit Inbound Rules to allow SSH (Port 22)
2️⃣ Connect to Instance
- Select the instance → Connect → SSH Client
📌 Step 3: Install & Use Putty
1️⃣ Install Putty
Download and install Putty from here.
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
- Click Open and login as:
ec2-user
📌 Step 4: Create an IAM Role
1️⃣ Open IAM Dashboard
- Navigate to AWS IAM Dashboard → Roles
2️⃣ Create a New IAM Role
- Select Create Role
- Attach AmazonS3FullAccess permission policy
- Name and create the IAM Role
3️⃣ Attach IAM Role to EC2
- Select Modify IAM Role → Attach the created IAM role
📌 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
2️⃣ Upload File to S3
aws s3 cp testfile.txt s3://your-bucket-name/
3️⃣ Verify Upload in S3
Check your S3 bucket to confirm the file is uploaded successfully.
🎯 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)