5 minutes
Note: In cloud we use “Principle of Least Privilage” which says, don’t give more permission than a user requires.
Here is a good sample policy:
{
"Id" : "S3-Account-permission", //Id is optional
"Version" : "2023-05-17", //Policy Language Version
"Statement": [ // A statement field is mandatory and consists of one or more individual statements
{
"Effect" : "Allow",
"Action" : "ec2:Describe",
"Resource": "*"
},
{
"sid" : "1", //Sid is Statement ID and is optional
"Effect" : "Allow", //Effect can be: Allow/Deny
"Action" : "elasticloadbalancing:Describe",
"Resource" : "*"
},
{
"Effect" : "Allow",
"Action" : [ //Action can also be an array
"cloudwatch:ListMetrics",
"cloudwatch:GetMetricsStatistics",
"cloudwatch:Describe*"
]
"Resource": "*"
},
{
"sid" : "2",
"Effect" : "Allow",
"Principal" : {
"AWS" : ["arn:aws:iam::123456789012:root"]
},
"Action" : [
"s3:getObject",
"s3:putObject"
],
"Resource": ["arn:aws:s3::mybucket/*"]
}
]
}
Please do not be intimidated by the above monstrosity, you will get used to it once you understad what everything does. Here is an explaination of all the items in the Policy:
| Item | Explaination |
|---|---|
| sid | Identifier for Statement |
| Effect | Wheather the statement allows/denies access (Allow/Deny) |
| Principal | Account/User/Role to which policy is being applied to |
| Action | List of action, this policy allows or denies |
| Resource | List of Resource to which action is applied to |
| Condition | Condition for when the policy is in effect |
User has access to your account & can possibly configure or delete resources in your AWS account. You want to protect your root account & IAM users. MFA = Password you know + Security Device you own.
MFA supports the following MFAs:
To Access AWS, you have 3 options:
ACCESS_KEYS are generated using AWS Console and User manage their own access keys.
Word of Warning : DO NOT SHARE ACCESS KEYS PLZ.!!