

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

# Amazon Security Lake 入門
<a name="getting-started"></a>

本節中的主題說明如何啟用和開始使用 Security Lake。您將了解如何設定您的資料湖設定和設定日誌收集。您可以透過 AWS 管理主控台 或以程式設計方式啟用和使用 Security Lake。無論您使用哪種方法，您必須先設定 AWS 帳戶 和管理使用者。之後的步驟會根據存取方法而有所不同。

Security Lake 主控台提供簡化的入門程序，並建立建立資料湖所需的所有必要 AWS Identity and Access Management (IAM) 角色。

如果您以程式設計方式存取 Security Lake，則必須建立某些 AWS Identity and Access Management (IAM) 角色，才能設定您的資料湖。

**重要**  
Security Lake 不支援回填啟用 Security Lake 之前產生的現有 AWS 原始日誌來源事件。

**Topics**
+ [設定您的 AWS 帳戶](initial-account-setup.md)
+ [啟用 Security Lake 時的考量事項](enable-securitylake-considerations.md)
+ [使用主控台啟用 Security Lake](get-started-console.md)
+ [以程式設計方式啟用 Security Lake](get-started-programmatic.md)

# 設定您的 AWS 帳戶
<a name="initial-account-setup"></a>

您必須先有 ，才能啟用 Amazon Security Lake AWS 帳戶。如果您沒有 AWS 帳戶，請完成下列步驟來建立一個。

## 註冊 AWS 帳戶
<a name="sign-up-for-aws"></a>

如果您沒有 AWS 帳戶，請完成下列步驟來建立一個。

**註冊 AWS 帳戶**

1. 開啟 [https://portal.aws.amazon.com/billing/signup](https://portal.aws.amazon.com/billing/signup)。

1. 請遵循線上指示進行。

   部分註冊程序需接收來電或簡訊，並在電話鍵盤輸入驗證碼。

   當您註冊 時 AWS 帳戶，*AWS 帳戶根使用者*會建立 。根使用者有權存取該帳戶中的所有 AWS 服務 和資源。作為安全最佳實務，請將管理存取權指派給使用者，並且僅使用根使用者來執行[需要根使用者存取權的任務](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_root-user.html#root-user-tasks)。

AWS 會在註冊程序完成後傳送確認電子郵件給您。您可以隨時登錄 [https://aws.amazon.com/](https://aws.amazon.com/) 並選擇**我的帳戶**，以檢視您目前的帳戶活動並管理帳戶。

## 建立具有管理存取權的使用者
<a name="create-an-admin"></a>

註冊 後 AWS 帳戶，請保護 AWS 帳戶根使用者、啟用 AWS IAM Identity Center和建立管理使用者，以免將根使用者用於日常任務。

**保護您的 AWS 帳戶根使用者**

1.  選擇**根使用者**並輸入 AWS 帳戶 您的電子郵件地址，以帳戶擁有者[AWS 管理主控台](https://console.aws.amazon.com/)身分登入 。在下一頁中，輸入您的密碼。

   如需使用根使用者登入的說明，請參閱 *AWS 登入 使用者指南*中的[以根使用者身分登入](https://docs.aws.amazon.com/signin/latest/userguide/console-sign-in-tutorials.html#introduction-to-root-user-sign-in-tutorial)。

1. 若要在您的根使用者帳戶上啟用多重要素驗證 (MFA)。

   如需說明，請參閱《*IAM 使用者指南*》中的[為您的 AWS 帳戶 根使用者 （主控台） 啟用虛擬 MFA 裝置](https://docs.aws.amazon.com/IAM/latest/UserGuide/enable-virt-mfa-for-root.html)。

**建立具有管理存取權的使用者**

1. 啟用 IAM Identity Center。

   如需指示，請參閱《AWS IAM Identity Center 使用者指南》**中的[啟用 AWS IAM Identity Center](https://docs.aws.amazon.com//singlesignon/latest/userguide/get-set-up-for-idc.html)。

1. 在 IAM Identity Center 中，將管理存取權授予使用者。

   如需使用 IAM Identity Center 目錄 做為身分來源的教學課程，請參閱*AWS IAM Identity Center 《 使用者指南*》中的[使用預設值設定使用者存取 IAM Identity Center 目錄](https://docs.aws.amazon.com//singlesignon/latest/userguide/quick-start-default-idc.html)。

**以具有管理存取權的使用者身分登入**
+ 若要使用您的 IAM Identity Center 使用者簽署，請使用建立 IAM Identity Center 使用者時傳送至您電子郵件地址的簽署 URL。

  如需使用 IAM Identity Center 使用者登入的說明，請參閱*AWS 登入 《 使用者指南*》中的[登入 AWS 存取入口網站](https://docs.aws.amazon.com/signin/latest/userguide/iam-id-center-sign-in-tutorial.html)。

**指派存取權給其他使用者**

1. 在 IAM Identity Center 中，建立一個許可集來遵循套用最低權限的最佳實務。

   如需指示，請參閱《AWS IAM Identity Center 使用者指南》**中的[建立許可集](https://docs.aws.amazon.com//singlesignon/latest/userguide/get-started-create-a-permission-set.html)。

1. 將使用者指派至群組，然後對該群組指派單一登入存取權。

   如需指示，請參閱《AWS IAM Identity Center 使用者指南》**中的[新增群組](https://docs.aws.amazon.com//singlesignon/latest/userguide/addgroups.html)。

## 識別您將用來啟用 Security Lake 的帳戶
<a name="prerequisite-organizations"></a>

Security Lake 與 整合 AWS Organizations ，以管理組織中多個帳戶的日誌收集。如果您想要為組織使用 Security Lake，您必須使用 Organizations 管理帳戶來指定委派的 Security Lake 管理員。然後，您必須使用委派管理員的登入資料來啟用 Security Lake、新增成員帳戶，以及為其啟用 Security Lake。如需詳細資訊，請參閱[在 Security Lake AWS Organizations中使用 管理多個帳戶](multi-account-management.md)。

或者，您可以為不屬於組織的獨立帳戶使用 Security Lake，而不需要 Organizations 整合。

# 啟用 Security Lake 時的考量事項
<a name="enable-securitylake-considerations"></a>

**啟用 Security Lake 之前，請考慮下列事項**：
+ Security Lake 提供跨區域管理功能，這表示您可以跨 建立資料湖並設定日誌收集 AWS 區域。若要[在所有支援的區域中](supported-regions.md)啟用 Security Lake，您可以選擇任何支援的 區域端點。您也可以新增[彙總區域](add-rollup-region.md)，將多個區域的資料彙總到單一區域。
+ 建議您在所有支援的 中啟用 Security Lake AWS 區域。如果您這樣做，Security Lake 可以收集連線至未經授權或異常活動的資料，即使在您未主動使用的區域中也是如此。如果 Security Lake 未在所有支援的區域中啟用，則其從您在多個區域中使用的其他 服務收集資料的能力會降低。
+ 當您第一次在任何區域中啟用 Security Lake 時，它會為您的帳戶建立下列服務連結角色：
  + [AWSServiceRoleForSecurityLake](https://docs.aws.amazon.com/security-lake/latest/userguide/slr-permissions.html)：此角色包含 AWS 服務 代表您呼叫其他 並操作安全資料湖的許可。如果您啟用 Security Lake 做為[委派的 Security Lake 管理員](multi-account-management.md#delegated-admin-important)，Security Lake 會在[組織中的每個成員帳戶中建立服務連結角色](using-service-linked-roles.md)。
  + [AWSServiceRoleForSecurityLakeResourceManagement](https://docs.aws.amazon.com/security-lake/latest/userguide/slr-permissions.html)：Security Lake 使用此角色來執行持續的監控和效能改善，這可能會降低延遲和成本。此服務連結角色信任`resource-management.securitylake.amazonaws.com`服務擔任該角色。啟用此服務角色也會授予 Lake Formation 的存取權。

    如需有關這如何影響 2025 年 4 月 17 日之前啟用 Security Lake 的現有帳戶的資訊，請參閱 [Update for existing accounts](multi-account-management.md#security-lake-existing-account-resource-management-slr)。

  如需有關服務連結角色如何運作的詳細資訊，請參閱《*IAM 使用者指南*》中的[使用服務連結角色許可](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create-service-linked-role.html)。
+ Security Lake 不支援 Amazon S3 物件鎖定。建立資料湖儲存貯體時，預設會停用 S3 物件鎖定。在儲存貯體上啟用物件鎖定會中斷將標準化日誌資料交付至資料湖。
+ 如果您要在區域中重新啟用 Security Lake，您必須從先前使用的 Security Lake 中刪除該區域的對應 AWS Glue 資料庫。

# 使用主控台啟用 Security Lake
<a name="get-started-console"></a>

本教學說明如何透過 啟用和設定 Security Lake AWS 管理主控台。作為 的一部分 AWS 管理主控台，Security Lake 主控台提供簡化的入門程序，並建立建立資料湖所需的所有必要 AWS Identity and Access Management (IAM) 角色。

## 步驟 1：設定來源
<a name="define-collection-objective"></a>

Security Lake 會從各種來源以及您的 和 收集日誌 AWS 帳戶 和事件資料 AWS 區域。請依照這些指示來識別您希望 Security Lake 收集哪些資料。您只能使用這些指示來新增原生支援的 AWS 服務 作為來源。如需新增自訂來源的詳細資訊，請參閱 [從 Security Lake 中的自訂來源收集資料](custom-sources.md)。

**設定日誌來源集合**

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

1. 使用頁面右上角的 AWS 區域 選取器，選取區域。您可以在加入時在目前區域和其他區域中啟用 Security Lake。

1. 選擇**開始使用**。

1. 針對**選取日誌和事件來源**，選擇下列其中一個**來源選項**：

   1. **擷取預設 AWS 來源** – 當您選擇建議的選項時，CloudTrail - S3 資料事件預設 AWS WAF 不會包含用於擷取。這是因為擷取大量這兩種來源類型可能會大幅影響使用成本。若要擷取這些來源，請先選取**擷取特定 AWS 來源**選項，然後從**日誌和事件來源清單中選取這些來源**。

   1. **擷取特定 AWS 來源** – 使用此選項，您可以選取要擷取的一或多個日誌和事件來源。
**注意**  
當您第一次在帳戶中啟用 Security Lake 時，所有選取的日誌和事件來源都將成為 15 天免費試用期的一部分。如需用量統計資料的詳細資訊，請參閱 [檢閱用量和預估成本](reviewing-usage-costs.md)。

1. 針對**版本**，選擇您要從中擷取日誌和事件來源的資料來源版本。如需有關版本的詳細資訊，請參閱[OCSF 來源識別](open-cybersecurity-schema-framework.md#ocsf-source-identification)。
**重要**  
如果您沒有在指定區域中啟用新版本 AWS 日誌來源所需的角色許可，請聯絡您的 Security Lake 管理員。如需詳細資訊，請參閱[更新角色許可](https://docs.aws.amazon.com/security-lake/latest/userguide/internal-sources.html#update-role-permissions)。

1. 針對**選取區域**，選擇是否從所有支援的區域或特定區域擷取日誌和事件來源。如果您選擇**特定區域**，請選取要擷取資料的區域。

1. 對於**選取帳戶**，請執行下列步驟：

   1. 選擇 Security Lake 是否會從組織**中的所有帳戶**或**特定帳戶**擷取資料。系統會使用您在此組態期間選擇的設定，為這些帳戶啟用 Security Lake。

   1. 預設會選取**自動為新組織帳戶啟用 Security Lake** 核取方塊。這些自動啟用設定將在加入您的組織 AWS 帳戶 時套用到 。您可以隨時編輯自動啟用設定。
**注意**  
自動啟用設定只會在帳戶加入您的組織時套用，而不會套用到現有帳戶。如需詳細資訊，請參閱[在主控台中編輯新帳戶組態](multi-account-management.md#security-lake-new-account-auto-enable)。

   

1. 對於**服務存取**，建立新的 IAM 角色或使用現有的 IAM 角色，授予 Security Lake 從您的來源收集資料並將其新增至資料湖的許可。您啟用 Security Lake 的所有區域都會使用一個角色。

1. 選擇**下一步**。

## 步驟 2：定義儲存設定和彙總區域 （選用）
<a name="define-target-objective"></a>

您可以指定您希望 Security Lake 存放資料的 Amazon S3 儲存類別，以及存放資料的時間長度。您也可以指定彙總區域來合併來自多個區域的資料。這些是選用步驟。如需詳細資訊，請參閱[Security Lake 中的生命週期管理](lifecycle-management.md)。

**設定儲存和彙總設定**

1. 如果您想要將多個貢獻區域的資料合併至彙總區域，請在**選取彙總區域**中選擇**新增彙總區域**。指定彙總區域和將對其做出貢獻的區域。您可以設定一或多個彙總區域。

1. 針對**選取儲存類別**，選擇 Amazon S3 儲存類別。預設儲存類別為 **S3 Standard**。如果您希望資料在該時間之後轉換到另一個儲存類別，請提供保留期間 （以天為單位），然後選擇**新增轉換**。保留期間結束後，物件會過期，Amazon S3 會將其刪除。如需 Amazon S3 儲存類別和保留的詳細資訊，請參閱 [保留管理](lifecycle-management.md#retention-management)。

1. 如果您在第一個步驟中選取了彙總區域，對於**服務存取**，請建立新的 IAM 角色或使用現有 IAM 角色，授予 Security Lake 跨多個區域複寫資料的許可。

1. 選擇**下一步**。

## 步驟 3：檢閱和建立資料湖
<a name="review-create"></a>

檢閱 Security Lake 將從中收集資料的來源、您的彙總區域，以及您的保留設定。然後，建立您的資料湖。

**檢閱和建立資料湖**

1. 啟用 Security Lake 時，請檢閱**日誌和事件來源**、**區域**、**彙總區域**和**儲存類別**。

1. 選擇**建立**。

建立資料湖之後，您會在 Security Lake 主控台上看到**摘要**頁面。此頁面提供**區域**和**彙總區域**數量、訂閱者相關資訊和**問題的**概觀。

**問題**功能表會顯示過去 14 天內影響 Security Lake 服務或 Amazon S3 儲存貯體的問題摘要。如需有關每個問題的其他詳細資訊，您可以前往 Security Lake ****主控台的問題頁面。

## 步驟 4：檢視和查詢您自己的資料
<a name="explore-data-lake"></a>

建立資料湖後，您可以使用 Amazon Athena 或類似服務來檢視和查詢 AWS Lake Formation 資料庫和資料表中的資料。當您使用主控台時，Security Lake 會自動將資料庫檢視許可授予您用來啟用 Security Lake 的角色。角色至少必須具有*資料分析師*許可。如需許可層級的詳細資訊，請參閱 [Lake Formation 角色和 IAM 許可參考](https://docs.aws.amazon.com/lake-formation/latest/dg/permissions-reference.html)。如需授予`SELECT`許可的指示，請參閱《 *AWS Lake Formation 開發人員指南*》中的[使用具名資源方法授予資料目錄許可](https://docs.aws.amazon.com/lake-formation/latest/dg/granting-cat-perms-named-resource.html)。

## 步驟 5：建立訂閱者
<a name="subscribe-data"></a>

建立資料湖之後，您可以新增訂閱者以取用您的資料。訂閱者可以透過直接存取 Amazon S3 儲存貯體中的物件或查詢資料湖來取用資料。如需訂閱者的詳細資訊，請參閱 [Security Lake 中的訂閱者管理](subscriber-management.md)。

# 以程式設計方式啟用 Security Lake
<a name="get-started-programmatic"></a>

本教學課程說明如何以程式設計方式啟用和開始使用 Security Lake。Amazon Security Lake API 可讓您以程式設計方式存取 Security Lake 帳戶、資料和資源。或者，您可以使用 AWS 命令列工具 - [AWS Command Line Interface](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html)或 [AWS Tools for PowerShell](https://docs.aws.amazon.com/powershell/latest/userguide/pstools-welcome.html) - 或 [AWS SDKs](https://aws.amazon.com/developertools/)來存取 Security Lake。

## 步驟 1：建立 IAM 角色
<a name="prerequisites"></a>

如果您以程式設計方式存取 Security Lake，則必須建立某些 AWS Identity and Access Management (IAM) 角色，才能設定您的資料湖。

**重要**  
如果您使用 Security Lake 主控台來啟用和設定 Security Lake，則不需要建立這些 IAM 角色。

如果您要採取下列一或多個動作，您必須在 IAM 中建立角色 （選擇連結以查看每個動作的 IAM 角色詳細資訊）：
+ [建立自訂來源](custom-sources.md#iam-roles-custom-sources) – 自訂來源是原生支援以外的來源 AWS 服務 ，可將資料傳送至 Security Lake。
+ [建立具有資料存取的訂閱](prereqs-creating-subscriber.md#iam-role-subscriber)者 – 具有許可的訂閱者可以直接從您的資料湖存取 S3 物件。
+ [建立具有查詢存取權的訂閱](prereqs-query-subscriber.md#iam-role-query-subscriber)者 – 具有許可的訂閱者可以使用 Amazon Athena 等服務從 Security Lake 查詢資料。
+ [設定彙總區域](add-rollup-region.md#iam-role-replication) – 彙總區域會合併來自多個 的資料 AWS 區域。

建立先前提及的角色後，請將 [https://docs.aws.amazon.com/security-lake/latest/userguide/security-iam-awsmanpol.html#security-iam-awsmanpol-AmazonSecurityLakeAdministrator](https://docs.aws.amazon.com/security-lake/latest/userguide/security-iam-awsmanpol.html#security-iam-awsmanpol-AmazonSecurityLakeAdministrator) AWS 受管政策連接至您用來啟用 Security Lake 的角色。此政策授予管理許可，允許委託人加入 Security Lake 並存取所有 Security Lake 動作。

連接 [https://docs.aws.amazon.com/security-lake/latest/userguide/security-iam-awsmanpol.html#security-iam-awsmanpol-AmazonSecurityLakeAdministrator](https://docs.aws.amazon.com/security-lake/latest/userguide/security-iam-awsmanpol.html#security-iam-awsmanpol-AmazonSecurityLakeAdministrator) AWS 受管政策，以建立您的資料湖或從 Security Lake 查詢資料。Security Lake 需要此政策，才能支援從來源接收之原始日誌和事件資料的擷取、轉換和載入 (ETL) 任務。

## 步驟 2：啟用 Amazon Security Lake
<a name="enable-service-programmatic"></a>

若要以程式設計方式啟用 Security Lake，請使用 Security Lake API [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/create-data-lake.html) 命令。在您的請求中，使用 `configurations` 物件的 `region` 欄位來指定要啟用 Security Lake 之區域的區域代碼。如需區域代碼清單，請參閱《》中的 [Amazon Security Lake 端點](https://docs.aws.amazon.com/general/latest/gr/securitylake.html)*AWS 一般參考*。

**範例 1**

下列範例命令會在 `us-east-1`和 `us-east-2`區域中啟用 Security Lake。在這兩個區域中，此資料湖都會使用 Amazon S3 受管金鑰加密。物件會在 365 天後過期，而物件會在 60 天後轉換為 `ONEZONE_IA` S3 儲存類別。此範例已針對 Linux、macOS 或 Unix 格式化，並使用反斜線 (\$1) 行接續字元來改善可讀性。

```
$ aws securitylake create-data-lake \
--configurations '[{"encryptionConfiguration": {"kmsKeyId":"S3_MANAGED_KEY"},"region":"us-east-1","lifecycleConfiguration": {"expiration":{"days":365},"transitions":[{"days":60,"storageClass":"ONEZONE_IA"}]}}, {"encryptionConfiguration": {"kmsKeyId":"S3_MANAGED_KEY"},"region":"us-east-2","lifecycleConfiguration": {"expiration":{"days":365},"transitions":[{"days":60,"storageClass":"ONEZONE_IA"}]}}]' \
--meta-store-manager-role-arn "arn:aws:iam:us-east-1:123456789012:role/service-role/AmazonSecurityLakeMetaStoreManager"
```

**範例 2**

下列範例命令會在 區域中啟用 Security Lake`us-east-2`。此資料湖會使用在 AWS Key Management Service () 中建立的客戶受管金鑰進行加密AWS KMS。物件會在 500 天後過期，而物件會在 30 天後轉換為 `GLACIER` S3 儲存類別。此範例已針對 Linux、macOS 或 Unix 格式化，並使用反斜線 (\$1) 行接續字元來改善可讀性。

```
$ aws securitylake create-data-lake \
--configurations '[{"encryptionConfiguration": {"kmsKeyId":"1234abcd-12ab-34cd-56ef-1234567890ab"},"region":"us-east-2","lifecycleConfiguration": {"expiration":{"days":500},"transitions":[{"days":30,"storageClass":"GLACIER"}]}}]' \
--meta-store-manager-role-arn "arn:aws:iam:us-east-1:123456789012:role/service-role/AmazonSecurityLakeMetaStoreManager"
```

**注意**  
如果您已啟用 Security Lake，並想要更新區域或來源的組態設定，請使用 [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[update-data-lake](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/securitylake/update-data-lake.html) 命令。請勿使用 `CreateDataLake`操作。

## 步驟 3：設定來源
<a name="define-collection-objective-programmatic"></a>

Security Lake 會從各種來源以及您的 和 收集日誌 AWS 帳戶 和事件資料 AWS 區域。請依照這些指示來識別您希望 Security Lake 收集哪些資料。您只能使用這些指示來新增原生支援的 AWS 服務 作為來源。如需新增自訂來源的詳細資訊，請參閱 [從 Security Lake 中的自訂來源收集資料](custom-sources.md)。

若要以程式設計方式定義一或多個集合來源，請使用 Security Lake API 的 [CreateAwsLogSource](https://docs.aws.amazon.com/security-lake/latest/APIReference/API_CreateAwsLogSource.html) 操作。針對每個來源，指定 `sourceName` 參數的區域唯一值。選擇性地使用其他參數，將來源的範圍限制為特定帳戶 (`accounts`) 或特定版本 ()`sourceVersion`。

**注意**  
如果您未在請求中包含選用參數，Security Lake 會根據您排除的參數，將您的請求套用至指定來源的所有帳戶或所有版本。例如，如果您是組織的委派 Security Lake 管理員，而且您排除 `accounts` 參數，Security Lake 會將您的請求套用到組織中的所有帳戶。同樣地，如果您排除 `sourceVersion` 參數，Security Lake 會將您的請求套用至指定來源的所有版本。

如果您的請求指定您尚未啟用 Security Lake 的區域，則會發生錯誤。若要解決此錯誤，請確定`regions`陣列僅指定您已啟用 Security Lake 的區域。或者，您可以在 區域中啟用 Security Lake，然後再次提交您的請求。

當您第一次在帳戶中啟用 Security Lake 時，所有選取的日誌和事件來源都將成為 15 天免費試用期的一部分。如需用量統計資料的詳細資訊，請參閱 [檢閱用量和預估成本](reviewing-usage-costs.md)。

## 步驟 4：設定儲存設定和彙總區域 （選用）
<a name="define-target-objective-programmatic"></a>

您可以指定您希望 Security Lake 存放資料的 Amazon S3 儲存類別，以及存放資料的時間長度。您也可以指定彙總區域來合併來自多個區域的資料。這些是選用步驟。如需詳細資訊，請參閱[Security Lake 中的生命週期管理](lifecycle-management.md)。

若要在啟用 Security Lake 時以程式設計方式定義目標目標，請使用 Security Lake API [https://docs.aws.amazon.com/security-lake/latest/APIReference/API_CreateDataLake.html](https://docs.aws.amazon.com/security-lake/latest/APIReference/API_CreateDataLake.html)的操作。如果您已啟用 Security Lake 並想要定義目標目標，請使用 [https://docs.aws.amazon.com/security-lake/latest/APIReference/API_UpdateDataLake.html](https://docs.aws.amazon.com/security-lake/latest/APIReference/API_UpdateDataLake.html)操作，而非 `CreateDataLake`操作。

對於任一操作，請使用支援的參數來指定您想要的組態設定：
+ 若要指定彙總區域，請使用 `region` 欄位來指定您要將資料貢獻至彙總區域的區域。在 `replicationConfiguration` 物件`regions`陣列中，指定每個彙總區域的區域代碼。如需區域代碼清單，請參閱《》中的 [Amazon Security Lake 端點](https://docs.aws.amazon.com/general/latest/gr/securitylake.html)*AWS 一般參考*。
+ 若要指定資料的保留設定，請使用 `lifecycleConfiguration` 參數：
  + 針對 `transitions`，指定您要在特定 Amazon S3 儲存類別 (`days`) 中存放 S3 物件的總天數 (`storageClass`)。 Amazon S3 
  + 針對 `expiration`，指定建立物件後，使用任何儲存類別，在 Amazon S3 中儲存物件的總天數。當此保留期結束時，物件會過期，Amazon S3 會將其刪除。

  Security Lake 會將指定的保留設定套用至您在 `configurations` 物件的 `region` 欄位中指定的區域。

例如，下列命令會使用 建立資料湖`ap-northeast-2`做為彙總區域。`us-east-1` 區域會將資料貢獻至 `ap-northeast-2`區域。此範例也會為新增至資料湖的物件建立 10 天的過期期間。

```
$ aws securitylake create-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":10}}}]' \
--meta-store-manager-role-arn "arn:aws:iam::123456789012:role/service-role/AmazonSecurityLakeMetaStoreManager"
```

您現在已建立您的資料湖。使用 Security Lake API [https://docs.aws.amazon.com/security-lake/latest/APIReference/API_ListDataLakes.html](https://docs.aws.amazon.com/security-lake/latest/APIReference/API_ListDataLakes.html)的操作來驗證在每個區域中啟用 Security Lake 和您的資料湖設定。

如果在建立資料湖時發生問題或錯誤，您可以使用 [https://docs.aws.amazon.com/security-lake/latest/APIReference/API_ListDataLakeExceptions.html](https://docs.aws.amazon.com/security-lake/latest/APIReference/API_ListDataLakeExceptions.html)操作檢視例外狀況清單，並通知使用者 [https://docs.aws.amazon.com/security-lake/latest/APIReference/API_CreateDataLakeExceptionSubscription.html](https://docs.aws.amazon.com/security-lake/latest/APIReference/API_CreateDataLakeExceptionSubscription.html)操作的例外狀況。如需詳細資訊，請參閱[對資料湖狀態進行故障診斷](securitylake-data-lake-troubleshoot.md)。

## 步驟 5：檢視和查詢您自己的資料
<a name="explore-data-lake-programmatic"></a>

建立資料湖後，您可以使用 Amazon Athena 或類似服務來檢視和查詢 AWS Lake Formation 資料庫和資料表中的資料。當您以程式設計方式啟用 Security Lake 時，不會自動授予資料庫檢視許可。中的資料湖管理員帳戶 AWS Lake Formation 必須將`SELECT`許可授予您要用來查詢相關資料庫和資料表的 IAM 角色。角色至少必須具有*資料分析師*許可。如需許可層級的詳細資訊，請參閱 [Lake Formation 角色和 IAM 許可參考](https://docs.aws.amazon.com/lake-formation/latest/dg/permissions-reference.html)。如需授予`SELECT`許可的指示，請參閱《 *AWS Lake Formation 開發人員指南*》中的[使用具名資源方法授予資料目錄許可](https://docs.aws.amazon.com/lake-formation/latest/dg/granting-cat-perms-named-resource.html)。

## 步驟 6：建立訂閱者
<a name="subscribe-data-programmatic"></a>

建立資料湖之後，您可以新增訂閱者以取用您的資料。訂閱者可以透過直接存取 Amazon S3 儲存貯體中的物件或查詢資料湖來取用資料。如需訂閱者的詳細資訊，請參閱 [Security Lake 中的訂閱者管理](subscriber-management.md)。