AWS Amazon DocumentDB Cluster Snapshot
This page shows how to write Terraform and CloudFormation for Amazon DocumentDB Cluster Snapshot and write them securely.
aws_docdb_cluster_snapshot (Terraform)
The Cluster Snapshot in Amazon DocumentDB can be configured in Terraform with the resource name aws_docdb_cluster_snapshot. The following sections describe 2 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "aws_docdb_cluster_snapshot" "my_aws_docdb_cluster_snapshot" {
db_cluster_identifier = "fake"
db_cluster_snapshot_identifier = "resourcetestsnapshot1234"
}
resource "aws_docdb_cluster_snapshot" "my_aws_docdb_cluster_snapshot_usage" {
resource "aws_docdb_cluster_snapshot" "snapshot" {
count = length(var.snapshot)
db_cluster_identifier = element(var.cluster_id, lookup(var.snapshot[count.index], "cluster_id"))
db_cluster_snapshot_identifier = lookup(var.snapshot[count.index], "db_cluster_snapshot_identifier")
Parameters
-
availability_zonesoptional computed - list of string -
db_cluster_identifierrequired - string -
db_cluster_snapshot_arnoptional computed - string -
db_cluster_snapshot_identifierrequired - string -
engineoptional computed - string -
engine_versionoptional computed - string -
idoptional computed - string -
kms_key_idoptional computed - string -
portoptional computed - number -
snapshot_typeoptional computed - string -
source_db_cluster_snapshot_arnoptional computed - string -
statusoptional computed - string -
storage_encryptedoptional computed - bool -
vpc_idoptional computed - string -
timeoutssingle block-
createoptional - string
-
Explanation in Terraform Registry
Manages a DocDB database cluster snapshot for DocDB clusters.
Tips: Best Practices for The Other AWS Amazon DocumentDB Resources
In addition to the aws_docdb, AWS Amazon DocumentDB has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.
aws_docdb_cluster
Ensure AWS DocumentDB logging is enabled
It is better to enable AWS DocumentDB logging for auditing and following compliance requirements.
AWS::DocDB::DBCluster (CloudFormation)
The DBCluster in DocDB can be configured in CloudFormation with the resource name AWS::DocDB::DBCluster. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
An example could not be found in GitHub.
Parameters
-
StorageEncryptedoptional - Boolean -
EngineVersionoptional - String -
KmsKeyIdoptional - String -
AvailabilityZonesoptional - List -
SnapshotIdentifieroptional - String -
Portoptional - Integer -
DBClusterIdentifieroptional - String -
PreferredMaintenanceWindowoptional - String -
DBSubnetGroupNameoptional - String -
DeletionProtectionoptional - Boolean -
PreferredBackupWindowoptional - String -
MasterUserPasswordrequired - String -
VpcSecurityGroupIdsoptional - List -
MasterUsernamerequired - String -
DBClusterParameterGroupNameoptional - String -
BackupRetentionPeriodoptional - Integer -
Tagsoptional - List of Tag -
EnableCloudwatchLogsExportsoptional - List
Explanation in CloudFormation Registry
The
AWS::DocDB::DBClusterAmazon DocumentDB (with MongoDB compatibility) resource describes a DBCluster. Amazon DocumentDB is a fully managed, MongoDB-compatible document database engine. For more information, see DBCluster in the Amazon DocumentDB Developer Guide.
Frequently asked questions
What is AWS Amazon DocumentDB Cluster Snapshot?
AWS Amazon DocumentDB Cluster Snapshot is a resource for Amazon DocumentDB of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.
Where can I find the example code for the AWS Amazon DocumentDB Cluster Snapshot?
For Terraform, the gilyas/infracost and mikamakusa/terraform source code examples are useful. See the Terraform Example section for further details.