

# ポリシー概要の例
<a name="access_policies_policy-summary-examples"></a>

以下の例には、JSON ポリシーと共に、関連する[ポリシー概要](access_policies_understand-policy-summary.md)、[サービス概要](access_policies_understand-service-summary.md)、[アクション概要](access_policies_understand-action-summary.md)が 含まれており、ポリシーを通じて付与されるアクセス許可を理解するのに役立ちます。

## ポリシー 1: DenyCustomerBucket
<a name="example1"></a>

このポリシーは、同じサービスに対する許可および拒否を示します。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "FullAccess",
            "Effect": "Allow",
            "Action": ["s3:*"],
            "Resource": ["*"]
        },
        {
            "Sid": "DenyCustomerBucket",
            "Action": ["s3:*"],
            "Effect": "Deny",
            "Resource": ["arn:aws:s3:::customer", "arn:aws:s3:::customer/*" ]
        }
    ]
}
```

------

***DenyCustomerBucket** ポリシー概要:*

![ポリシー概要のダイアログイメージ](http://docs.aws.amazon.com/ja_jp/IAM/latest/UserGuide/images/policies-summary-example1-dialog.png)


***DenyCustomerBucket S3 (Explicit deny)** サービス概要:*

![サービス概要のダイアログイメージ](http://docs.aws.amazon.com/ja_jp/IAM/latest/UserGuide/images/policies-summary-action-example1-dialog.png)


***GetObject (Read) **アクション概要:*

![アクション概要のダイアログイメージ](http://docs.aws.amazon.com/ja_jp/IAM/latest/UserGuide/images/policies-summary-resource-example1-dialog.png)


## ポリシー 2: DynamoDbRowCognitoID
<a name="policy_example2"></a>

このポリシーでは、ユーザーの Amazon Cognito ID に基づいて、行レベルで Amazon DynamoDB にアクセスできます。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "dynamodb:DeleteItem",
                "dynamodb:GetItem",
                "dynamodb:PutItem",
                "dynamodb:UpdateItem"
            ],
            "Resource": [
                "arn:aws:dynamodb:us-west-1:123456789012:table/myDynamoTable"
            ],
            "Condition": {
                "ForAllValues:StringEquals": {
                    "dynamodb:LeadingKeys": [
                        "${cognito-identity.amazonaws.com:sub}"
                    ]
                }
            }
        }
    ]
}
```

------

***DynamoDbRowCognitoID** ポリシー概要:*

![ポリシー概要のダイアログイメージ](http://docs.aws.amazon.com/ja_jp/IAM/latest/UserGuide/images/policies-summary-example2-dialog.png)


***DynamoDbRowCognitoID DynamoDB (Allow)** サービス概要:*

![サービス概要のダイアログイメージ](http://docs.aws.amazon.com/ja_jp/IAM/latest/UserGuide/images/policies-summary-action-example2-dialog.png)


***GetItem (List)** アクション概要:*

![アクション概要のダイアログイメージ](http://docs.aws.amazon.com/ja_jp/IAM/latest/UserGuide/images/policies-summary-resource-example2-dialog.png)


## ポリシー 3: MultipleResourceCondition
<a name="policy_example3"></a>

このポリシーには、複数のリソースと条件が含まれます。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:PutObject",
                "s3:PutObjectAcl"
            ],
            "Resource": ["arn:aws:s3:::Apple_bucket/*"],
            "Condition": {"StringEquals": {"s3:x-amz-acl": ["public-read"]}}
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:PutObject",
                "s3:PutObjectAcl"
            ],
            "Resource": ["arn:aws:s3:::Orange_bucket/*"],
            "Condition": {"StringEquals": {
                "s3:x-amz-acl": ["custom"],
                "s3:x-amz-grant-full-control": ["1234"]
            }}
        }
    ]
}
```

------

***MultipleResourceCondition** ポリシー概要:*

![ポリシー概要のダイアログイメージ](http://docs.aws.amazon.com/ja_jp/IAM/latest/UserGuide/images/policies-summary-example3-dialog.png)


***MultipleResourceCondition S3 (Allow)** サービス概要:*

![サービス概要のダイアログイメージ](http://docs.aws.amazon.com/ja_jp/IAM/latest/UserGuide/images/policies-summary-action-example3-dialog.png)


***PutObject (Write)** アクション概要:*

![アクション概要のダイアログイメージ](http://docs.aws.amazon.com/ja_jp/IAM/latest/UserGuide/images/policies-summary-resource-example3-dialog.png)


## ポリシー 4: EC2\_Troubleshoot
<a name="policy_example4"></a>

以下のポリシーでは、ユーザーは実行中の Amazon EC2 インスタンスのスクリーンショットを取得できます。このスクリーンショットは EC2 のトラブルシューティングに役立つ場合があります。このポリシーでは、Amazon S3 開発者バケット内のアイテムに関する情報の表示も許可されます。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "ec2:GetConsoleScreenshot"
            ],
            "Resource": [
                "*"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:ListBucket"
            ],
            "Resource": [
                "arn:aws:s3:::developer"
            ]
        }
    ]
}
```

------

***EC2\_Troubleshoot** ポリシー概要:*

![ポリシー概要のダイアログイメージ](http://docs.aws.amazon.com/ja_jp/IAM/latest/UserGuide/images/policies-summary-example4-dialog.png)


***EC2\_Troubleshoot S3 (Allow)** サービス概要:*

![サービス概要のダイアログイメージ](http://docs.aws.amazon.com/ja_jp/IAM/latest/UserGuide/images/policies-summary-action-example4-dialog.png)


***ListBucket (List)** アクション概要:*

![アクション概要のダイアログイメージ](http://docs.aws.amazon.com/ja_jp/IAM/latest/UserGuide/images/policies-summary-resource-example4-dialog.png)


## ポリシー 5: CodeBuild\_CodeCommit\_CodeDeploy
<a name="example6"></a>

このポリシーでは、特定の CodeBuild、CodeCommit、および CodeDeploy リソースへのアクセスを許可します。これらのリソースは各サービスに固有であるため、一致するサービスでのみ表示されます。いずれのサービスとも一致しないリソースを `Action` 要素の含めた場合、そのリソースはすべてのアクション概要に表示されます。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "Stmt1487980617000",
            "Effect": "Allow",
            "Action": [
                "codebuild:*",
                "codecommit:*",
                "codedeploy:*"
            ],
            "Resource": [
                "arn:aws:codebuild:us-east-2:123456789012:project/my-demo-project",
                "arn:aws:codecommit:us-east-2:123456789012:MyDemoRepo",
                "arn:aws:codedeploy:us-east-2:123456789012:application:WordPress_App",
                "arn:aws:codedeploy:us-east-2:123456789012:instance/AssetTag*"
            ]
        }
    ]
}
```

------

***CodeBuild\_CodeCommit\_CodeDeploy** ポリシー概要:*

![ポリシー概要のダイアログイメージ](http://docs.aws.amazon.com/ja_jp/IAM/latest/UserGuide/images/policies-summary-example6-dialog.png)


***CodeBuild\_CodeCommit\_CodeDeploy CodeBuild (Allow)** サービス概要:*

![サービス概要のダイアログイメージ](http://docs.aws.amazon.com/ja_jp/IAM/latest/UserGuide/images/policies-summary-action-example6-dialog.png)


***CodeBuild\_CodeCommit\_CodeDeploy StartBuild (Write)** アクション概要:*

![アクション概要のダイアログイメージ](http://docs.aws.amazon.com/ja_jp/IAM/latest/UserGuide/images/policies-summary-resource-example6-dialog.png)
