Skip to content

Instantly share code, notes, and snippets.

@jobbin
Created July 24, 2016 14:30
Show Gist options
  • Save jobbin/0965e0bab99eec4c1bf16258317cacad to your computer and use it in GitHub Desktop.
Save jobbin/0965e0bab99eec4c1bf16258317cacad to your computer and use it in GitHub Desktop.
バケットポリシーを使ったS3 Bucketへのアクセス制御について ref: http://qiita.com/jobbin/items/b861d000426aa1e96880
{
"Version": "2012-10-17",
"Id": "Policy146935390****",
"Statement": [
{
"Sid": "Stmt146935390****",
"Effect": "Deny",
"Principal": {
"AWS": "arn:aws:iam::2847****1948:user/test-user1"
},
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::jobbin-key"
}
]
}
{
"Version": "2012-10-17",
"Id": "Policy146935390****",
"Statement": [
{
"Sid": "Stmt146935390****",
"Effect": "Deny",
"NotPrincipal": {
"AWS": "arn:aws:iam::2847****1948:user/test-user1"
},
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::jobbin-key"
}
]
}
{
"Version": "2012-10-17",
"Id": "Policy146935390****",
"Statement": [
{
"Sid": "Stmt146935390****",
"Effect": "Deny",
"NotPrincipal": {
"AWS": "arn:aws:iam::2847****1948:role/test-assumerole"
},
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::jobbin-key"
}
]
}
{
"Version": "2012-10-17",
"Id": "Policy146927794****",
"Statement": [
{
"Sid": "Stmt146927793****",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::jobbin-key",
"Condition": {
"StringNotLike": {
"aws:userid": "AROAISXGEH----G266U2S:*"
}
}
}
]
}
$ aws iam get-role --role-name test-assumerole
{
"Role": {
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::8918****5875:root"
}
}
]
},
"RoleId": "AROAISXGEH----G266U2S",
"CreateDate": "2016-07-24T11:31:00Z",
"RoleName": "test-assumerole",
"Path": "/",
"Arn": "arn:aws:iam::2847****1948:role/test-assumerole"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment