AWS Managed Policies
- Policies given aws by default are referred as Managed Policies
- These are generic policies created and managed by aws
AWS Customer Managed Policies
- These are custom policies defined by AWS USers for custom permissions.
- To Create Policies we need to understand
- Service
- Resource
- Actions
- Refer Here for the Actions, services and condition keys
- Lets try to give an access to testers to start and stop ec2 instances
- To start and stop ec2 user should be able to view ec2 instances
- The actions which we have sorted are
- StartInstances
- StopInstances
- DescribeInstances
- Resources in this case is any ec2
- Lets create a custom iam policy
- Choose service
ec2
and then actions
- Now lets assign this to testers group
- Now lets login in and test the access
- This user will be able to view, start and stop ec2 instances
- The policy which we created from ui creates a json file
json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ec2:DescribeInstances",
"ec2:StartInstances",
"ec2:StopInstances"
],
"Resource": "*"
}
]
}
Try Creating an iam policy for
- any s3 bucket read, delete
- any ec2 view and terminate ec2 instances
Next Steps
- Write policies in JSON
- Use Simulator to test the policies
- Exercise: Refer Here