ClusterInstanceOptions Struct
Common options for creating a cluster instance.
Example
// 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#applyImmediatelybooleanapply_immediatelyboolapplyImmediatelyBooleanApplyImmediatelyboolApplyImmediately*bool#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#availabilityZonestringavailability_zonestravailabilityZoneStringAvailabilityZonestringAvailabilityZone*string#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#Default: RDS will choose a certificate authority
Specifying or updating this property triggers a reboot.
For RDS DB engines:
enablePerformanceInsightsbooleanenable_performance_insightsboolenablePerformanceInsightsBooleanEnablePerformanceInsightsboolEnablePerformanceInsights*bool#Default: false, unless performanceInsightRetention or performanceInsightEncryptionKey is set.
instanceIdentifierstringinstance_identifierstrinstanceIdentifierStringInstanceIdentifierstringInstanceIdentifier*string#Default: CloudFormation generated identifier
isFromLegacyInstancePropsbooleanis_from_legacy_instance_propsboolisFromLegacyInstancePropsBooleanIsFromLegacyInstancePropsboolIsFromLegacyInstanceProps*bool= false#example
// 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#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#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#Default: default master key
performanceInsightRetentionPerformanceInsightRetentionperformance_insight_retentionPerformanceInsightRetentionperformanceInsightRetentionPerformanceInsightRetentionPerformanceInsightRetentionPerformanceInsightRetentionPerformanceInsightRetentionPerformanceInsightRetention= 7#preferredMaintenanceWindowstringpreferred_maintenance_windowstrpreferredMaintenanceWindowStringPreferredMaintenanceWindowstringPreferredMaintenanceWindow*string#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#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.