Skip to content
v2.273.0

DatabaseInstanceSourceProps Struct ​

Construction properties for a DatabaseInstanceSource.

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_ec2 as ec2 } from 'aws-cdk-lib';
import { aws_iam as iam } from 'aws-cdk-lib';
import { aws_logs as logs } from 'aws-cdk-lib';
import { aws_rds as rds } from 'aws-cdk-lib';
import { aws_s3 as s3 } from 'aws-cdk-lib';
import { aws_iam as interfaces_iam } from 'aws-cdk-lib/interfaces';
import { aws_kms as interfaces_kms } from 'aws-cdk-lib/interfaces';
import { aws_rds as interfaces_rds } from 'aws-cdk-lib/interfaces';

declare const bucket: s3.Bucket;
declare const caCertificate: rds.CaCertificate;
declare const dBSubnetGroupRef: interfaces_rds.IDBSubnetGroupRef;
declare const instanceEngine: rds.IInstanceEngine;
declare const instanceType: ec2.InstanceType;
declare const keyRef: interfaces_kms.IKeyRef;
declare const optionGroup: rds.OptionGroup;
declare const parameterGroup: rds.ParameterGroup;
declare const role: iam.Role;
declare const roleRef: interfaces_iam.IRoleRef;
declare const securityGroup: ec2.SecurityGroup;
declare const subnet: ec2.Subnet;
declare const subnetFilter: ec2.SubnetFilter;
declare const vpc: ec2.Vpc;
const databaseInstanceSourceProps: rds.DatabaseInstanceSourceProps = {
  engine: instanceEngine,
  vpc: vpc,

  // the properties below are optional
  allocatedStorage: 123,
  allowMajorVersionUpgrade: false,
  applyImmediately: false,
  autoMinorVersionUpgrade: false,
  availabilityZone: 'availabilityZone',
  backupRetention: cdk.Duration.minutes(30),
  caCertificate: caCertificate,
  cloudwatchLogsExports: ['cloudwatchLogsExports'],
  cloudwatchLogsRetention: logs.RetentionDays.ONE_DAY,
  cloudwatchLogsRetentionRole: role,
  copyTagsToSnapshot: false,
  databaseInsightsMode: rds.DatabaseInsightsMode.STANDARD,
  databaseName: 'databaseName',
  deleteAutomatedBackups: false,
  deletionProtection: false,
  domain: 'domain',
  domainRole: roleRef,
  enablePerformanceInsights: false,
  engineLifecycleSupport: rds.EngineLifecycleSupport.OPEN_SOURCE_RDS_EXTENDED_SUPPORT,
  iamAuthentication: false,
  instanceIdentifier: 'instanceIdentifier',
  instanceType: instanceType,
  iops: 123,
  licenseModel: rds.LicenseModel.LICENSE_INCLUDED,
  maxAllocatedStorage: 123,
  monitoringInterval: cdk.Duration.minutes(30),
  monitoringRole: roleRef,
  multiAz: false,
  networkType: rds.NetworkType.IPV4,
  optionGroup: optionGroup,
  parameterGroup: parameterGroup,
  parameters: {
    parametersKey: 'parameters',
  },
  performanceInsightEncryptionKey: keyRef,
  performanceInsightRetention: rds.PerformanceInsightRetention.DEFAULT,
  port: 123,
  preferredBackupWindow: 'preferredBackupWindow',
  preferredMaintenanceWindow: 'preferredMaintenanceWindow',
  processorFeatures: {
    coreCount: 123,
    threadsPerCore: 123,
  },
  publiclyAccessible: false,
  removalPolicy: cdk.RemovalPolicy.DESTROY,
  s3ExportBuckets: [bucket],
  s3ExportRole: role,
  s3ImportBuckets: [bucket],
  s3ImportRole: role,
  securityGroups: [securityGroup],
  storageThroughput: 123,
  storageType: rds.StorageType.STANDARD,
  subnetGroup: dBSubnetGroupRef,
  timezone: 'timezone',
  vpcSubnets: {
    availabilityZones: ['availabilityZones'],
    onePerAz: false,
    subnetFilters: [subnetFilter],
    subnetGroupName: 'subnetGroupName',
    subnets: [subnet],
    subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
  },
};

Properties ​

allocatedStoragenumberallocated_storageint | floatallocatedStorageNumberAllocatedStoragedoubleAllocatedStorage*float64= 100#
The allocated storage size, specified in gibibytes (GiB).
allowMajorVersionUpgradebooleanallow_major_version_upgradeboolallowMajorVersionUpgradeBooleanAllowMajorVersionUpgradeboolAllowMajorVersionUpgrade*bool= false#
Whether to allow major version upgrades.
applyImmediatelybooleanapply_immediatelyboolapplyImmediatelyBooleanApplyImmediatelyboolApplyImmediately*bool= Changes will be applied immediat…#
Specifies whether changes to the DB instance and any pending modifications are applied immediately, regardless of the `preferredMaintenanceWindow` setting.
notes · default

If set to false, changes are applied during the next maintenance window.

Until RDS applies the changes, the DB instance remains in a drift state. As a result, the configuration doesn't fully reflect the requested modifications and temporarily diverges from the intended state.

This property also determines whether the DB instance reboots when a static parameter is modified in the associated DB parameter group.

Default: Changes will be applied immediately

autoMinorVersionUpgradebooleanauto_minor_version_upgradeboolautoMinorVersionUpgradeBooleanAutoMinorVersionUpgradeboolAutoMinorVersionUpgrade*bool= true#
Indicates that minor engine upgrades are applied automatically to the DB instance during the maintenance window.
availabilityZonestringavailability_zonestravailabilityZoneStringAvailabilityZonestringAvailabilityZone*string= no preference#
The name of the Availability Zone where the DB instance will be located.
backupRetentionDurationbackup_retentionDurationbackupRetentionDurationBackupRetentionDurationBackupRetentionDuration= Duration.days(1) for source inst…#
The number of days during which automatic DB snapshots are retained.

Set to zero to disable backups. When creating a read replica, you must enable automatic backups on the source database instance by setting the backup retention to a value other than zero.

default

Default: Duration.days(1) for source instances, disabled for read replicas

caCertificateCaCertificateca_certificateCaCertificatecaCertificateCaCertificateCaCertificateCaCertificateCaCertificateCaCertificate= RDS will choose a certificate au…#
The identifier of the CA certificate for this DB instance.

Specifying or updating this property triggers a reboot.

For RDS DB engines:

default

Default: RDS will choose a certificate authority

cloudwatchLogsExportsstring[]cloudwatch_logs_exportstyping.List[str]cloudwatchLogsExportsList<String>CloudwatchLogsExportsstring[]CloudwatchLogsExports*[]*string= no log exports#
The list of log types that need to be enabled for exporting to CloudWatch Logs.
cloudwatchLogsRetentionRetentionDayscloudwatch_logs_retentionRetentionDayscloudwatchLogsRetentionRetentionDaysCloudwatchLogsRetentionRetentionDaysCloudwatchLogsRetentionRetentionDays= logs never expire#
The number of days log events are kept in CloudWatch Logs.

When updating this property, unsetting it doesn't remove the log retention policy. To remove the retention policy, set the value to Infinity.

cloudwatchLogsRetentionRoleIRolecloudwatch_logs_retention_roleIRolecloudwatchLogsRetentionRoleIRoleCloudwatchLogsRetentionRoleIRoleCloudwatchLogsRetentionRoleIRole= a new role is created.#
The IAM role for the Lambda function associated with the custom resource that sets the retention policy.
copyTagsToSnapshotbooleancopy_tags_to_snapshotboolcopyTagsToSnapshotBooleanCopyTagsToSnapshotboolCopyTagsToSnapshot*bool= true#
Indicates whether to copy all of the user-defined tags from the DB instance to snapshots of the DB instance.
databaseInsightsModeDatabaseInsightsModedatabase_insights_modeDatabaseInsightsModedatabaseInsightsModeDatabaseInsightsModeDatabaseInsightsModeDatabaseInsightsModeDatabaseInsightsModeDatabaseInsightsMode= DatabaseInsightsMode.STANDARD wh…#
The database insights mode.
default

Default: DatabaseInsightsMode.STANDARD when performance insights are enabled, otherwise not set.

databaseNamestringdatabase_namestrdatabaseNameStringDatabaseNamestringDatabaseName*string= no name#
The name of the database.
deleteAutomatedBackupsbooleandelete_automated_backupsbooldeleteAutomatedBackupsBooleanDeleteAutomatedBackupsboolDeleteAutomatedBackups*bool= true#
Indicates whether automated backups should be deleted or retained when you delete a DB instance.
deletionProtectionbooleandeletion_protectionbooldeletionProtectionBooleanDeletionProtectionboolDeletionProtection*bool= true if ``removalPolicy`` is RET…#
Indicates whether the DB instance should have deletion protection enabled.
default

Default: true if removalPolicy is RETAIN, false otherwise

domainstringdomainstrdomainStringDomainstringDomain*string= Do not join domain#
The Active Directory directory ID to create the DB instance in.
domainRoleIRoleRefdomain_roleIRoleRefdomainRoleIRoleRefDomainRoleIRoleRefDomainRoleIRoleRef= The role will be created for you…#
The IAM role to be used when making API calls to the Directory Service.

The role needs the AWS-managed policy AmazonRDSDirectoryServiceAccess or equivalent.

default

Default: The role will be created for you if DatabaseInstanceNewProps#domain is specified

enablePerformanceInsightsbooleanenable_performance_insightsboolenablePerformanceInsightsBooleanEnablePerformanceInsightsboolEnablePerformanceInsights*bool= false, unless ``performanceInsig…#
Whether to enable Performance Insights for the DB instance.
default

Default: false, unless performanceInsightRetention or performanceInsightEncryptionKey is set.

The database engine.
engineLifecycleSupportEngineLifecycleSupportengine_lifecycle_supportEngineLifecycleSupportengineLifecycleSupportEngineLifecycleSupportEngineLifecycleSupportEngineLifecycleSupportEngineLifecycleSupportEngineLifecycleSupport= undefined - AWS RDS default sett…#
The life cycle type for this DB instance.

This setting applies only to RDS for MySQL and RDS for PostgreSQL.

default

Default: undefined - AWS RDS default setting is EngineLifecycleSupport.OPEN_SOURCE_RDS_EXTENDED_SUPPORT

iamAuthenticationbooleaniam_authenticationbooliamAuthenticationBooleanIamAuthenticationboolIamAuthentication*bool= false#
Whether to enable mapping of AWS Identity and Access Management (IAM) accounts to database accounts.
instanceIdentifierstringinstance_identifierstrinstanceIdentifierStringInstanceIdentifierstringInstanceIdentifier*string= a CloudFormation generated name#
A name for the DB instance.

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

instanceTypeInstanceTypeinstance_typeInstanceTypeinstanceTypeInstanceTypeInstanceTypeInstanceTypeInstanceTypeInstanceType= m5.large (or, more specifically,…#
The name of the compute and memory capacity for the instance.
default

Default: m5.large (or, more specifically, db.m5.large)

iopsnumberiopsint | floatiopsNumberIopsdoubleIops*float64= no provisioned iops if storage t…#
The number of I/O operations per second (IOPS) that the database provisions.

The value must be equal to or greater than 1000.

default

Default: no provisioned iops if storage type is not specified. For GP3: 3,000 IOPS if allocated storage is less than 400 GiB for MariaDB, MySQL, and PostgreSQL, less than 200 GiB for Oracle and less than 20 GiB for SQL Server. 12,000 IOPS otherwise (except for SQL Server where the default is always 3,000 IOPS).

licenseModelLicenseModellicense_modelLicenseModellicenseModelLicenseModelLicenseModelLicenseModelLicenseModelLicenseModel= RDS default license model#
The license model.
maxAllocatedStoragenumbermax_allocated_storageint | floatmaxAllocatedStorageNumberMaxAllocatedStoragedoubleMaxAllocatedStorage*float64= No autoscaling of RDS instance#
Upper limit to which RDS can scale the storage in GiB(Gibibyte).
monitoringIntervalDurationmonitoring_intervalDurationmonitoringIntervalDurationMonitoringIntervalDurationMonitoringIntervalDuration= no enhanced monitoring#
The interval, in seconds, between points when Amazon RDS collects enhanced monitoring metrics for the DB instance.
monitoringRoleIRoleRefmonitoring_roleIRoleRefmonitoringRoleIRoleRefMonitoringRoleIRoleRefMonitoringRoleIRoleRef= A role is automatically created …#
Role that will be used to manage DB instance monitoring.
default

Default: A role is automatically created for you

multiAzbooleanmulti_azboolmultiAzBooleanMultiAzboolMultiAz*bool= false#
Specifies if the database instance is a multiple Availability Zone deployment.
networkTypeNetworkTypenetwork_typeNetworkTypenetworkTypeNetworkTypeNetworkTypeNetworkTypeNetworkTypeNetworkType= IPV4#
The network type of the DB instance.
optionGroupIOptionGroupoption_groupIOptionGroupoptionGroupIOptionGroupOptionGroupIOptionGroupOptionGroupIOptionGroup= no option group#
The option group to associate with the instance.
parameterGroupIParameterGroupparameter_groupIParameterGroupparameterGroupIParameterGroupParameterGroupIParameterGroupParameterGroupIParameterGroup= no parameter group#
The DB parameter group to associate with the instance.
parameters{ [key: string]: string }parameterstyping.Mapping[str, str]parametersMap<String, String>ParametersIDictionary<string, string>Parameters*map[string]*string= None#
The parameters in the DBParameterGroup to create automatically.

You can only specify parameterGroup or parameters but not both. You need to use a versioned engine to auto-generate a DBParameterGroup.

performanceInsightEncryptionKeyIKeyRefperformance_insight_encryption_keyIKeyRefperformanceInsightEncryptionKeyIKeyRefPerformanceInsightEncryptionKeyIKeyRefPerformanceInsightEncryptionKeyIKeyRef= default master key#
The AWS KMS key for encryption of Performance Insights data.
performanceInsightRetentionPerformanceInsightRetentionperformance_insight_retentionPerformanceInsightRetentionperformanceInsightRetentionPerformanceInsightRetentionPerformanceInsightRetentionPerformanceInsightRetentionPerformanceInsightRetentionPerformanceInsightRetention= 7 this is the free tier#
The amount of time, in days, to retain Performance Insights data.

If you set databaseInsightsMode to DatabaseInsightsMode.ADVANCED, you must set this property to PerformanceInsightRetention.MONTHS_15.

portnumberportint | floatportNumberPortdoublePort*float64= the default port for the chosen …#
The port for the instance.
default

Default: the default port for the chosen engine.

preferredBackupWindowstringpreferred_backup_windowstrpreferredBackupWindowStringPreferredBackupWindowstringPreferredBackupWindow*string= a 30-minute window selected at r…#
The daily time range during which automated backups are performed.

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.
default

Default: a 30-minute window selected at random from an 8-hour block of time for each AWS Region. To see the time blocks available, see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html#USER_WorkingWithAutomatedBackups.BackupWindow

preferredMaintenanceWindowstringpreferred_maintenance_windowstrpreferredMaintenanceWindowStringPreferredMaintenanceWindowstringPreferredMaintenanceWindow*string= a 30-minute window selected at r…#
The weekly time range (in UTC) during which system maintenance can occur.

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

default

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/AmazonRDS/latest/UserGuide/USER_UpgradeDBInstance.Maintenance.html#Concepts.DBMaintenance

processorFeaturesProcessorFeaturesprocessor_featuresProcessorFeaturesprocessorFeaturesProcessorFeaturesProcessorFeaturesProcessorFeaturesProcessorFeaturesProcessorFeatures= the default number of CPU cores …#
The number of CPU cores and the number of threads per core.
default

Default: the default number of CPU cores and threads per core for the chosen instance class. See https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html#USER_ConfigureProcessor

publiclyAccessiblebooleanpublicly_accessibleboolpubliclyAccessibleBooleanPubliclyAccessibleboolPubliclyAccessible*bool= `true` if the instance's `vpcSub…#
Indicates whether the DB instance is an internet-facing instance.

If not specified, the instance's vpcSubnets will be used to determine if the instance is internet-facing or not.

default

Default: true if the instance's vpcSubnets is subnetType: SubnetType.PUBLIC, false otherwise

removalPolicyRemovalPolicyremoval_policyRemovalPolicyremovalPolicyRemovalPolicyRemovalPolicyRemovalPolicyRemovalPolicyRemovalPolicy= RemovalPolicy.SNAPSHOT (remove t…#
The CloudFormation policy to apply when the instance is removed from the stack or replaced during an update.
default

Default: RemovalPolicy.SNAPSHOT (remove the resource, but retain a snapshot of the data)

s3ExportBucketsIBucket[]s3_export_bucketstyping.List[IBucket]s3ExportBucketsList<IBucket>S3ExportBucketsIBucket[]S3ExportBuckets*[]IBucket= None#
S3 buckets that you want to load data into.

This property must not be used if s3ExportRole is used.

For Microsoft SQL Server:

s3ExportRoleIRoles3_export_roleIRoles3ExportRoleIRoleS3ExportRoleIRoleS3ExportRoleIRole= New role is created if `s3Export…#
Role that will be associated with this DB instance to enable S3 export.

This property must not be used if s3ExportBuckets is used.

For Microsoft SQL Server:

default

Default: New role is created if s3ExportBuckets is set, no role is defined otherwise

s3ImportBucketsIBucket[]s3_import_bucketstyping.List[IBucket]s3ImportBucketsList<IBucket>S3ImportBucketsIBucket[]S3ImportBuckets*[]IBucket= None#
S3 buckets that you want to load data from.

This feature is only supported by the Microsoft SQL Server, Oracle, and PostgreSQL engines.

This property must not be used if s3ImportRole is used.

For Microsoft SQL Server:

s3ImportRoleIRoles3_import_roleIRoles3ImportRoleIRoleS3ImportRoleIRoleS3ImportRoleIRole= New role is created if `s3Import…#
Role that will be associated with this DB instance to enable S3 import.

This feature is only supported by the Microsoft SQL Server, Oracle, and PostgreSQL engines.

This property must not be used if s3ImportBuckets is used.

For Microsoft SQL Server:

default

Default: New role is created if s3ImportBuckets is set, no role is defined otherwise

securityGroupsISecurityGroup[]security_groupstyping.List[ISecurityGroup]securityGroupsList<ISecurityGroup>SecurityGroupsISecurityGroup[]SecurityGroups*[]ISecurityGroup= a new security group is created#
The security groups to assign to the DB instance.
storageThroughputnumberstorage_throughputint | floatstorageThroughputNumberStorageThroughputdoubleStorageThroughput*float64= 125 MiBps if allocated storage i…#
The storage throughput, specified in mebibytes per second (MiBps).

Only applicable for GP3.

default

Default: 125 MiBps if allocated storage is less than 400 GiB for MariaDB, MySQL, and PostgreSQL, less than 200 GiB for Oracle and less than 20 GiB for SQL Server. 500 MiBps otherwise (except for SQL Server where the default is always 125 MiBps).

storageTypeStorageTypestorage_typeStorageTypestorageTypeStorageTypeStorageTypeStorageTypeStorageTypeStorageType= StorageType.GP2#
The storage type to associate with the DB instance.

Storage types supported are gp2, gp3, io1, io2, and standard.

subnetGroupIDBSubnetGroupRefsubnet_groupIDBSubnetGroupRefsubnetGroupIDBSubnetGroupRefSubnetGroupIDBSubnetGroupRefSubnetGroupIDBSubnetGroupRef= a new subnet group will be creat…#
Existing subnet group for the instance.
default

Default: a new subnet group will be created.

timezonestringtimezonestrtimezoneStringTimezonestringTimezone*string= RDS default timezone#
The time zone of the instance.

This is currently supported only by Microsoft Sql Server.

vpcIVpcvpcIVpcvpcIVpcVpcIVpcVpcIVpcrequired#
The VPC network where the DB subnet group should be created.
vpcSubnetsSubnetSelectionvpc_subnetsSubnetSelectionvpcSubnetsSubnetSelectionVpcSubnetsSubnetSelectionVpcSubnetsSubnetSelection= private subnets#
The type of subnets to add to the created DB subnet group.