IAM-Create a resource based policy and attach to S3_B16 Bucket & only sunny user can able to access that bucket
1. Create a resource based policy and attach to S3_B16 Bucket & only sunny user can able to access that bucket
1. Go to S3
service
2. Select bucket S3_B16 --> select
Permissions tab
3. Go to Bucket policy section
4. Click on edit and copy paste the below Jason code and
save
make changes “YOUR_ACCOUNT_ID” with you aws account id and bucket name
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::YOUR_ACCOUNT_ID:user/sunny"
},
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::S3_B16",
"arn:aws:s3:::S3_B16/*"
]
},
{
"Effect": "Deny",
"NotPrincipal": {
"AWS": "arn:aws:iam::YOUR_ACCOUNT_ID:user/sunny"
},
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::S3_B16",
"arn:aws:s3:::S3_B16/*"
]
}
]
}


Comments
Post a Comment