IAM JSON Policy Grammar
- Refer Here for official documentation
- IAM Policy Basic structure would be
{
"Version": ("2008-10-17" | "2012-10-17")
"Id": <policy id string>
"Statement": [
<statement-1>,
<statement-2>
..
..
<statement-n>
]
}
- Statement structure would be
{
"Sid": <sid_string>,
"Effect": ("Allow" | "Deny")
"Principal": {
<principal map entry>,
...
<principal map entry>
},
"NotPrincipal": {
<principal map entry>,
...
<principal map entry>
},
"Action": [
<actionstring>
]
}
IAM Json Policy Elements
- Version: This element specifies the language syntax rules
"Version": "2012-10-17"
Amazon Resource Name (ARNs)
Lets find the ARN for s3 bucket
- Sample bucket

- Documentation Refer Here
- From documentation the format is

- So the ARN for S3 bucket mentioned above would be
arn:aws:s3:::referenceappkhaja
Now lets find the ARN for EC2 instance
- Sample ec2 instance

- Refer Here
- To find arn for ec2 instance follow the navigation as shown below

- My format of ARN is
arn:${Partition}:ec2:${Region}:${Account}:instance/${InstanceId}
${Partition} = aws
${Region} = us-west-2
${Account} = <your account id>
${InstanceId} = i-0a08c4b370aaabb42
arn:aws:ec2:us-west-2:<your-account-id>:instance/i-0a08c4b370aaabb42
Now lets find the ARN for EBS Volume
- Sample Volume

- We found this format

- Now find ARN for AWS RDS instance

- Now lets find ARN for AWS IAM USER

Next Steps
- On Resources we can perform actions and when we define IAM policy we have to create authorization to some user to allow all actions or some actions or deny all actions or deny some actions.
- For that we need to understand actions available in Resources, to make our policy effective.