概要
IAMユーザーにS3バケットに対するユーザーポリシーを設定します。
特定のバケット(hoge1, hoge2)だけ読み書きを許可する
IAM_User_Policy
{
"Statement": [
{
"Action": "s3:ListAllMyBuckets",
"Effect": "Allow",
"Resource": "arn:aws:s3:::*"
},
{
"Action": "s3:*",
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::hoge1",
"arn:aws:s3:::hoge1/*",
"arn:aws:s3:::hoge2",
"arn:aws:s3:::hoge2/*"
]
}
]
}
特定のバケット(hoge1, hoge2)以外読み書き許可する
IAM_User_Policy
{
"Statement": [
{
"Action": "s3:ListAllMyBuckets",
"Effect": "Allow",
"Resource": "arn:aws:s3:::*"
},
{
"Action": "s3:*",
"Effect": "Allow",
"NotResource": [
"arn:aws:s3:::hoge1",
"arn:aws:s3:::hoge1/*",
"arn:aws:s3:::hoge2",
"arn:aws:s3:::hoge2/*"
]
}
]
}
特定のバケット(hoge1, hoge2)だけ書き込みのみを許可する
IAM_User_Policy
{
"Statement": [
{
"Action": "s3:ListAllMyBuckets",
"Effect": "Allow",
"Resource": "arn:aws:s3:::*"
},
{
"Action": [
"s3:PutObject",
"s3:PutObjectAcl"
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::hoge1",
"arn:aws:s3:::hoge1/*",
"arn:aws:s3:::hoge2",
"arn:aws:s3:::hoge2/*"
]
}
]
}