db_clusters
Creates, updates, deletes, gets or lists a db_clusters resource.
Overview
| Name | db_clusters |
| Type | Resource |
| Id | aws.docdb.db_clusters |
Fields
The following fields are returned by SELECT queries:
- describe_db_clusters
| Name | Datatype | Description |
|---|---|---|
associated_roles | string | Provides a list of the Identity and Access Management (IAM) roles that are associated with the cluster. (IAM) roles that are associated with a cluster grant permission for the cluster to access other Amazon Web Services services on your behalf. |
availability_zones | string | Provides the list of Amazon EC2 Availability Zones that instances in the cluster can be created in. |
backup_retention_period | integer | Specifies the number of days for which automatic snapshots are retained. |
clone_group_id | string | Identifies the clone group to which the DB cluster is associated. |
cluster_create_time | string | Specifies the time when the cluster was created, in Universal Coordinated Time (UTC). |
db_cluster_arn | string | The Amazon Resource Name (ARN) for the cluster. |
db_cluster_identifier | string | Contains a user-supplied cluster identifier. This identifier is the unique key that identifies a cluster. |
db_cluster_members | string | Provides the list of instances that make up the cluster. |
db_cluster_parameter_group | string | Specifies the name of the cluster parameter group for the cluster. |
db_subnet_group | string | Specifies information on the subnet group that is associated with the cluster, including the name, description, and subnets in the subnet group. |
db_cluster_resource_id | string | The Amazon Web Services Region-unique, immutable identifier for the cluster. This identifier is found in CloudTrail log entries whenever the KMS key for the cluster is accessed. |
deletion_protection | boolean | Specifies whether this cluster can be deleted. If DeletionProtection is enabled, the cluster cannot be deleted unless it is modified and DeletionProtection is disabled. DeletionProtection protects clusters from being accidentally deleted. |
earliest_restorable_time | string | The earliest time to which a database can be restored with point-in-time restore. |
enabled_cloudwatch_logs_exports | string | A list of log types that this cluster is configured to export to Amazon CloudWatch Logs. |
endpoint | string | Specifies the connection endpoint for the primary instance of the cluster. |
engine | string | Provides the name of the database engine to be used for this cluster. |
engine_version | string | Indicates the database engine version. |
hosted_zone_id | string | Specifies the ID that Amazon Route 53 assigns when you create a hosted zone. |
io_optimized_next_allowed_modification_time | string | The next time you can modify the Amazon DocumentDB cluster to use the iopt1 storage type. |
kms_key_id | string | If StorageEncrypted is true, the KMS key identifier for the encrypted cluster. |
latest_restorable_time | string | Specifies the latest time to which a database can be restored with point-in-time restore. |
master_user_secret | string | The secret managed by Amazon DocumentDB in Amazon Web Services Secrets Manager for the master user password. |
master_username | string | Contains the master user name for the cluster. |
multi_az | boolean | Specifies whether the cluster has instances in multiple Availability Zones. |
network_type | string | The network type of the cluster. The network type is determined by the DBSubnetGroup specified for the cluster. A DBSubnetGroup can support only the IPv4 protocol or the IPv4 and the IPv6 protocols (DUAL). For more information, see DocumentDB clusters in a VPC in the Amazon DocumentDB Developer Guide. Valid Values: IPV4 | DUAL |
percent_progress | string | Specifies the progress of the operation as a percentage. |
port | integer | Specifies the port that the database engine is listening on. |
preferred_backup_window | string | Specifies the daily time range during which automated backups are created if automated backups are enabled, as determined by the BackupRetentionPeriod. |
preferred_maintenance_window | string | Specifies the weekly time range during which system maintenance can occur, in Universal Coordinated Time (UTC). |
read_replica_identifiers | string | Contains one or more identifiers of the secondary clusters that are associated with this cluster. |
reader_endpoint | string | The reader endpoint for the cluster. The reader endpoint for a cluster load balances connections across the Amazon DocumentDB replicas that are available in a cluster. As clients request new connections to the reader endpoint, Amazon DocumentDB distributes the connection requests among the Amazon DocumentDB replicas in the cluster. This functionality can help balance your read workload across multiple Amazon DocumentDB replicas in your cluster. If a failover occurs, and the Amazon DocumentDB replica that you are connected to is promoted to be the primary instance, your connection is dropped. To continue sending your read workload to other Amazon DocumentDB replicas in the cluster, you can then reconnect to the reader endpoint. |
replication_source_identifier | string | Contains the identifier of the source cluster if this cluster is a secondary cluster. |
serverless_v2_scaling_configuration | string | The scaling configuration of an Amazon DocumentDB Serverless cluster. |
status | string | Specifies the current state of this cluster. |
storage_encrypted | boolean | Specifies whether the cluster is encrypted. |
storage_type | string | Storage type associated with your cluster For information on storage types for Amazon DocumentDB clusters, see Cluster storage configurations in the Amazon DocumentDB Developer Guide. Valid values for storage type - standard | iopt1 Default value is standard |
vpc_security_groups | string | Provides a list of virtual private cloud (VPC) security groups that the cluster belongs to. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_db_clusters | select | region | DBClusterIdentifier, Filters, MaxRecords, Marker | Returns information about provisioned Amazon DocumentDB clusters. This API operation supports pagination. For certain management features such as cluster and instance lifecycle management, Amazon DocumentDB leverages operational technology that is shared with Amazon RDS and Amazon Neptune. Use the filterName=engine,Values=docdb filter parameter to return only Amazon DocumentDB clusters. |
create_db_cluster | insert | DBClusterIdentifier, region | AvailabilityZones, BackupRetentionPeriod, DBClusterParameterGroupName, VpcSecurityGroupIds, DBSubnetGroupName, Engine, EngineVersion, Port, MasterUsername, MasterUserPassword, PreferredBackupWindow, PreferredMaintenanceWindow, Tags, StorageEncrypted, KmsKeyId, PreSignedUrl, EnableCloudwatchLogsExports, DeletionProtection, GlobalClusterIdentifier, StorageType, ServerlessV2ScalingConfiguration, ManageMasterUserPassword, MasterUserSecretKmsKeyId, NetworkType | Creates a new Amazon DocumentDB cluster. |
modify_db_cluster | update | DBClusterIdentifier, region | NewDBClusterIdentifier, ApplyImmediately, BackupRetentionPeriod, DBClusterParameterGroupName, VpcSecurityGroupIds, Port, MasterUserPassword, PreferredBackupWindow, PreferredMaintenanceWindow, CloudwatchLogsExportConfiguration, EngineVersion, AllowMajorVersionUpgrade, DeletionProtection, StorageType, ServerlessV2ScalingConfiguration, ManageMasterUserPassword, MasterUserSecretKmsKeyId, RotateMasterUserPassword, NetworkType | Modifies a setting for an Amazon DocumentDB cluster. You can change one or more database configuration parameters by specifying these parameters and the new values in the request. |
delete_db_cluster | delete | DBClusterIdentifier, region | SkipFinalSnapshot, FinalDBSnapshotIdentifier | Deletes a previously provisioned cluster. When you delete a cluster, all automated backups for that cluster are deleted and can't be recovered. Manual DB cluster snapshots of the specified cluster are not deleted. |
copy_db_cluster_snapshot | exec | SourceDBClusterSnapshotIdentifier, TargetDBClusterSnapshotIdentifier, region | KmsKeyId, PreSignedUrl, CopyTags, Tags | Copies a snapshot of a cluster. To copy a cluster snapshot from a shared manual cluster snapshot, SourceDBClusterSnapshotIdentifier must be the Amazon Resource Name (ARN) of the shared cluster snapshot. You can only copy a shared DB cluster snapshot, whether encrypted or not, in the same Amazon Web Services Region. To cancel the copy operation after it is in progress, delete the target cluster snapshot identified by TargetDBClusterSnapshotIdentifier while that cluster snapshot is in the copying status. |
restore_db_cluster_from_snapshot | exec | DBClusterIdentifier, SnapshotIdentifier, region | AvailabilityZones, Engine, EngineVersion, Port, DBSubnetGroupName, VpcSecurityGroupIds, Tags, KmsKeyId, EnableCloudwatchLogsExports, DeletionProtection, DBClusterParameterGroupName, ServerlessV2ScalingConfiguration, StorageType, NetworkType | Creates a new cluster from a snapshot or cluster snapshot. If a snapshot is specified, the target cluster is created from the source DB snapshot with a default configuration and default security group. If a cluster snapshot is specified, the target cluster is created from the source cluster restore point with the same configuration as the original source DB cluster, except that the new cluster is created with the default security group. |
restore_db_cluster_to_point_in_time | exec | DBClusterIdentifier, SourceDBClusterIdentifier, region | RestoreType, RestoreToTime, UseLatestRestorableTime, Port, DBSubnetGroupName, VpcSecurityGroupIds, Tags, KmsKeyId, EnableCloudwatchLogsExports, DeletionProtection, ServerlessV2ScalingConfiguration, StorageType, NetworkType | Restores a cluster to an arbitrary point in time. Users can restore to any point in time before LatestRestorableTime for up to BackupRetentionPeriod days. The target cluster is created from the source cluster with the same configuration as the original cluster, except that the new cluster is created with the default security group. |
start_db_cluster | exec | DBClusterIdentifier, region | Restarts the stopped cluster that is specified by DBClusterIdentifier. For more information, see Stopping and Starting an Amazon DocumentDB Cluster. | |
stop_db_cluster | exec | DBClusterIdentifier, region | Stops the running cluster that is specified by DBClusterIdentifier. The cluster must be in the available state. For more information, see Stopping and Starting an Amazon DocumentDB Cluster. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
DBClusterIdentifier | string | The identifier of the cluster to stop. Example: docdb-2019-05-28-15-24-52 |
SnapshotIdentifier | string | The identifier for the snapshot or cluster snapshot to restore from. You can use either the name or the Amazon Resource Name (ARN) to specify a cluster snapshot. However, you can use only the ARN to specify a snapshot. Constraints: Must match the identifier of an existing snapshot. |
SourceDBClusterIdentifier | string | The identifier of the source cluster from which to restore. Constraints: Must match the identifier of an existing DBCluster. |
SourceDBClusterSnapshotIdentifier | string | The identifier of the cluster snapshot to copy. This parameter is not case sensitive. Constraints: Must specify a valid cluster snapshot in the available state. If the source cluster snapshot is in the same Amazon Web Services Region as the copy, specify a valid snapshot identifier. If the source cluster snapshot is in a different Amazon Web Services Region or owned by another Amazon Web Services account, specify the snapshot ARN. Example: my-cluster-snapshot1 |
TargetDBClusterSnapshotIdentifier | string | The identifier of the new cluster snapshot to create from the source cluster snapshot. This parameter is not case sensitive. Constraints: Must contain from 1 to 63 letters, numbers, or hyphens. The first character must be a letter. Cannot end with a hyphen or contain two consecutive hyphens. Example: my-cluster-snapshot2 |
region | string | AWS region (default: us-east-1) |
AllowMajorVersionUpgrade | boolean | A value that indicates whether major version upgrades are allowed. Constraints: You must allow major version upgrades when specifying a value for the EngineVersion parameter that is a different major version than the cluster's current version. Since some parameters are version specific, changing them requires executing a new ModifyDBCluster API call after the in-place MVU completes. Performing an MVU directly impacts the following parameters: MasterUserPassword NewDBClusterIdentifier VpcSecurityGroupIds Port |
ApplyImmediately | boolean | A value that specifies whether the changes in this request and any pending changes are asynchronously applied as soon as possible, regardless of the PreferredMaintenanceWindow setting for the cluster. If this parameter is set to false, changes to the cluster are applied during the next maintenance window. The ApplyImmediately parameter affects only the NewDBClusterIdentifier and MasterUserPassword values. If you set this parameter value to false, the changes to the NewDBClusterIdentifier and MasterUserPassword values are applied during the next maintenance window. All other changes are applied immediately, regardless of the value of the ApplyImmediately parameter. Default: false |
AvailabilityZones | array | Provides the list of Amazon EC2 Availability Zones that instances in the restored DB cluster can be created in. |
BackupRetentionPeriod | integer | The number of days for which automated backups are retained. You must specify a minimum value of 1. Default: 1 Constraints: Must be a value from 1 to 35. |
CloudwatchLogsExportConfiguration | object | The configuration setting for the log types to be enabled for export to Amazon CloudWatch Logs for a specific instance or cluster. The EnableLogTypes and DisableLogTypes arrays determine which logs are exported (or not exported) to CloudWatch Logs. |
CopyTags | boolean | Set to true to copy all tags from the source cluster snapshot to the target cluster snapshot, and otherwise false. The default is false. |
DBClusterIdentifier | string | The user-provided cluster identifier. If this parameter is specified, information from only the specific cluster is returned. This parameter isn't case sensitive. Constraints: If provided, must match an existing DBClusterIdentifier. |
DBClusterParameterGroupName | string | The name of the DB cluster parameter group to associate with this DB cluster. Type: String. Required: No. If this argument is omitted, the default DB cluster parameter group is used. If supplied, must match the name of an existing default DB cluster parameter group. The string must consist of from 1 to 255 letters, numbers or hyphens. Its first character must be a letter, and it cannot end with a hyphen or contain two consecutive hyphens. |
DBSubnetGroupName | string | The subnet group name to use for the new cluster. Constraints: If provided, must match the name of an existing DBSubnetGroup. Example: mySubnetgroup |
DeletionProtection | boolean | Specifies whether this cluster can be deleted. If DeletionProtection is enabled, the cluster cannot be deleted unless it is modified and DeletionProtection is disabled. DeletionProtection protects clusters from being accidentally deleted. |
EnableCloudwatchLogsExports | array | A list of log types that must be enabled for exporting to Amazon CloudWatch Logs. |
Engine | string | The database engine to use for the new cluster. Default: The same as source. Constraint: Must be compatible with the engine of the source. |
EngineVersion | string | The version of the database engine to use for the new cluster. |
Filters | array | A filter that specifies one or more clusters to describe. Supported filters: db-cluster-id - Accepts cluster identifiers and cluster Amazon Resource Names (ARNs). The results list only includes information about the clusters identified by these ARNs. |
FinalDBSnapshotIdentifier | string | The cluster snapshot identifier of the new cluster snapshot created when SkipFinalSnapshot is set to false. Specifying this parameter and also setting the SkipFinalShapshot parameter to true results in an error. Constraints: Must be from 1 to 255 letters, numbers, or hyphens. The first character must be a letter. Cannot end with a hyphen or contain two consecutive hyphens. |
GlobalClusterIdentifier | string | The cluster identifier of the new global cluster. |
KmsKeyId | string | The KMS key identifier to use when restoring an encrypted cluster from an encrypted cluster. The KMS key identifier is the Amazon Resource Name (ARN) for the KMS encryption key. If you are restoring a cluster with the same Amazon Web Services account that owns the KMS encryption key used to encrypt the new cluster, then you can use the KMS key alias instead of the ARN for the KMS encryption key. You can restore to a new cluster and encrypt the new cluster with an KMS key that is different from the KMS key used to encrypt the source cluster. The new DB cluster is encrypted with the KMS key identified by the KmsKeyId parameter. If you do not specify a value for the KmsKeyId parameter, then the following occurs: If the cluster is encrypted, then the restored cluster is encrypted using the KMS key that was used to encrypt the source cluster. If the cluster is not encrypted, then the restored cluster is not encrypted. If DBClusterIdentifier refers to a cluster that is not encrypted, then the restore request is rejected. |
ManageMasterUserPassword | boolean | Specifies whether to manage the master user password with Amazon Web Services Secrets Manager. If the cluster doesn't manage the master user password with Amazon Web Services Secrets Manager, you can turn on this management. In this case, you can't specify MasterUserPassword. If the cluster already manages the master user password with Amazon Web Services Secrets Manager, and you specify that the master user password is not managed with Amazon Web Services Secrets Manager, then you must specify MasterUserPassword. In this case, Amazon DocumentDB deletes the secret and uses the new password for the master user specified by MasterUserPassword. |
Marker | string | An optional pagination token provided by a previous request. If this parameter is specified, the response includes only records beyond the marker, up to the value specified by MaxRecords. |
MasterUserPassword | string | The password for the master database user. This password can contain any printable ASCII character except forward slash (/), double quote ("), or the "at" symbol (@). Constraints: Must contain from 8 to 100 characters. |
MasterUserSecretKmsKeyId | string | The Amazon Web Services KMS key identifier to encrypt a secret that is automatically generated and managed in Amazon Web Services Secrets Manager. This setting is valid only if both of the following conditions are met: The cluster doesn't manage the master user password in Amazon Web Services Secrets Manager. If the cluster already manages the master user password in Amazon Web Services Secrets Manager, you can't change the KMS key that is used to encrypt the secret. You are enabling ManageMasterUserPassword to manage the master user password in Amazon Web Services Secrets Manager. If you are turning on ManageMasterUserPassword and don't specify MasterUserSecretKmsKeyId, then the aws/secretsmanager KMS key is used to encrypt the secret. If the secret is in a different Amazon Web Services account, then you can't use the aws/secretsmanager KMS key to encrypt the secret, and you must use a customer managed KMS key. The Amazon Web Services KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key. To use a KMS key in a different Amazon Web Services account, specify the key ARN or alias ARN. There is a default KMS key for your Amazon Web Services account. Your Amazon Web Services account has a different default KMS key for each Amazon Web Services Region. |
MasterUsername | string | The name of the master user for the cluster. Constraints: Must be from 1 to 63 letters or numbers. The first character must be a letter. Cannot be a reserved word for the chosen database engine. |
MaxRecords | integer | The maximum number of records to include in the response. If more records exist than the specified MaxRecords value, a pagination token (marker) is included in the response so that the remaining results can be retrieved. Default: 100 Constraints: Minimum 20, maximum 100. |
NetworkType | string | The network type of the cluster. The network type is determined by the DBSubnetGroup specified for the cluster. A DBSubnetGroup can support only the IPv4 protocol or the IPv4 and the IPv6 protocols (DUAL). For more information, see DocumentDB clusters in a VPC in the Amazon DocumentDB Developer Guide. Valid Values: IPV4 | DUAL |
NewDBClusterIdentifier | string | The new cluster identifier for the cluster when renaming a cluster. This value is stored as a lowercase string. Constraints: Must contain from 1 to 63 letters, numbers, or hyphens. The first character must be a letter. Cannot end with a hyphen or contain two consecutive hyphens. Example: my-cluster2 |
Port | integer | The port number on which the new cluster accepts connections. Constraints: Must be a value from 1150 to 65535. Default: The default port for the engine. |
PreSignedUrl | string | The URL that contains a Signature Version 4 signed request for theCopyDBClusterSnapshot API action in the Amazon Web Services Region that contains the source cluster snapshot to copy. You must use the PreSignedUrl parameter when copying a cluster snapshot from another Amazon Web Services Region. If you are using an Amazon Web Services SDK tool or the CLI, you can specify SourceRegion (or --source-region for the CLI) instead of specifying PreSignedUrl manually. Specifying SourceRegion autogenerates a pre-signed URL that is a valid request for the operation that can be executed in the source Amazon Web Services Region. The presigned URL must be a valid request for the CopyDBClusterSnapshot API action that can be executed in the source Amazon Web Services Region that contains the cluster snapshot to be copied. The presigned URL request must contain the following parameter values: SourceRegion - The ID of the region that contains the snapshot to be copied. SourceDBClusterSnapshotIdentifier - The identifier for the the encrypted cluster snapshot to be copied. This identifier must be in the Amazon Resource Name (ARN) format for the source Amazon Web Services Region. For example, if you are copying an encrypted cluster snapshot from the us-east-1 Amazon Web Services Region, then your SourceDBClusterSnapshotIdentifier looks something like the following: arn:aws:rds:us-east-1:12345678012:sample-cluster:sample-cluster-snapshot. TargetDBClusterSnapshotIdentifier - The identifier for the new cluster snapshot to be created. This parameter isn't case sensitive. |
PreferredBackupWindow | string | The daily time range during which automated backups are created if automated backups are enabled, using the BackupRetentionPeriod parameter. The default is a 30-minute window selected at random from an 8-hour block of time for each Amazon Web Services Region. Constraints: Must be in the format hh24:mi-hh24:mi. Must be in Universal Coordinated Time (UTC). Must not conflict with the preferred maintenance window. Must be at least 30 minutes. |
PreferredMaintenanceWindow | string | The weekly time range during which system maintenance can occur, in Universal Coordinated Time (UTC). Format: ddd:hh24:mi-ddd:hh24:mi The default is a 30-minute window selected at random from an 8-hour block of time for each Amazon Web Services Region, occurring on a random day of the week. Valid days: Mon, Tue, Wed, Thu, Fri, Sat, Sun Constraints: Minimum 30-minute window. |
RestoreToTime | string (date-time) | The date and time to restore the cluster to. Valid values: A time in Universal Coordinated Time (UTC) format. Constraints: Must be before the latest restorable time for the instance. Must be specified if the UseLatestRestorableTime parameter is not provided. Cannot be specified if the UseLatestRestorableTime parameter is true. Cannot be specified if the RestoreType parameter is copy-on-write. Example: 2015-03-07T23:45:00Z |
RestoreType | string | The type of restore to be performed. You can specify one of the following values: full-copy - The new DB cluster is restored as a full copy of the source DB cluster. copy-on-write - The new DB cluster is restored as a clone of the source DB cluster. Constraints: You can't specify copy-on-write if the engine version of the source DB cluster is earlier than 1.11. If you don't specify a RestoreType value, then the new DB cluster is restored as a full copy of the source DB cluster. |
RotateMasterUserPassword | boolean | Specifies whether to rotate the secret managed by Amazon Web Services Secrets Manager for the master user password. This setting is valid only if the master user password is managed by Amazon DocumentDB in Amazon Web Services Secrets Manager for the cluster. The secret value contains the updated password. Constraint: You must apply the change immediately when rotating the master user password. |
ServerlessV2ScalingConfiguration | object | Contains the scaling configuration of an Amazon DocumentDB Serverless cluster. |
SkipFinalSnapshot | boolean | Determines whether a final cluster snapshot is created before the cluster is deleted. If true is specified, no cluster snapshot is created. If false is specified, a cluster snapshot is created before the DB cluster is deleted. If SkipFinalSnapshot is false, you must specify a FinalDBSnapshotIdentifier parameter. Default: false |
StorageEncrypted | boolean | Specifies whether the cluster is encrypted. |
StorageType | string | The storage type to associate with the DB cluster. For information on storage types for Amazon DocumentDB clusters, see Cluster storage configurations in the Amazon DocumentDB Developer Guide. Valid values for storage type - standard | iopt1 Default value is standard |
Tags | array | The tags to be assigned to the restored cluster. |
UseLatestRestorableTime | boolean | A value that is set to true to restore the cluster to the latest restorable backup time, and false otherwise. Default: false Constraints: Cannot be specified if the RestoreToTime parameter is provided. |
VpcSecurityGroupIds | array | A list of VPC security groups that the new cluster belongs to. |
SELECT examples
- describe_db_clusters
Returns information about provisioned Amazon DocumentDB clusters. This API operation supports pagination. For certain management features such as cluster and instance lifecycle management, Amazon DocumentDB leverages operational technology that is shared with Amazon RDS and Amazon Neptune. Use the filterName=engine,Values=docdb filter parameter to return only Amazon DocumentDB clusters.
SELECT
associated_roles,
availability_zones,
backup_retention_period,
clone_group_id,
cluster_create_time,
db_cluster_arn,
db_cluster_identifier,
db_cluster_members,
db_cluster_parameter_group,
db_subnet_group,
db_cluster_resource_id,
deletion_protection,
earliest_restorable_time,
enabled_cloudwatch_logs_exports,
endpoint,
engine,
engine_version,
hosted_zone_id,
io_optimized_next_allowed_modification_time,
kms_key_id,
latest_restorable_time,
master_user_secret,
master_username,
multi_az,
network_type,
percent_progress,
port,
preferred_backup_window,
preferred_maintenance_window,
read_replica_identifiers,
reader_endpoint,
replication_source_identifier,
serverless_v2_scaling_configuration,
status,
storage_encrypted,
storage_type,
vpc_security_groups
FROM aws.docdb.db_clusters
WHERE region = '{{ region }}' -- required
AND DBClusterIdentifier = '{{ DBClusterIdentifier }}'
AND Filters = '{{ Filters }}'
AND MaxRecords = '{{ MaxRecords }}'
AND Marker = '{{ Marker }}'
;
INSERT examples
- create_db_cluster
- Manifest
Creates a new Amazon DocumentDB cluster.
INSERT INTO aws.docdb.db_clusters (
DBClusterIdentifier,
region,
AvailabilityZones,
BackupRetentionPeriod,
DBClusterParameterGroupName,
VpcSecurityGroupIds,
DBSubnetGroupName,
Engine,
EngineVersion,
Port,
MasterUsername,
MasterUserPassword,
PreferredBackupWindow,
PreferredMaintenanceWindow,
Tags,
StorageEncrypted,
KmsKeyId,
PreSignedUrl,
EnableCloudwatchLogsExports,
DeletionProtection,
GlobalClusterIdentifier,
StorageType,
ServerlessV2ScalingConfiguration,
ManageMasterUserPassword,
MasterUserSecretKmsKeyId,
NetworkType
)
SELECT
'{{ DBClusterIdentifier }}',
'{{ region }}',
'{{ AvailabilityZones }}',
'{{ BackupRetentionPeriod }}',
'{{ DBClusterParameterGroupName }}',
'{{ VpcSecurityGroupIds }}',
'{{ DBSubnetGroupName }}',
'{{ Engine }}',
'{{ EngineVersion }}',
'{{ Port }}',
'{{ MasterUsername }}',
'{{ MasterUserPassword }}',
'{{ PreferredBackupWindow }}',
'{{ PreferredMaintenanceWindow }}',
'{{ Tags }}',
'{{ StorageEncrypted }}',
'{{ KmsKeyId }}',
'{{ PreSignedUrl }}',
'{{ EnableCloudwatchLogsExports }}',
'{{ DeletionProtection }}',
'{{ GlobalClusterIdentifier }}',
'{{ StorageType }}',
'{{ ServerlessV2ScalingConfiguration }}',
'{{ ManageMasterUserPassword }}',
'{{ MasterUserSecretKmsKeyId }}',
'{{ NetworkType }}'
RETURNING
associated_roles,
availability_zones,
backup_retention_period,
clone_group_id,
cluster_create_time,
db_cluster_arn,
db_cluster_identifier,
db_cluster_members,
db_cluster_parameter_group,
db_subnet_group,
db_cluster_resource_id,
deletion_protection,
earliest_restorable_time,
enabled_cloudwatch_logs_exports,
endpoint,
engine,
engine_version,
hosted_zone_id,
io_optimized_next_allowed_modification_time,
kms_key_id,
latest_restorable_time,
master_user_secret,
master_username,
multi_az,
network_type,
percent_progress,
port,
preferred_backup_window,
preferred_maintenance_window,
read_replica_identifiers,
reader_endpoint,
replication_source_identifier,
serverless_v2_scaling_configuration,
status,
storage_encrypted,
storage_type,
vpc_security_groups
;
# Description fields are for documentation purposes
- name: db_clusters
props:
- name: DBClusterIdentifier
value: "{{ DBClusterIdentifier }}"
description: Required parameter for the db_clusters resource.
- name: region
value: "{{ region }}"
description: Required parameter for the db_clusters resource.
- name: AvailabilityZones
value: "{{ AvailabilityZones }}"
description: A list of Amazon EC2 Availability Zones that instances in the cluster can be created in.
description: A list of Amazon EC2 Availability Zones that instances in the cluster can be created in.
- name: BackupRetentionPeriod
value: {{ BackupRetentionPeriod }}
description: The number of days for which automated backups are retained. You must specify a minimum value of 1. Default: 1 Constraints: Must be a value from 1 to 35.
description: The number of days for which automated backups are retained. You must specify a minimum value of 1. Default: 1 Constraints: Must be a value from 1 to 35.
- name: DBClusterParameterGroupName
value: "{{ DBClusterParameterGroupName }}"
description: The name of the cluster parameter group to associate with this cluster.
description: The name of the cluster parameter group to associate with this cluster.
- name: VpcSecurityGroupIds
value: "{{ VpcSecurityGroupIds }}"
description: A list of EC2 VPC security groups to associate with this cluster.
description: A list of EC2 VPC security groups to associate with this cluster.
- name: DBSubnetGroupName
value: "{{ DBSubnetGroupName }}"
description: A subnet group to associate with this cluster. Constraints: Must match the name of an existing DBSubnetGroup. Must not be default. Example: mySubnetgroup
description: A subnet group to associate with this cluster. Constraints: Must match the name of an existing DBSubnetGroup. Must not be default. Example: mySubnetgroup
- name: Engine
value: "{{ Engine }}"
description: The name of the database engine to be used for this cluster. Valid values: docdb
description: The name of the database engine to be used for this cluster. Valid values: docdb
- name: EngineVersion
value: "{{ EngineVersion }}"
description: The version number of the database engine to use. The --engine-version will default to the latest major engine version. For production workloads, we recommend explicitly declaring this parameter with the intended major engine version.
description: The version number of the database engine to use. The --engine-version will default to the latest major engine version. For production workloads, we recommend explicitly declaring this parameter with the intended major engine version.
- name: Port
value: {{ Port }}
description: The port number on which the instances in the cluster accept connections.
description: The port number on which the instances in the cluster accept connections.
- name: MasterUsername
value: "{{ MasterUsername }}"
description: The name of the master user for the cluster. Constraints: Must be from 1 to 63 letters or numbers. The first character must be a letter. Cannot be a reserved word for the chosen database engine.
description: The name of the master user for the cluster. Constraints: Must be from 1 to 63 letters or numbers. The first character must be a letter. Cannot be a reserved word for the chosen database engine.
- name: MasterUserPassword
value: "{{ MasterUserPassword }}"
description: The password for the master database user. This password can contain any printable ASCII character except forward slash (/), double quote ("), or the "at" symbol (@). Constraints: Must contain from 8 to 100 characters.
description: The password for the master database user. This password can contain any printable ASCII character except forward slash (/), double quote ("), or the "at" symbol (@). Constraints: Must contain from 8 to 100 characters.
- name: PreferredBackupWindow
value: "{{ PreferredBackupWindow }}"
description: The daily time range during which automated backups are created if automated backups are enabled using the BackupRetentionPeriod parameter. The default is a 30-minute window selected at random from an 8-hour block of time for each Amazon Web Services Region. Constraints: Must be in the format hh24:mi-hh24:mi. Must be in Universal Coordinated Time (UTC). Must not conflict with the preferred maintenance window. Must be at least 30 minutes.
description: The daily time range during which automated backups are created if automated backups are enabled using the BackupRetentionPeriod parameter. The default is a 30-minute window selected at random from an 8-hour block of time for each Amazon Web Services Region. Constraints: Must be in the format hh24:mi-hh24:mi. Must be in Universal Coordinated Time (UTC). Must not conflict with the preferred maintenance window. Must be at least 30 minutes.
- name: PreferredMaintenanceWindow
value: "{{ PreferredMaintenanceWindow }}"
description: The weekly time range during which system maintenance can occur, in Universal Coordinated Time (UTC). Format: ddd:hh24:mi-ddd:hh24:mi The default is a 30-minute window selected at random from an 8-hour block of time for each Amazon Web Services Region, occurring on a random day of the week. Valid days: Mon, Tue, Wed, Thu, Fri, Sat, Sun Constraints: Minimum 30-minute window.
description: The weekly time range during which system maintenance can occur, in Universal Coordinated Time (UTC). Format: ddd:hh24:mi-ddd:hh24:mi The default is a 30-minute window selected at random from an 8-hour block of time for each Amazon Web Services Region, occurring on a random day of the week. Valid days: Mon, Tue, Wed, Thu, Fri, Sat, Sun Constraints: Minimum 30-minute window.
- name: Tags
value: "{{ Tags }}"
description: The tags to be assigned to the cluster.
description: The tags to be assigned to the cluster.
- name: StorageEncrypted
value: {{ StorageEncrypted }}
description: Specifies whether the cluster is encrypted.
description: Specifies whether the cluster is encrypted.
- name: KmsKeyId
value: "{{ KmsKeyId }}"
description: The KMS key identifier for an encrypted cluster. The KMS key identifier is the Amazon Resource Name (ARN) for the KMS encryption key. If you are creating a cluster using the same Amazon Web Services account that owns the KMS encryption key that is used to encrypt the new cluster, you can use the KMS key alias instead of the ARN for the KMS encryption key. If an encryption key is not specified in KmsKeyId: If the StorageEncrypted parameter is true, Amazon DocumentDB uses your default encryption key. KMS creates the default encryption key for your Amazon Web Services account. Your Amazon Web Services account has a different default encryption key for each Amazon Web Services Regions.
description: The KMS key identifier for an encrypted cluster. The KMS key identifier is the Amazon Resource Name (ARN) for the KMS encryption key. If you are creating a cluster using the same Amazon Web Services account that owns the KMS encryption key that is used to encrypt the new cluster, you can use the KMS key alias instead of the ARN for the KMS encryption key. If an encryption key is not specified in KmsKeyId: If the StorageEncrypted parameter is true, Amazon DocumentDB uses your default encryption key. KMS creates the default encryption key for your Amazon Web Services account. Your Amazon Web Services account has a different default encryption key for each Amazon Web Services Regions.
- name: PreSignedUrl
value: "{{ PreSignedUrl }}"
description: Not currently supported.
description: Not currently supported.
- name: EnableCloudwatchLogsExports
value: "{{ EnableCloudwatchLogsExports }}"
description: A list of log types that need to be enabled for exporting to Amazon CloudWatch Logs. You can enable audit logs or profiler logs. For more information, see Auditing Amazon DocumentDB Events and Profiling Amazon DocumentDB Operations.
description: A list of log types that need to be enabled for exporting to Amazon CloudWatch Logs. You can enable audit logs or profiler logs. For more information, see Auditing Amazon DocumentDB Events and Profiling Amazon DocumentDB Operations.
- name: DeletionProtection
value: {{ DeletionProtection }}
description: Specifies whether this cluster can be deleted. If DeletionProtection is enabled, the cluster cannot be deleted unless it is modified and DeletionProtection is disabled. DeletionProtection protects clusters from being accidentally deleted.
description: Specifies whether this cluster can be deleted. If DeletionProtection is enabled, the cluster cannot be deleted unless it is modified and DeletionProtection is disabled. DeletionProtection protects clusters from being accidentally deleted.
- name: GlobalClusterIdentifier
value: "{{ GlobalClusterIdentifier }}"
description: The cluster identifier of the new global cluster.
description: The cluster identifier of the new global cluster.
- name: StorageType
value: "{{ StorageType }}"
description: The storage type to associate with the DB cluster. For information on storage types for Amazon DocumentDB clusters, see Cluster storage configurations in the Amazon DocumentDB Developer Guide. Valid values for storage type - standard | iopt1 Default value is standard When you create an Amazon DocumentDB cluster with the storage type set to iopt1, the storage type is returned in the response. The storage type isn't returned when you set it to standard.
description: The storage type to associate with the DB cluster. For information on storage types for Amazon DocumentDB clusters, see Cluster storage configurations in the Amazon DocumentDB Developer Guide. Valid values for storage type - standard | iopt1 Default value is standard When you create an Amazon DocumentDB cluster with the storage type set to iopt1, the storage type is returned in the response. The storage type isn't returned when you set it to standard.
- name: ServerlessV2ScalingConfiguration
value: "{{ ServerlessV2ScalingConfiguration }}"
description: Contains the scaling configuration of an Amazon DocumentDB Serverless cluster.
description: Contains the scaling configuration of an Amazon DocumentDB Serverless cluster.
- name: ManageMasterUserPassword
value: {{ ManageMasterUserPassword }}
description: Specifies whether to manage the master user password with Amazon Web Services Secrets Manager. Constraint: You can't manage the master user password with Amazon Web Services Secrets Manager if MasterUserPassword is specified.
description: Specifies whether to manage the master user password with Amazon Web Services Secrets Manager. Constraint: You can't manage the master user password with Amazon Web Services Secrets Manager if MasterUserPassword is specified.
- name: MasterUserSecretKmsKeyId
value: "{{ MasterUserSecretKmsKeyId }}"
description: The Amazon Web Services KMS key identifier to encrypt a secret that is automatically generated and managed in Amazon Web Services Secrets Manager. This setting is valid only if the master user password is managed by Amazon DocumentDB in Amazon Web Services Secrets Manager for the DB cluster. The Amazon Web Services KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key. To use a KMS key in a different Amazon Web Services account, specify the key ARN or alias ARN. If you don't specify MasterUserSecretKmsKeyId, then the aws/secretsmanager KMS key is used to encrypt the secret. If the secret is in a different Amazon Web Services account, then you can't use the aws/secretsmanager KMS key to encrypt the secret, and you must use a customer managed KMS key. There is a default KMS key for your Amazon Web Services account. Your Amazon Web Services account has a different default KMS key for each Amazon Web Services Region.
description: The Amazon Web Services KMS key identifier to encrypt a secret that is automatically generated and managed in Amazon Web Services Secrets Manager. This setting is valid only if the master user password is managed by Amazon DocumentDB in Amazon Web Services Secrets Manager for the DB cluster. The Amazon Web Services KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key. To use a KMS key in a different Amazon Web Services account, specify the key ARN or alias ARN. If you don't specify MasterUserSecretKmsKeyId, then the aws/secretsmanager KMS key is used to encrypt the secret. If the secret is in a different Amazon Web Services account, then you can't use the aws/secretsmanager KMS key to encrypt the secret, and you must use a customer managed KMS key. There is a default KMS key for your Amazon Web Services account. Your Amazon Web Services account has a different default KMS key for each Amazon Web Services Region.
- name: NetworkType
value: "{{ NetworkType }}"
description: The network type of the cluster. The network type is determined by the DBSubnetGroup specified for the cluster. A DBSubnetGroup can support only the IPv4 protocol or the IPv4 and the IPv6 protocols (DUAL). For more information, see DocumentDB clusters in a VPC in the Amazon DocumentDB Developer Guide. Valid Values: IPV4 | DUAL
description: The network type of the cluster. The network type is determined by the DBSubnetGroup specified for the cluster. A DBSubnetGroup can support only the IPv4 protocol or the IPv4 and the IPv6 protocols (DUAL). For more information, see DocumentDB clusters in a VPC in the Amazon DocumentDB Developer Guide. Valid Values: IPV4 | DUAL
UPDATE examples
- modify_db_cluster
Modifies a setting for an Amazon DocumentDB cluster. You can change one or more database configuration parameters by specifying these parameters and the new values in the request.
UPDATE aws.docdb.db_clusters
SET
-- No updatable properties
WHERE
DBClusterIdentifier = '{{ DBClusterIdentifier }}' --required
AND region = '{{ region }}' --required
AND NewDBClusterIdentifier = '{{ NewDBClusterIdentifier}}'
AND ApplyImmediately = {{ ApplyImmediately}}
AND BackupRetentionPeriod = '{{ BackupRetentionPeriod}}'
AND DBClusterParameterGroupName = '{{ DBClusterParameterGroupName}}'
AND VpcSecurityGroupIds = '{{ VpcSecurityGroupIds}}'
AND Port = '{{ Port}}'
AND MasterUserPassword = '{{ MasterUserPassword}}'
AND PreferredBackupWindow = '{{ PreferredBackupWindow}}'
AND PreferredMaintenanceWindow = '{{ PreferredMaintenanceWindow}}'
AND CloudwatchLogsExportConfiguration = '{{ CloudwatchLogsExportConfiguration}}'
AND EngineVersion = '{{ EngineVersion}}'
AND AllowMajorVersionUpgrade = {{ AllowMajorVersionUpgrade}}
AND DeletionProtection = {{ DeletionProtection}}
AND StorageType = '{{ StorageType}}'
AND ServerlessV2ScalingConfiguration = '{{ ServerlessV2ScalingConfiguration}}'
AND ManageMasterUserPassword = {{ ManageMasterUserPassword}}
AND MasterUserSecretKmsKeyId = '{{ MasterUserSecretKmsKeyId}}'
AND RotateMasterUserPassword = {{ RotateMasterUserPassword}}
AND NetworkType = '{{ NetworkType}}'
RETURNING
associated_roles,
availability_zones,
backup_retention_period,
clone_group_id,
cluster_create_time,
db_cluster_arn,
db_cluster_identifier,
db_cluster_members,
db_cluster_parameter_group,
db_subnet_group,
db_cluster_resource_id,
deletion_protection,
earliest_restorable_time,
enabled_cloudwatch_logs_exports,
endpoint,
engine,
engine_version,
hosted_zone_id,
io_optimized_next_allowed_modification_time,
kms_key_id,
latest_restorable_time,
master_user_secret,
master_username,
multi_az,
network_type,
percent_progress,
port,
preferred_backup_window,
preferred_maintenance_window,
read_replica_identifiers,
reader_endpoint,
replication_source_identifier,
serverless_v2_scaling_configuration,
status,
storage_encrypted,
storage_type,
vpc_security_groups;
DELETE examples
- delete_db_cluster
Deletes a previously provisioned cluster. When you delete a cluster, all automated backups for that cluster are deleted and can't be recovered. Manual DB cluster snapshots of the specified cluster are not deleted.
DELETE FROM aws.docdb.db_clusters
WHERE DBClusterIdentifier = '{{ DBClusterIdentifier }}' --required
AND region = '{{ region }}' --required
AND SkipFinalSnapshot = '{{ SkipFinalSnapshot }}'
AND FinalDBSnapshotIdentifier = '{{ FinalDBSnapshotIdentifier }}'
;
Lifecycle Methods
- copy_db_cluster_snapshot
- restore_db_cluster_from_snapshot
- restore_db_cluster_to_point_in_time
- start_db_cluster
- stop_db_cluster
Copies a snapshot of a cluster. To copy a cluster snapshot from a shared manual cluster snapshot, SourceDBClusterSnapshotIdentifier must be the Amazon Resource Name (ARN) of the shared cluster snapshot. You can only copy a shared DB cluster snapshot, whether encrypted or not, in the same Amazon Web Services Region. To cancel the copy operation after it is in progress, delete the target cluster snapshot identified by TargetDBClusterSnapshotIdentifier while that cluster snapshot is in the copying status.
EXEC aws.docdb.db_clusters.copy_db_cluster_snapshot
@SourceDBClusterSnapshotIdentifier='{{ SourceDBClusterSnapshotIdentifier }}' --required,
@TargetDBClusterSnapshotIdentifier='{{ TargetDBClusterSnapshotIdentifier }}' --required,
@region='{{ region }}' --required,
@KmsKeyId='{{ KmsKeyId }}',
@PreSignedUrl='{{ PreSignedUrl }}',
@CopyTags={{ CopyTags }},
@Tags='{{ Tags }}'
;
Creates a new cluster from a snapshot or cluster snapshot. If a snapshot is specified, the target cluster is created from the source DB snapshot with a default configuration and default security group. If a cluster snapshot is specified, the target cluster is created from the source cluster restore point with the same configuration as the original source DB cluster, except that the new cluster is created with the default security group.
EXEC aws.docdb.db_clusters.restore_db_cluster_from_snapshot
@DBClusterIdentifier='{{ DBClusterIdentifier }}' --required,
@SnapshotIdentifier='{{ SnapshotIdentifier }}' --required,
@region='{{ region }}' --required,
@AvailabilityZones='{{ AvailabilityZones }}',
@Engine='{{ Engine }}',
@EngineVersion='{{ EngineVersion }}',
@Port='{{ Port }}',
@DBSubnetGroupName='{{ DBSubnetGroupName }}',
@VpcSecurityGroupIds='{{ VpcSecurityGroupIds }}',
@Tags='{{ Tags }}',
@KmsKeyId='{{ KmsKeyId }}',
@EnableCloudwatchLogsExports='{{ EnableCloudwatchLogsExports }}',
@DeletionProtection={{ DeletionProtection }},
@DBClusterParameterGroupName='{{ DBClusterParameterGroupName }}',
@ServerlessV2ScalingConfiguration='{{ ServerlessV2ScalingConfiguration }}',
@StorageType='{{ StorageType }}',
@NetworkType='{{ NetworkType }}'
;
Restores a cluster to an arbitrary point in time. Users can restore to any point in time before LatestRestorableTime for up to BackupRetentionPeriod days. The target cluster is created from the source cluster with the same configuration as the original cluster, except that the new cluster is created with the default security group.
EXEC aws.docdb.db_clusters.restore_db_cluster_to_point_in_time
@DBClusterIdentifier='{{ DBClusterIdentifier }}' --required,
@SourceDBClusterIdentifier='{{ SourceDBClusterIdentifier }}' --required,
@region='{{ region }}' --required,
@RestoreType='{{ RestoreType }}',
@RestoreToTime='{{ RestoreToTime }}',
@UseLatestRestorableTime={{ UseLatestRestorableTime }},
@Port='{{ Port }}',
@DBSubnetGroupName='{{ DBSubnetGroupName }}',
@VpcSecurityGroupIds='{{ VpcSecurityGroupIds }}',
@Tags='{{ Tags }}',
@KmsKeyId='{{ KmsKeyId }}',
@EnableCloudwatchLogsExports='{{ EnableCloudwatchLogsExports }}',
@DeletionProtection={{ DeletionProtection }},
@ServerlessV2ScalingConfiguration='{{ ServerlessV2ScalingConfiguration }}',
@StorageType='{{ StorageType }}',
@NetworkType='{{ NetworkType }}'
;
Restarts the stopped cluster that is specified by DBClusterIdentifier. For more information, see Stopping and Starting an Amazon DocumentDB Cluster.
EXEC aws.docdb.db_clusters.start_db_cluster
@DBClusterIdentifier='{{ DBClusterIdentifier }}' --required,
@region='{{ region }}' --required
;
Stops the running cluster that is specified by DBClusterIdentifier. The cluster must be in the available state. For more information, see Stopping and Starting an Amazon DocumentDB Cluster.
EXEC aws.docdb.db_clusters.stop_db_cluster
@DBClusterIdentifier='{{ DBClusterIdentifier }}' --required,
@region='{{ region }}' --required
;