π 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)