

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

# 在 Security Lake 中設定彙總區域
<a name="add-rollup-region"></a>

彙總區域會合併來自一或多個貢獻區域的資料。指定彙總區域可協助您符合區域合規要求。

由於 Amazon S3 的限制，不支援從客戶受管金鑰 (CMK) 加密區域資料湖複寫到 S3 受管加密 （預設加密） 區域資料湖。

**重要**  
如果您建立了自訂來源，為了確保自訂來源資料正確複寫到目的地，Security Lake 建議遵循[擷取自訂來源的最佳實務中所述的最佳實務](https://docs.aws.amazon.com//security-lake/latest/userguide/custom-sources.html#custom-sources-best-practices)。複寫無法在未遵循 S3 分割區資料路徑格式的資料上執行，如頁面所述。

新增彙總區域之前，您必須先在 AWS Identity and Access Management (IAM) 中建立兩個不同的角色：
+ [資料複寫的 IAM 角色](#iam-role-replication)
+ [用於註冊 AWS Glue 分割區的 IAM 角色](#iam-role-partitions)

**注意**  
當您使用 Security Lake 主控台時，Security Lake 會代表您建立這些 IAM 角色或使用現有的角色。不過，在使用 Security Lake API 或 時，您必須建立這些角色 AWS CLI。

## 資料複寫的 IAM 角色
<a name="iam-role-replication"></a>

此 IAM 角色授予許可給 Amazon S3，以跨多個區域複寫來源日誌和事件。

若要授予這些許可，請建立開頭為字首 的 IAM 角色`SecurityLake`，並將下列範例政策連接至角色。當您在 Security Lake 中建立彙總區域時，將需要角色的 Amazon Resource Name (ARN)。在此政策中， `sourceRegions` 正在貢獻區域， `destinationRegions`是彙總區域。

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

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Sid": "AllowReadS3ReplicationSetting",
      "Action": [
        "s3:ListBucket",
        "s3:GetReplicationConfiguration",
        "s3:GetObjectVersionForReplication",
        "s3:GetObjectVersion",
        "s3:GetObjectVersionAcl",
        "s3:GetObjectVersionTagging",
        "s3:GetObjectRetention",
        "s3:GetObjectLegalHold"
      ],
      "Effect": "Allow",
      "Resource": [
        "arn:aws:s3:::aws-security-data-lake-[[sourceRegions]]*",
        "arn:aws:s3:::aws-security-data-lake-[[sourceRegions]]*/*"
      ],
      "Condition": {
        "StringEquals": {
          "s3:ResourceAccount": [
            "{{bucketOwnerAccountId}}"
          ]
        }
      }
    },
    {
      "Sid": "AllowS3Replication",
      "Action": [
        "s3:ReplicateObject",
        "s3:ReplicateDelete",
        "s3:ReplicateTags",
        "s3:GetObjectVersionTagging"
      ],
      "Effect": "Allow",
      "Resource": [
        "arn:aws:s3:::aws-security-data-lake-[[destinationRegions]]*/*"
      ],
      "Condition": {
        "StringEquals": {
          "s3:ResourceAccount": [
            "{{bucketOwnerAccountId}}"
          ]
        }
      }
    }
  ]
}
```

------

將下列信任政策連接至您的角色，以允許 Amazon S3 擔任該角色：

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "AllowS3ToAssume",
            "Effect": "Allow",
            "Principal": {
                "Service": "s3.amazonaws.com"
            },
            "Action": "sts:AssumeRole"
        }
    ]
}
```

------

如果您使用來自 AWS Key Management Service (AWS KMS) 的客戶受管金鑰來加密 Security Lake 資料湖，除了資料複寫政策中的許可之外，還必須授予下列許可。

```
{
    "Action": [
        "kms:Decrypt"
    ],
    "Effect": "Allow",
    "Condition": {
        "StringLike": {
            "kms:ViaService": [
                "s3.{sourceRegion1}.amazonaws.com",
                "s3.{sourceRegion2}.amazonaws.com"
                ],
            "kms:EncryptionContext:aws:s3:arn": [
                "arn:aws:s3:::aws-security-data-lake-{sourceRegion1}*",
                "arn:aws:s3:::aws-security-data-lake-{sourceRegion2}*"
            ]
        }
    },
    "Resource": [
        "{sourceRegion1KmsKeyArn}",
        "{sourceRegion2KmsKeyArn}"
    ]
},
{
    "Action": [
        "kms:Encrypt"
    ],
    "Effect": "Allow",
    "Condition": {
        "StringLike": {
            "kms:ViaService": [
            "s3.{destinationRegion1}.amazonaws.com",
            ],
            "kms:EncryptionContext:aws:s3:arn": [
                "arn:aws:s3:::aws-security-data-lake-{destinationRegion1}*",
            ]
        }
    },
    "Resource": [
            "{destinationRegionKmsKeyArn}"
    ]
}
```

如需複寫角色的詳細資訊，請參閱《*Amazon Simple Storage Service 使用者指南*》中的[設定許可](https://docs.aws.amazon.com/AmazonS3/latest/userguide/setting-repl-config-perm-overview.html)。

## 用於註冊 AWS Glue 分割區的 IAM 角色
<a name="iam-role-partitions"></a>

此 IAM 角色會授予 Security Lake 使用之分割區更新程式 AWS Lambda 函數的許可，以註冊從其他區域複寫之 S3 物件的 AWS Glue 分割區。如果不建立此角色，訂閱者就無法從這些物件查詢事件。

若要授予這些許可，請建立名為 的角色 `AmazonSecurityLakeMetaStoreManager`（您可能已在加入 Security Lake 時建立此角色）。如需此角色的詳細資訊，包括範例政策，請參閱 [步驟 1：建立 IAM 角色](get-started-programmatic.md#prerequisites)。

在 Lake Formation 主控台中，您還必須依照下列步驟，以資料湖管理員身分授予`AmazonSecurityLakeMetaStoreManager`許可：

1. 開啟 Lake Formation 主控台，網址為 [https://console.aws.amazon.com/lakeformation/](https://console.aws.amazon.com/lakeformation/)。

1. 以管理使用者身分登入。

1. 如果出現**歡迎使用 Lake Formation** 視窗，請選擇您在步驟 1 中建立或選取的使用者，然後選擇開始使用。

1. 如果您沒有看到**歡迎使用 Lake Formation** 視窗，請執行下列步驟來設定 Lake Formation 管理員。

   1. 在導覽窗格**的許可**下，選擇**管理角色和任務**。在主控台頁面**的資料湖管理員**區段中，選擇**選擇管理員**。

   1. 在**管理資料湖管理員**對話方塊中，針對 IAM 使用者和角色，選擇您建立的 **AmazonSecurityLakeMetaStoreManager** IAM 角色，然後選擇**儲存**。

如需變更資料湖管理員許可的詳細資訊，請參閱《 *AWS Lake Formation 開發人員指南*》中的[建立資料湖管理員](https://docs.aws.amazon.com/lake-formation/latest/dg/getting-started-setup.html#create-data-lake-admin)。

## 新增彙總區域
<a name="procedures-add-rollup-region"></a>

選擇您偏好的存取方法，然後依照下列步驟新增彙總區域。

**注意**  
區域可以將資料貢獻至多個彙總區域。不過，彙總區域不能是另一個彙總區域的貢獻區域。

------
#### [ Console ]

1. 在 https：//[https://console.aws.amazon.com/securitylake/](https://console.aws.amazon.com/securitylake/) 開啟 Security Lake 主控台。

1. 在導覽窗格中的設定下****，選擇**彙總區域**。

1. 選擇**修改**，然後選擇**新增彙總區域**。

1. 指定彙總區域和貢獻區域。如果您想要新增多個彙總區域，請重複此步驟。

1. 如果這是您第一次新增彙總區域，對於**服務存取**，請建立新的 IAM 角色，或使用授予 Security Lake 跨多個區域複寫資料的現有 IAM 角色。

1. 完成後，請選擇**儲存**。

您也可以在加入 Security Lake 時新增彙總區域。如需詳細資訊，請參閱[Amazon Security Lake 入門](getting-started.md)。

------
#### [ API ]

若要以程式設計方式新增彙總區域，請使用 Security Lake API [https://docs.aws.amazon.com/security-lake/latest/APIReference/API_UpdateDataLake.html](https://docs.aws.amazon.com/security-lake/latest/APIReference/API_UpdateDataLake.html)的操作。如果您使用的是 AWS CLI，請執行 [https://awscli.amazonaws.com/v2/documentation/api/latest/reference/securitylake/update-data-lake.html](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/securitylake/update-data-lake.html)命令。在您的請求中，使用 `region` 欄位指定您要將資料貢獻至彙總區域的區域。在 `replicationConfiguration` 參數的`regions`陣列中，指定每個彙總區域的區域代碼。如需區域代碼清單，請參閱《》中的 [Amazon Security Lake 端點](https://docs.aws.amazon.com/general/latest/gr/securitylake.html)*AWS 一般參考*。

例如，下列命令會`ap-northeast-2`設定為彙總區域。`us-east-1` 區域會將資料貢獻至 `ap-northeast-2`區域。此範例也會為新增至資料湖的物件建立 365 天的過期期間。此範例已針對 Linux、macOS 或 Unix 格式化，並使用反斜線 (\$1) 行接續字元來改善可讀性。

```
$ aws securitylake update-data-lake \
--configurations '[{"encryptionConfiguration": {"kmsKeyId":"S3_MANAGED_KEY"},"region":"us-east-1","replicationConfiguration": {"regions": ["ap-northeast-2"],"roleArn":"arn:aws:iam::123456789012:role/service-role/AmazonSecurityLakeS3ReplicationRole"},"lifecycleConfiguration": {"expiration":{"days":365}}}]'
```

您也可以在加入 Security Lake 時新增彙總區域。若要這樣做，請使用 [https://docs.aws.amazon.com/security-lake/latest/APIReference/API_CreateDataLake.html](https://docs.aws.amazon.com/security-lake/latest/APIReference/API_CreateDataLake.html)操作 （或者，如果使用 AWS CLI，則為 [create-data-lake](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/securitylake/update-data-lake.html) 命令）。如需在加入期間設定彙總區域的詳細資訊，請參閱 [Amazon Security Lake 入門](getting-started.md)。

------

## 更新或移除彙總區域
<a name="procedures-update-remove-rollup-region"></a>

選擇您偏好的存取方法，並依照下列步驟更新或移除 Security Lake 中的彙總區域。

------
#### [ Console ]

1. 開啟位於 https：//[https://console.aws.amazon.com/securitylake/](https://console.aws.amazon.com/securitylake/) 的 Security Lake 主控台。

1. 在導覽窗格中的設定下****，選擇**彙總區域**。

1. 選擇 **Modify** (修改)。

1. 若要變更彙總區域的貢獻區域，請在彙總區域的 列中指定更新的貢獻區域。

1. 若要移除彙總區域，請在彙總區域的資料列中選擇**移除**。

1. 完成後，請選擇**儲存**。

------
#### [ API ]

若要以程式設計方式設定彙總區域，請使用 Security Lake API [https://docs.aws.amazon.com/security-lake/latest/APIReference/API_UpdateDataLake.html](https://docs.aws.amazon.com/security-lake/latest/APIReference/API_UpdateDataLake.html)的操作。如果您使用的是 AWS CLI，請執行 [https://awscli.amazonaws.com/v2/documentation/api/latest/reference/securitylake/update-data-lake.html](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/securitylake/update-data-lake.html)命令。在您的請求中，使用支援的參數來指定彙總設定：
+ 若要新增貢獻區域，請使用 `region` 欄位指定要新增區域的區域代碼。在 `replicationConfiguration` 物件的`regions`陣列中，指定每個彙總區域的區域代碼，以貢獻資料。如需區域代碼清單，請參閱《》中的 [Amazon Security Lake 端點](https://docs.aws.amazon.com/general/latest/gr/securitylake.html)*AWS 一般參考*。
+ 若要移除貢獻區域，請使用 `region` 欄位指定要移除區域的區域代碼。針對 `replicationConfiguration` 參數，請勿指定任何值。

例如，下列命令會將 `us-east-1`和 `us-east-2` 同時設定為貢獻區域。兩個區域都會將資料貢獻至`ap-northeast-3`彙總區域。此範例已針對 Linux、macOS 或 Unix 格式化，並使用反斜線 (\$1) 行接續字元來改善可讀性。

```
$ aws securitylake update-data-lake \
--configurations '[{"encryptionConfiguration": {"kmsKeyId":"S3_MANAGED_KEY"},"region":"us-east-1","replicationConfiguration": {"regions": ["ap-northeast-3"],"roleArn":"arn:aws:iam::123456789012:role/service-role/AmazonSecurityLakeS3ReplicationRole"},"lifecycleConfiguration": {"expiration":{"days":365}}},
{"encryptionConfiguration": {"kmsKeyId":"S3_MANAGED_KEY"},"region":"us-east-2","replicationConfiguration": {"regions": ["ap-northeast-3"],"roleArn":"arn:aws:iam::123456789012:role/service-role/AmazonSecurityLakeS3ReplicationRole"}, "lifecycleConfiguration": {"expiration":{"days":500},"transitions":[{"days":60,"storageClass":"ONEZONE_IA"}]}}]'
```

------