

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

# Amazon DocumentDB
<a name="automation-ref-docdb"></a>

AWS Systems Manager 自動化為 Amazon DocumentDB 提供預先定義的 Runbook （與 MongoDB 相容）。如需有關執行手冊的詳細資訊，請參閱 [Working with runbooks](https://docs.aws.amazon.com/systems-manager/latest/userguide/automation-documents.html)。如需如何檢視 Runbook 內容的詳細資訊，請參閱 [檢視 Runbook 內容](automation-runbook-reference.md#view-automation-json)。

**Topics**
+ [`AWS-EnableDocDbClusterBackupRetentionPeriod`](aws-enabledocdbclusterbackupretentionperiod.md)

# `AWS-EnableDocDbClusterBackupRetentionPeriod`
<a name="aws-enabledocdbclusterbackupretentionperiod"></a>

 **Description** 

 `AWS-EnableDocDbClusterBackupRetentionPeriod` Runbook 會為您指定的 Amazon DocumentDB 叢集啟用備份保留期間。此功能會設定自動備份保留的總天數。若要修改叢集，叢集必須處於可用狀態，引擎類型為 `docdb`。

 [執行此自動化 （主控台）](https://console.aws.amazon.com/systems-manager/automation/execute/AWS-EnableDocDbClusterBackupRetentionPeriod) 

**文件類型**

 自動化

**擁有者**

Amazon

**平台**

Linux、macOS、 Windows

**參數**
+ AutomationAssumeRole

  類型：字串

  描述：（選用） 允許 Systems Manager Automation 代表您執行動作的 (IAM) 角色的 AWS Identity and Access Management Amazon Resource Name (ARN)。如果未指定角色，Systems Manager Automation 會使用啟動此 Runbook 的使用者許可。
+ DBClusterResourceId

  類型：字串

  描述：（必要） 您要為其啟用備份保留期的 Amazon DocumentDB 叢集的資源 ID。
+ BackupRetentionPeriod

  類型：整數

  描述：（必要） 保留自動備份的天數。必須是 7-35 天的值。
+ PreferredBackupWindow

  類型：字串

  描述：（選用） 國際標準時間協同 (UTC) 的每日時間範圍，格式為 hh24：mm-hh24：mm，例如 07：14-07：44。值必須至少為 30 分鐘，且不能與偏好的維護時段衝突。
+ `ssm:GetAutomationExecution`
+ `ssm:StartAutomationExecution`
+ `docdb:DescribeDBClusters`
+ `docdb:ModifyDBCluster`
+ `rds:DescribeDBClusters`
+ `rds:ModifyDBCluster`

 **文件步驟** 
+ GetDocDbClusterIdentifier (`aws:executeAwsApi`) - 使用提供的資源 ID 傳回 Amazon DocumentDB 叢集識別符。
+ VerifyDocDbEngine (`aws:assertAwsResourceProperty`) - 驗證 Amazon DocumentDB 引擎類型`docdb`是為了防止意外變更其他 Amazon RDS 引擎類型。
+ VerifyDocDbStatus (`aws:waitAwsResourceProperty`) - 驗證 Amazon DocumentDB 叢集狀態為 `available`。
+ ModifyDocDbRetentionPeriod (`aws:executeAwsApi`) - 使用指定 Amazon DocumentDB 叢集提供的值來設定保留期間。
+ VerifyDocDbBackupsEnabled (`aws:executeScript`) - 驗證 Amazon DocumentDB 叢集的保留期間，如果指定，則表示已成功設定偏好的備份時段。

 **輸出** 

ModifyDocDbRetentionPeriod.ModifyDbClusterResponse - `ModifyDBCluster` API 操作的回應。

VerifyDocDbBackupsEnabled.VerifyDbClusterBackupsEnabledResponse - 步驟的輸出，`VerifyDocDbBackupsEnabled`確認成功修改 Amazon DocumentDB 叢集。