How to write IAM Policies in AWS.

So lot of theory done on AWS IAM Policies, In this tutorial we’re going to do our hands dirty and write IAM Policies in JSON from Scratch. If you haven’t seen What are IAM Policies in AWS, I would strong recommend to give it a look and then start this.

So let’s get started.

Navigate to IAM, Click on Policies, Tap on Create Policies.

Create Policies
Create Policies

Tap next and click on Json Editor.

In this Policy we’re going to give Full Access to EC2.

In the Json Editor type

{
 "Version": "2012-10-17",
   "Statement": [
     {
      "Effect": "Allow",
      "Action": "ec2:*", 
      "Resource": ""
       }
     ]
}

Now click on Next and Enter the details as shown below. Enter Policy name and description.

Policy
Policy

Click on create Policy, policy will be created.

Navigate to Policies, tap on Filter Policies and Select Customer Managed Policy, you should see your policy listed.

Policy-Customer Created.
Policy-Customer Created.

Now you can create Users/Role and attached the Policy which you’re created.

Now let’s create on more Policy, to give user access to create and delete specific bucket “nucleargeeks”

{
 "Version": "2012-10-17",
   "Statement": [
     {
      "Effect": "Allow",
      "Action": "s3:*", 
      "Resource": ["arn:aws:s3:::nucleargeeks","arn:aws:s3:::nucleargeeks/*"]      
      }
     ]
}

So this is how we create Policies in AWS. Do comment out if you have any queries or questions.



Categories: AWS

Tags: , , , , , ,

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: