Skip to content
v2.277.0

DatabaseInstanceProps Struct ​

Construction properties for a DatabaseInstanceNew.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_docdb as docdb } from 'aws-cdk-lib';
import { aws_ec2 as ec2 } from 'aws-cdk-lib';
import { aws_rds as rds } from 'aws-cdk-lib';
import { aws_docdb as interfaces_docdb } from 'aws-cdk-lib/interfaces';

declare const caCertificate: rds.CaCertificate;
declare const dBClusterRef: interfaces_docdb.IDBClusterRef;
declare const instanceType: ec2.InstanceType;
const databaseInstanceProps: docdb.DatabaseInstanceProps = {
  cluster: dBClusterRef,
  instanceType: instanceType,

  // the properties below are optional
  autoMinorVersionUpgrade: false,
  availabilityZone: 'availabilityZone',
  caCertificate: caCertificate,
  dbInstanceName: 'dbInstanceName',
  enablePerformanceInsights: false,
  preferredMaintenanceWindow: 'preferredMaintenanceWindow',
  removalPolicy: cdk.RemovalPolicy.DESTROY,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk
from aws_cdk import aws_docdb as docdb
from aws_cdk import aws_ec2 as ec2
from aws_cdk import aws_rds as rds
from aws_cdk.interfaces import aws_docdb as interfaces_docdb

# ca_certificate: rds.CaCertificate
# d_b_cluster_ref: interfaces_docdb.IDBClusterRef
# instance_type: ec2.InstanceType

database_instance_props = docdb.DatabaseInstanceProps(
    cluster=d_b_cluster_ref,
    instance_type=instance_type,

    # the properties below are optional
    auto_minor_version_upgrade=False,
    availability_zone="availabilityZone",
    ca_certificate=ca_certificate,
    db_instance_name="dbInstanceName",
    enable_performance_insights=False,
    preferred_maintenance_window="preferredMaintenanceWindow",
    removal_policy=cdk.RemovalPolicy.DESTROY
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.docdb.*;
import software.amazon.awscdk.services.ec2.*;
import software.amazon.awscdk.services.rds.*;
import software.amazon.awscdk.interfaces.docdb.*;

CaCertificate caCertificate;
IDBClusterRef dBClusterRef;
InstanceType instanceType;

DatabaseInstanceProps databaseInstanceProps = DatabaseInstanceProps.builder()
        .cluster(dBClusterRef)
        .instanceType(instanceType)

        // the properties below are optional
        .autoMinorVersionUpgrade(false)
        .availabilityZone("availabilityZone")
        .caCertificate(caCertificate)
        .dbInstanceName("dbInstanceName")
        .enablePerformanceInsights(false)
        .preferredMaintenanceWindow("preferredMaintenanceWindow")
        .removalPolicy(RemovalPolicy.DESTROY)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;
using Amazon.CDK.AWS.DocDB;
using Amazon.CDK.AWS.EC2;
using Amazon.CDK.AWS.RDS;
using Amazon.CDK.Interfaces.DocDB;

CaCertificate caCertificate;
IDBClusterRef dBClusterRef;
InstanceType instanceType;

var databaseInstanceProps = new DatabaseInstanceProps {
    Cluster = dBClusterRef,
    InstanceType = instanceType,

    // the properties below are optional
    AutoMinorVersionUpgrade = false,
    AvailabilityZone = "availabilityZone",
    CaCertificate = caCertificate,
    DbInstanceName = "dbInstanceName",
    EnablePerformanceInsights = false,
    PreferredMaintenanceWindow = "preferredMaintenanceWindow",
    RemovalPolicy = RemovalPolicy.DESTROY
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var caCertificate CaCertificate
var dBClusterRef IDBClusterRef
var instanceType InstanceType

databaseInstanceProps := &DatabaseInstanceProps{
	Cluster: dBClusterRef,
	InstanceType: instanceType,

	// the properties below are optional
	AutoMinorVersionUpgrade: jsii.Boolean(false),
	AvailabilityZone: jsii.String("availabilityZone"),
	CaCertificate: caCertificate,
	DbInstanceName: jsii.String("dbInstanceName"),
	EnablePerformanceInsights: jsii.Boolean(false),
	PreferredMaintenanceWindow: jsii.String("preferredMaintenanceWindow"),
	RemovalPolicy: cdk.RemovalPolicy_DESTROY,
}

Properties ​

autoMinorVersionUpgradeoptionalbooleanauto_minor_version_upgradeoptionalboolautoMinorVersionUpgradeoptionalBooleanAutoMinorVersionUpgradeoptionalboolAutoMinorVersionUpgradeoptional*bool= true#
Indicates that minor engine upgrades are applied automatically to the DB instance during the maintenance window.
availabilityZoneoptionalstringavailability_zoneoptionalstravailabilityZoneoptionalStringAvailabilityZoneoptionalstringAvailabilityZoneoptional*string#
The name of the Availability Zone where the DB instance will be located.

Default: no preference

caCertificateoptionalCaCertificateca_certificateoptionalCaCertificatecaCertificateoptionalCaCertificateCaCertificateoptionalCaCertificateCaCertificateoptionalCaCertificate#
The identifier of the CA certificate for this DB instance.

Default: DocumentDB will choose a certificate authority

Specifying or updating this property triggers a reboot.

The DocumentDB database cluster the instance should launch into.
dbInstanceNameoptionalstringdb_instance_nameoptionalstrdbInstanceNameoptionalStringDbInstanceNameoptionalstringDbInstanceNameoptional*string#
A name for the DB instance.

Default: a CloudFormation generated name

If you specify a name, AWS CloudFormation converts it to lowercase.

enablePerformanceInsightsoptionalbooleanenable_performance_insightsoptionalboolenablePerformanceInsightsoptionalBooleanEnablePerformanceInsightsoptionalboolEnablePerformanceInsightsoptional*bool= false#
A value that indicates whether to enable Performance Insights for the DB Instance.
instanceTypeInstanceTypeinstance_typeInstanceTypeinstanceTypeInstanceTypeInstanceTypeInstanceTypeInstanceTypeInstanceTyperequired#
The name of the compute and memory capacity classes.
preferredMaintenanceWindowoptionalstringpreferred_maintenance_windowoptionalstrpreferredMaintenanceWindowoptionalStringPreferredMaintenanceWindowoptionalstringPreferredMaintenanceWindowoptional*string#
The weekly time range (in UTC) during which system maintenance can occur.

Default: a 30-minute window selected at random from an 8-hour block of time for each AWS Region, occurring on a random day of the week. To see the time blocks available, see https://docs.aws.amazon.com/documentdb/latest/developerguide/db-instance-maintain.html#maintenance-window

Format: ddd:hh24:mi-ddd:hh24:mi Constraint: Minimum 30-minute window

removalPolicyoptionalRemovalPolicyremoval_policyoptionalRemovalPolicyremovalPolicyoptionalRemovalPolicyRemovalPolicyoptionalRemovalPolicyRemovalPolicyoptionalRemovalPolicy= RemovalPolicy.Retain#
The CloudFormation policy to apply when the instance is removed from the stack or replaced during an update.