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.

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.

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.

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.

Leave a comment