Skip to main content

db_instances

Creates, updates, deletes, gets or lists a db_instances resource.

Overview

Namedb_instances
TypeResource
Idaws.docdb.db_instances

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
auto_minor_version_upgradebooleanDoes not apply. This parameter does not apply to Amazon DocumentDB. Amazon DocumentDB does not perform minor version upgrades regardless of the value set.
availability_zonestringSpecifies the name of the Availability Zone that the instance is located in.
backup_retention_periodintegerSpecifies the number of days for which automatic snapshots are retained.
ca_certificate_identifierstringThe identifier of the CA certificate for this DB instance.
certificate_detailsstringThe details of the DB instance's server certificate.
copy_tags_to_snapshotbooleanA value that indicates whether to copy tags from the DB instance to snapshots of the DB instance. By default, tags are not copied.
db_cluster_identifierstringContains the name of the cluster that the instance is a member of if the instance is a member of a cluster.
db_instance_arnstringThe Amazon Resource Name (ARN) for the instance.
db_instance_classstringContains the name of the compute and memory capacity class of the instance.
db_instance_identifierstringContains a user-provided database identifier. This identifier is the unique key that identifies an instance.
db_instance_statusstringSpecifies the current state of this database.
db_subnet_groupstringSpecifies information on the subnet group that is associated with the instance, including the name, description, and subnets in the subnet group.
dbi_resource_idstringThe Amazon Web Services Region-unique, immutable identifier for the instance. This identifier is found in CloudTrail log entries whenever the KMS key for the instance is accessed.
enabled_cloudwatch_logs_exportsstringA list of log types that this instance is configured to export to CloudWatch Logs.
endpointstringSpecifies the connection endpoint.
enginestringProvides the name of the database engine to be used for this instance.
engine_versionstringIndicates the database engine version.
instance_create_timestringProvides the date and time that the instance was created.
kms_key_idstringIf StorageEncrypted is true, the KMS key identifier for the encrypted instance.
latest_restorable_timestringSpecifies the latest time to which a database can be restored with point-in-time restore.
pending_modified_valuesstringSpecifies that changes to the instance are pending. This element is included only when changes are pending. Specific changes are identified by subelements.
performance_insights_enabledbooleanSet to true if Amazon RDS Performance Insights is enabled for the DB instance, and otherwise false.
performance_insights_kms_key_idstringThe KMS key identifier for encryption of Performance Insights data. The KMS key ID is the Amazon Resource Name (ARN), KMS key identifier, or the KMS key alias for the KMS encryption key.
preferred_backup_windowstringSpecifies the daily time range during which automated backups are created if automated backups are enabled, as determined by the BackupRetentionPeriod.
preferred_maintenance_windowstringSpecifies the weekly time range during which system maintenance can occur, in Universal Coordinated Time (UTC).
promotion_tierintegerA value that specifies the order in which an Amazon DocumentDB replica is promoted to the primary instance after a failure of the existing primary instance.
publicly_accessiblebooleanNot supported. Amazon DocumentDB does not currently support public endpoints. The value of PubliclyAccessible is always false.
status_infosstringThe status of a read replica. If the instance is not a read replica, this is blank.
storage_encryptedbooleanSpecifies whether or not the instance is encrypted.
vpc_security_groupsstringProvides a list of VPC security group elements that the instance belongs to.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_db_instancesselectregionDBInstanceIdentifier, Filters, MaxRecords, MarkerReturns information about provisioned Amazon DocumentDB instances. This API supports pagination.
create_db_instanceinsertDBInstanceIdentifier, DBInstanceClass, DBClusterIdentifier, regionEngine, AvailabilityZone, PreferredMaintenanceWindow, AutoMinorVersionUpgrade, Tags, CopyTagsToSnapshot, PromotionTier, EnablePerformanceInsights, PerformanceInsightsKMSKeyId, CACertificateIdentifierCreates a new instance.
modify_db_instanceupdateDBInstanceIdentifier, regionDBInstanceClass, ApplyImmediately, PreferredMaintenanceWindow, AutoMinorVersionUpgrade, NewDBInstanceIdentifier, CACertificateIdentifier, CopyTagsToSnapshot, PromotionTier, EnablePerformanceInsights, PerformanceInsightsKMSKeyId, CertificateRotationRestartModifies settings for an instance. You can change one or more database configuration parameters by specifying these parameters and the new values in the request.
delete_db_instancedeleteDBInstanceIdentifier, regionDeletes a previously provisioned instance.
reboot_db_instanceexecDBInstanceIdentifier, regionForceFailoverYou might need to reboot your instance, usually for maintenance reasons. For example, if you make certain changes, or if you change the cluster parameter group that is associated with the instance, you must reboot the instance for the changes to take effect. Rebooting an instance restarts the database engine service. Rebooting an instance results in a momentary outage, during which the instance status is set to rebooting.

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.

NameDatatypeDescription
DBClusterIdentifierstringThe identifier of the cluster that the instance will belong to.
DBInstanceClassstringThe compute and memory capacity of the instance; for example, db.r5.large.
DBInstanceIdentifierstringThe instance identifier. This parameter is stored as a lowercase string. Constraints: Must match the identifier of an existing DBInstance.
regionstringAWS region (default: us-east-1)
ApplyImmediatelybooleanSpecifies whether the modifications in this request and any pending modifications are asynchronously applied as soon as possible, regardless of the PreferredMaintenanceWindow setting for the instance. If this parameter is set to false, changes to the instance are applied during the next maintenance window. Some parameter changes can cause an outage and are applied on the next reboot. Default: false
AutoMinorVersionUpgradebooleanThis parameter does not apply to Amazon DocumentDB. Amazon DocumentDB does not perform minor version upgrades regardless of the value set.
AvailabilityZonestringThe Amazon EC2 Availability Zone that the instance is created in. Default: A random, system-chosen Availability Zone in the endpoint's Amazon Web Services Region. Example: us-east-1d
CACertificateIdentifierstringIndicates the certificate that needs to be associated with the instance.
CertificateRotationRestartbooleanSpecifies whether the DB instance is restarted when you rotate your SSL/TLS certificate. By default, the DB instance is restarted when you rotate your SSL/TLS certificate. The certificate is not updated until the DB instance is restarted. Set this parameter only if you are not using SSL/TLS to connect to the DB instance. If you are using SSL/TLS to connect to the DB instance, see Updating Your Amazon DocumentDB TLS Certificates and Encrypting Data in Transit in the Amazon DocumentDB Developer Guide.
CopyTagsToSnapshotbooleanA value that indicates whether to copy all tags from the DB instance to snapshots of the DB instance. By default, tags are not copied.
DBInstanceClassstringThe new compute and memory capacity of the instance; for example, db.r5.large. Not all instance classes are available in all Amazon Web Services Regions. If you modify the instance class, an outage occurs during the change. The change is applied during the next maintenance window, unless ApplyImmediately is specified as true for this request. Default: Uses existing setting.
DBInstanceIdentifierstringThe user-provided instance identifier. If this parameter is specified, information from only the specific instance is returned. This parameter isn't case sensitive. Constraints: If provided, must match the identifier of an existing DBInstance.
EnablePerformanceInsightsbooleanA value that indicates whether to enable Performance Insights for the DB Instance. For more information, see Using Amazon Performance Insights.
EnginestringThe name of the database engine to be used for this instance. Valid value: docdb
FiltersarrayA filter that specifies one or more instances to describe. Supported filters: db-cluster-id - Accepts cluster identifiers and cluster Amazon Resource Names (ARNs). The results list includes only the information about the instances that are associated with the clusters that are identified by these ARNs. db-instance-id - Accepts instance identifiers and instance ARNs. The results list includes only the information about the instances that are identified by these ARNs.
ForceFailoverbooleanWhen true, the reboot is conducted through a Multi-AZ failover. Constraint: You can't specify true if the instance is not configured for Multi-AZ.
MarkerstringAn 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.
MaxRecordsintegerThe 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.
NewDBInstanceIdentifierstringThe new instance identifier for the instance when renaming an instance. When you change the instance identifier, an instance reboot occurs immediately if you set Apply Immediately to true. It occurs during the next maintenance window if you set Apply Immediately to false. 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: mydbinstance
PerformanceInsightsKMSKeyIdstringThe KMS key identifier for encryption of Performance Insights data. The KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key. If you do not specify a value for PerformanceInsightsKMSKeyId, then Amazon DocumentDB uses your default 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.
PreferredMaintenanceWindowstringThe weekly time range (in UTC) during which system maintenance can occur, which might result in an outage. Changing this parameter doesn't result in an outage except in the following situation, and the change is asynchronously applied as soon as possible. If there are pending actions that cause a reboot, and the maintenance window is changed to include the current time, changing this parameter causes a reboot of the instance. If you are moving this window to the current time, there must be at least 30 minutes between the current time and end of the window to ensure that pending changes are applied. Default: Uses existing setting. Format: ddd:hh24:mi-ddd:hh24:mi Valid days: Mon, Tue, Wed, Thu, Fri, Sat, Sun Constraints: Must be at least 30 minutes.
PromotionTierintegerA value that specifies the order in which an Amazon DocumentDB replica is promoted to the primary instance after a failure of the existing primary instance. Default: 1 Valid values: 0-15
TagsarrayThe tags to be assigned to the instance. You can assign up to 10 tags to an instance.

SELECT examples

Returns information about provisioned Amazon DocumentDB instances. This API supports pagination.

SELECT
auto_minor_version_upgrade,
availability_zone,
backup_retention_period,
ca_certificate_identifier,
certificate_details,
copy_tags_to_snapshot,
db_cluster_identifier,
db_instance_arn,
db_instance_class,
db_instance_identifier,
db_instance_status,
db_subnet_group,
dbi_resource_id,
enabled_cloudwatch_logs_exports,
endpoint,
engine,
engine_version,
instance_create_time,
kms_key_id,
latest_restorable_time,
pending_modified_values,
performance_insights_enabled,
performance_insights_kms_key_id,
preferred_backup_window,
preferred_maintenance_window,
promotion_tier,
publicly_accessible,
status_infos,
storage_encrypted,
vpc_security_groups
FROM aws.docdb.db_instances
WHERE region = '{{ region }}' -- required
AND DBInstanceIdentifier = '{{ DBInstanceIdentifier }}'
AND Filters = '{{ Filters }}'
AND MaxRecords = '{{ MaxRecords }}'
AND Marker = '{{ Marker }}'
;

INSERT examples

Creates a new instance.

INSERT INTO aws.docdb.db_instances (
DBInstanceIdentifier,
DBInstanceClass,
DBClusterIdentifier,
region,
Engine,
AvailabilityZone,
PreferredMaintenanceWindow,
AutoMinorVersionUpgrade,
Tags,
CopyTagsToSnapshot,
PromotionTier,
EnablePerformanceInsights,
PerformanceInsightsKMSKeyId,
CACertificateIdentifier
)
SELECT
'{{ DBInstanceIdentifier }}',
'{{ DBInstanceClass }}',
'{{ DBClusterIdentifier }}',
'{{ region }}',
'{{ Engine }}',
'{{ AvailabilityZone }}',
'{{ PreferredMaintenanceWindow }}',
'{{ AutoMinorVersionUpgrade }}',
'{{ Tags }}',
'{{ CopyTagsToSnapshot }}',
'{{ PromotionTier }}',
'{{ EnablePerformanceInsights }}',
'{{ PerformanceInsightsKMSKeyId }}',
'{{ CACertificateIdentifier }}'
RETURNING
auto_minor_version_upgrade,
availability_zone,
backup_retention_period,
ca_certificate_identifier,
certificate_details,
copy_tags_to_snapshot,
db_cluster_identifier,
db_instance_arn,
db_instance_class,
db_instance_identifier,
db_instance_status,
db_subnet_group,
dbi_resource_id,
enabled_cloudwatch_logs_exports,
endpoint,
engine,
engine_version,
instance_create_time,
kms_key_id,
latest_restorable_time,
pending_modified_values,
performance_insights_enabled,
performance_insights_kms_key_id,
preferred_backup_window,
preferred_maintenance_window,
promotion_tier,
publicly_accessible,
status_infos,
storage_encrypted,
vpc_security_groups
;

UPDATE examples

Modifies settings for an instance. You can change one or more database configuration parameters by specifying these parameters and the new values in the request.

UPDATE aws.docdb.db_instances
SET
-- No updatable properties
WHERE
DBInstanceIdentifier = '{{ DBInstanceIdentifier }}' --required
AND region = '{{ region }}' --required
AND DBInstanceClass = '{{ DBInstanceClass}}'
AND ApplyImmediately = {{ ApplyImmediately}}
AND PreferredMaintenanceWindow = '{{ PreferredMaintenanceWindow}}'
AND AutoMinorVersionUpgrade = {{ AutoMinorVersionUpgrade}}
AND NewDBInstanceIdentifier = '{{ NewDBInstanceIdentifier}}'
AND CACertificateIdentifier = '{{ CACertificateIdentifier}}'
AND CopyTagsToSnapshot = {{ CopyTagsToSnapshot}}
AND PromotionTier = '{{ PromotionTier}}'
AND EnablePerformanceInsights = {{ EnablePerformanceInsights}}
AND PerformanceInsightsKMSKeyId = '{{ PerformanceInsightsKMSKeyId}}'
AND CertificateRotationRestart = {{ CertificateRotationRestart}}
RETURNING
auto_minor_version_upgrade,
availability_zone,
backup_retention_period,
ca_certificate_identifier,
certificate_details,
copy_tags_to_snapshot,
db_cluster_identifier,
db_instance_arn,
db_instance_class,
db_instance_identifier,
db_instance_status,
db_subnet_group,
dbi_resource_id,
enabled_cloudwatch_logs_exports,
endpoint,
engine,
engine_version,
instance_create_time,
kms_key_id,
latest_restorable_time,
pending_modified_values,
performance_insights_enabled,
performance_insights_kms_key_id,
preferred_backup_window,
preferred_maintenance_window,
promotion_tier,
publicly_accessible,
status_infos,
storage_encrypted,
vpc_security_groups;

DELETE examples

Deletes a previously provisioned instance.

DELETE FROM aws.docdb.db_instances
WHERE DBInstanceIdentifier = '{{ DBInstanceIdentifier }}' --required
AND region = '{{ region }}' --required
;

Lifecycle Methods

You might need to reboot your instance, usually for maintenance reasons. For example, if you make certain changes, or if you change the cluster parameter group that is associated with the instance, you must reboot the instance for the changes to take effect. Rebooting an instance restarts the database engine service. Rebooting an instance results in a momentary outage, during which the instance status is set to rebooting.

EXEC aws.docdb.db_instances.reboot_db_instance
@DBInstanceIdentifier='{{ DBInstanceIdentifier }}' --required,
@region='{{ region }}' --required,
@ForceFailover={{ ForceFailover }}
;