Skip to content
v2.274.0

ClusterInstanceOptions Struct ​

Common options for creating a cluster instance.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_kms as kms } from 'aws-cdk-lib';
import { aws_rds as rds } from 'aws-cdk-lib';

declare const caCertificate: rds.CaCertificate;
declare const key: kms.Key;
declare const parameterGroup: rds.ParameterGroup;
const clusterInstanceOptions: rds.ClusterInstanceOptions = {
  allowMajorVersionUpgrade: false,
  applyImmediately: false,
  autoMinorVersionUpgrade: false,
  availabilityZone: 'availabilityZone',
  caCertificate: caCertificate,
  enablePerformanceInsights: false,
  instanceIdentifier: 'instanceIdentifier',
  isFromLegacyInstanceProps: false,
  parameterGroup: parameterGroup,
  parameters: {
    parametersKey: 'parameters',
  },
  performanceInsightEncryptionKey: key,
  performanceInsightRetention: rds.PerformanceInsightRetention.DEFAULT,
  preferredMaintenanceWindow: 'preferredMaintenanceWindow',
  publiclyAccessible: false,
};

Properties ​

allowMajorVersionUpgradebooleanallow_major_version_upgradeboolallowMajorVersionUpgradeBooleanAllowMajorVersionUpgradeboolAllowMajorVersionUpgrade*bool= false#
Whether to allow upgrade of major version for the DB instance.
applyImmediatelybooleanapply_immediatelyboolapplyImmediatelyBooleanApplyImmediatelyboolApplyImmediately*bool#
Specifies whether changes to the DB instance and any pending modifications are applied immediately, regardless of the `preferredMaintenanceWindow` setting.

Default: Changes will be applied immediately

notes

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.

autoMinorVersionUpgradebooleanauto_minor_version_upgradeboolautoMinorVersionUpgradeBooleanAutoMinorVersionUpgradeboolAutoMinorVersionUpgrade*bool= true#
Whether to enable automatic upgrade of minor version for the DB instance.
availabilityZonestringavailability_zonestravailabilityZoneStringAvailabilityZonestringAvailabilityZone*string#
The Availability Zone (AZ) where the database will be created.

Default: A random, system-chosen Availability Zone in the endpointʼs AWS Region.

For Amazon Aurora, each Aurora DB cluster hosts copies of its storage in three separate Availability Zones. Specify one of these Availability Zones. Aurora automatically chooses an appropriate Availability Zone if you don't specify one.

caCertificateCaCertificateca_certificateCaCertificatecaCertificateCaCertificateCaCertificateCaCertificateCaCertificateCaCertificate#
The identifier of the CA certificate for this DB cluster's instances.

Default: RDS will choose a certificate authority

Specifying or updating this property triggers a reboot.

For RDS DB engines:

enablePerformanceInsightsbooleanenable_performance_insightsboolenablePerformanceInsightsBooleanEnablePerformanceInsightsboolEnablePerformanceInsights*bool#
Whether to enable Performance Insights for the DB instance.

Default: false, unless performanceInsightRetention or performanceInsightEncryptionKey is set.

instanceIdentifierstringinstance_identifierstrinstanceIdentifierStringInstanceIdentifierstringInstanceIdentifier*string#
The identifier for the database instance.

Default: CloudFormation generated identifier

isFromLegacyInstancePropsbooleanis_from_legacy_instance_propsboolisFromLegacyInstancePropsBooleanIsFromLegacyInstancePropsboolIsFromLegacyInstanceProps*bool= false#
Only used for migrating existing clusters from using `instanceProps` to `writer` and `readers`.
example
ts
// existing cluster
declare const vpc: ec2.Vpc;
const cluster = new rds.DatabaseCluster(this, 'Database', {
  engine: rds.DatabaseClusterEngine.auroraMysql({
    version: rds.AuroraMysqlEngineVersion.VER_3_03_0,
  }),
  instances: 2,
  instanceProps: {
    instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL),
    vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC },
    vpc,
  },
});

// migration

const instanceProps = {
  instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL),
  isFromLegacyInstanceProps: true,
};

const myCluster = new rds.DatabaseCluster(this, 'Database', {
  engine: rds.DatabaseClusterEngine.auroraMysql({
    version: rds.AuroraMysqlEngineVersion.VER_3_03_0,
  }),
  vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC },
  vpc,
  writer: rds.ClusterInstance.provisioned('Instance1', {
    instanceType: instanceProps.instanceType,
    isFromLegacyInstanceProps: instanceProps.isFromLegacyInstanceProps,
  }),
  readers: [
    rds.ClusterInstance.provisioned('Instance2', {
      instanceType: instanceProps.instanceType,
      isFromLegacyInstanceProps: instanceProps.isFromLegacyInstanceProps,
    }),
  ],
});
parameterGroupIParameterGroupparameter_groupIParameterGroupparameterGroupIParameterGroupParameterGroupIParameterGroupParameterGroupIParameterGroup#
The DB parameter group to associate with the instance.

Default: the cluster parameter group is used

This is only needed if you need to configure different parameter groups for each individual instance, otherwise you should not provide this and just use the cluster parameter group

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.

performanceInsightEncryptionKeyIKeyperformance_insight_encryption_keyIKeyperformanceInsightEncryptionKeyIKeyPerformanceInsightEncryptionKeyIKeyPerformanceInsightEncryptionKeyIKey#
The AWS KMS key for encryption of Performance Insights data.

Default: default master key

performanceInsightRetentionPerformanceInsightRetentionperformance_insight_retentionPerformanceInsightRetentionperformanceInsightRetentionPerformanceInsightRetentionPerformanceInsightRetentionPerformanceInsightRetentionPerformanceInsightRetentionPerformanceInsightRetention= 7#
The amount of time, in days, to retain Performance Insights data.
preferredMaintenanceWindowstringpreferred_maintenance_windowstrpreferredMaintenanceWindowStringPreferredMaintenanceWindowstringPreferredMaintenanceWindow*string#
A preferred maintenance window day/time range. Should be specified as a range ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC).

Default: 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.

Example: 'Sun:23:45-Mon:00:15'

publiclyAccessiblebooleanpublicly_accessibleboolpubliclyAccessibleBooleanPubliclyAccessibleboolPubliclyAccessible*bool#
Indicates whether the DB instance is an internet-facing instance.

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

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