May 2024

How I used AWS IAM to enhance security in my cloud environment

create bucket screenshot

In this project, I learned how to:

Step 1: Lauch 2 EC2 instances

I've set up two EC2 instances, one with the tag of "development" and one with "production" to test the effectiveness of the permission settings.

create bucket screenshot create bucket screenshot

Key notes ✏️:

What is EC2 instance?

A legendary AWS service! Amazon EC2 is a service that lets user to rent and use virtual computers in the cloud. They're like your personal computers, but they live on the internet instead of being physically in front of you.

An instance is a computer/server that gets produced by EC2. Just like when you buy a laptop, with EC2 instances, you can pick a virtual computer that fits what you need for your projects. You can customise your EC2 instance's CPU, memory, storage, and networking capacity and more!

What is the tag for?

Tags helps us with identifying all resources with the same tag at once (they are useful filters when you're searching for something), cost allocation, and applying policies based on environment types.

Step 2: Set Up IAM Policies

IAM stands for Identity and Access Management and IAM Policy is about giving permissions to IAM users, groups, or roles, saying what they can or can't do on certain resources, and when those rules kick in.

screenshot of IAM JSON policy

Step 3: Create IAM User and User Group

Here I created a new user group and then a new user to add to the group.

screenshot of create group panel screenshot of create user panel

Step 4: Test IAM access for the User you've created.

screenshot of red banner showing fail to stop instance screenshot of policy simultor link screenshot of policy simultor panel

An error I ran into was...👀

When I was testing the access, I noticed that the action permission to the development EC2 instance wasn't act as expected. I checked my instance and policy again and noticed that I set the first letter in capital in the tag which is different from the policy JSON file that caused the issue.

What I leart from the error ✏️:

Make sure the tag name matches the policy in a case sensitive manner!



Big thanks to @NextWork for setting up this engaging challenge!