I have a task to create an S3 bucket named "xyz" and give Read-Write access to particular users. I have created the bucket and wrote an IAM policy like the following and attached it to specific users.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:GetObjectVersion",
"s3:GetBucket"
],
"Resource": [
"arn:aws:s3:::xyz",
"arn:aws:s3:::xyz/*"
]
},
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": "s3:ListAllMyBuckets",
"Resource": "*"
}
]
}
Now I have to apply another condition, that is restricting access to this bucket to a particular VPC. For that I have to write a bucket policy.
While trying to generate the bucket policy using policy generator it's again asking for actions on the S3 bucket.
If I select all the actions i.e, s3:* will it be giving all the access to the users?
I want to know which policy takes the precedence.