

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 的資源型政策範例 AWS Audit Manager
<a name="security_iam_resource-based-policy-examples"></a>

## Amazon S3 儲存貯體政策
<a name="s3-resource-policy"></a>

下列政策允許 CloudTrail 將證據搜尋工具的查詢結果傳遞到指定的 S3 儲存貯體。作為安全最佳實務，IAM 全域條件索引鍵 `aws:SourceArn` 有助於確保 CloudTrail 僅針對事件資料存放區寫入 S3 儲存貯體。

**重要**  
您必須為 CloudTrail Lake 查詢結果交付指定 S3 儲存貯體。如需詳細資訊，請參閱[指定 CloudTrail Lake 查詢結果的現有儲存貯體。 ](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/s3-bucket-policy-lake-query-results.html#specify-an-existing-bucket-for-cloudtrail-query-results-delivery)

以您自己的資訊取代*預留位置文字*，如下所示：
+ 將 *amzn-s3-demo-destination-bucket* 取代為您用作匯出目的地的 S3 儲存貯體。
+ 以 AWS 區域 適合您的組態取代 *myQueryRunningRegion*。
+ 將 *myAccountID* 取代為用於 CloudTrail 的 AWS 帳戶 ID。這可能與 S3 儲存貯體的 AWS 帳戶 ID 不同。如果這是組織事件資料存放區，您必須使用管理帳戶的 AWS 帳戶 。

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "Service": "cloudtrail.amazonaws.com"
            },
            "Action": [
                "s3:PutObject*",
                "s3:Abort*"
            ],
            "Resource": [
                "arn:aws:s3:::amzn-s3-demo-destination-bucket",
                "arn:aws:s3:::amzn-s3-demo-destination-bucket/*"
            ],
            "Condition": {
                "StringEquals": {
                    "aws:SourceArn": "arn:aws:cloudtrail:myQueryRunningRegion:myAccountID:eventdatastore/*"
                }
            }
        },
        {
            "Effect": "Allow",
            "Principal": {
                "Service": "cloudtrail.amazonaws.com"
            },
            "Action": "s3:GetBucketAcl",
            "Resource": "arn:aws:s3:::amzn-s3-demo-destination-bucket",
            "Condition": {
                "StringEquals": {
                    "aws:SourceArn": "arn:aws:cloudtrail:myQueryRunningRegion:myAccountID:eventdatastore/*"
                }
            }
        }
    ]
    }
```

------

## AWS Key Management Service 政策
<a name="kms-resource-policy"></a>

如果您的 S3 儲存貯體的預設加密設定為 `SSE-KMS`，請在 AWS Key Management Service 金鑰的資源政策中授予對 CloudTrail 的存取權，以便其可以使用金鑰。在此情況下，請將下列資源政策新增至 AWS KMS 金鑰。

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

****  

```
{
 "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "Service": "cloudtrail.amazonaws.com"
            },
            "Action": [
                "kms:Decrypt*",
                "kms:GenerateDataKey*"
            ],
            "Resource": "*"
        },
        {
            "Effect": "Allow",
            "Principal": {
                "Service": "s3.amazonaws.com"
            },
            "Action": [
                "kms:Decrypt*",
                "kms:GenerateDataKey*"
            ],
            "Resource": "*"
        }
    ]
}
```

------