chore(kb/aws): iam policy example

This commit is contained in:
Michele Cereda
2024-04-24 19:10:19 +02:00
parent 3edb6b8757
commit dc2b5a3f00
2 changed files with 42 additions and 0 deletions

View File

@@ -10,6 +10,7 @@
1. [Security Hub](#security-hub)
1. [Resource constraints](#resource-constraints)
1. [Access control](#access-control)
1. [IAM policies](#iam-policies)
1. [Further readings](#further-readings)
1. [Sources](#sources)
@@ -170,6 +171,44 @@ From [Using service-linked roles]:
> Service-linked roles appear in your AWS account and are owned by the service. An IAM administrator can view, but not
> edit the permissions for service-linked roles.
### IAM policies
Examples:
<details>
<summary>Give a user temporary RO access to a bucket</summary>
```json
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Principal": {
"AWS": [
"arn:aws:iam::012345678901:user/my-user"
],
},
"Action": [
"s3:GetObject",
"s3:GetObjectAttributes",
"s3:ListBucket",
"s3:ListBucketVersions",
],
"Resource": [
"arn:aws:s3:::my-bucket",
"arn:aws:s3:::my-bucket/*",
],
"Condition": {
"DateLessThan": {
"aws:CurrentTime": "2024-03-01T00:00:00Z",
},
},
}],
}
```
</details>
## Further readings
- [EC2]

View File

@@ -63,6 +63,9 @@ aws s3 sync '.' 's3://arn:aws:s3:us-west-2:123456789012:accesspoint/myaccesspoin
# Delete buckets.
aws s3 rb 's3://my-bucket'
aws s3 rb 's3://my-bucket' --force
# Check permissions.
aws s3api get-bucket-acl --bucket 'my-bucket'
```
</details>