Class: AWSCDK::RDS::ClusterInstanceProps

Inherits:
ClusterInstanceOptions
  • Object
show all
Defined in:
rds/cluster_instance_props.rb

Overview

Common options for creating cluster instances (both serverless and provisioned).

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(allow_major_version_upgrade: nil, apply_immediately: nil, auto_minor_version_upgrade: nil, availability_zone: nil, ca_certificate: nil, enable_performance_insights: nil, instance_identifier: nil, is_from_legacy_instance_props: nil, parameter_group: nil, parameters: nil, performance_insight_encryption_key: nil, performance_insight_retention: nil, preferred_maintenance_window: nil, publicly_accessible: nil, instance_type:, promotion_tier: nil) ⇒ ClusterInstanceProps

Returns a new instance of ClusterInstanceProps.

Parameters:

  • allow_major_version_upgrade (Boolean, nil) (defaults to: nil)

    Whether to allow upgrade of major version for the DB instance.

  • apply_immediately (Boolean, nil) (defaults to: nil)

    Specifies whether changes to the DB instance and any pending modifications are applied immediately, regardless of the preferredMaintenanceWindow setting.

  • auto_minor_version_upgrade (Boolean, nil) (defaults to: nil)

    Whether to enable automatic upgrade of minor version for the DB instance.

  • availability_zone (String, nil) (defaults to: nil)

    The Availability Zone (AZ) where the database will be created.

  • ca_certificate (AWSCDK::RDS::CaCertificate, nil) (defaults to: nil)

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

  • enable_performance_insights (Boolean, nil) (defaults to: nil)

    Whether to enable Performance Insights for the DB instance.

  • instance_identifier (String, nil) (defaults to: nil)

    The identifier for the database instance.

  • is_from_legacy_instance_props (Boolean, nil) (defaults to: nil)

    Only used for migrating existing clusters from using instanceProps to writer and readers.

  • parameter_group (AWSCDK::RDS::IParameterGroup, nil) (defaults to: nil)

    The DB parameter group to associate with the instance.

  • parameters (Hash{String => String}, nil) (defaults to: nil)

    The parameters in the DBParameterGroup to create automatically.

  • performance_insight_encryption_key (AWSCDK::KMS::IKey, nil) (defaults to: nil)

    The AWS KMS key for encryption of Performance Insights data.

  • performance_insight_retention (AWSCDK::RDS::PerformanceInsightRetention, nil) (defaults to: nil)

    The amount of time, in days, to retain Performance Insights data.

  • preferred_maintenance_window (String, nil) (defaults to: nil)

    A preferred maintenance window day/time range. Should be specified as a range ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC).

  • publicly_accessible (Boolean, nil) (defaults to: nil)

    Indicates whether the DB instance is an internet-facing instance.

  • instance_type (AWSCDK::RDS::ClusterInstanceType)

    The type of cluster instance to create.

  • promotion_tier (Numeric, nil) (defaults to: nil)

    The promotion tier of the cluster instance.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'rds/cluster_instance_props.rb', line 23

def initialize(allow_major_version_upgrade: nil, apply_immediately: nil, auto_minor_version_upgrade: nil, availability_zone: nil, ca_certificate: nil, enable_performance_insights: nil, instance_identifier: nil, is_from_legacy_instance_props: nil, parameter_group: nil, parameters: nil, performance_insight_encryption_key: nil, performance_insight_retention: nil, preferred_maintenance_window: nil, publicly_accessible: nil, instance_type:, promotion_tier: nil)
  @allow_major_version_upgrade = allow_major_version_upgrade
  Jsii::Type.check_type(@allow_major_version_upgrade, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "allowMajorVersionUpgrade") unless @allow_major_version_upgrade.nil?
  @apply_immediately = apply_immediately
  Jsii::Type.check_type(@apply_immediately, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "applyImmediately") unless @apply_immediately.nil?
  @auto_minor_version_upgrade = auto_minor_version_upgrade
  Jsii::Type.check_type(@auto_minor_version_upgrade, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "autoMinorVersionUpgrade") unless @auto_minor_version_upgrade.nil?
  @availability_zone = availability_zone
  Jsii::Type.check_type(@availability_zone, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "availabilityZone") unless @availability_zone.nil?
  @ca_certificate = ca_certificate
  Jsii::Type.check_type(@ca_certificate, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfcmRzLkNhQ2VydGlmaWNhdGUifQ==")), "caCertificate") unless @ca_certificate.nil?
  @enable_performance_insights = enable_performance_insights
  Jsii::Type.check_type(@enable_performance_insights, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enablePerformanceInsights") unless @enable_performance_insights.nil?
  @instance_identifier = instance_identifier
  Jsii::Type.check_type(@instance_identifier, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "instanceIdentifier") unless @instance_identifier.nil?
  @is_from_legacy_instance_props = is_from_legacy_instance_props
  Jsii::Type.check_type(@is_from_legacy_instance_props, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "isFromLegacyInstanceProps") unless @is_from_legacy_instance_props.nil?
  @parameter_group = parameter_group
  Jsii::Type.check_type(@parameter_group, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfcmRzLklQYXJhbWV0ZXJHcm91cCJ9")), "parameterGroup") unless @parameter_group.nil?
  @parameters = parameters
  Jsii::Type.check_type(@parameters, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "parameters") unless @parameters.nil?
  @performance_insight_encryption_key = performance_insight_encryption_key
  Jsii::Type.check_type(@performance_insight_encryption_key, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfa21zLklLZXkifQ==")), "performanceInsightEncryptionKey") unless @performance_insight_encryption_key.nil?
  @performance_insight_retention = performance_insight_retention
  Jsii::Type.check_type(@performance_insight_retention, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfcmRzLlBlcmZvcm1hbmNlSW5zaWdodFJldGVudGlvbiJ9")), "performanceInsightRetention") unless @performance_insight_retention.nil?
  @preferred_maintenance_window = preferred_maintenance_window
  Jsii::Type.check_type(@preferred_maintenance_window, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "preferredMaintenanceWindow") unless @preferred_maintenance_window.nil?
  @publicly_accessible = publicly_accessible
  Jsii::Type.check_type(@publicly_accessible, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "publiclyAccessible") unless @publicly_accessible.nil?
  @instance_type = instance_type
  Jsii::Type.check_type(@instance_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfcmRzLkNsdXN0ZXJJbnN0YW5jZVR5cGUifQ==")), "instanceType")
  @promotion_tier = promotion_tier
  Jsii::Type.check_type(@promotion_tier, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "promotionTier") unless @promotion_tier.nil?
end

Instance Attribute Details

#allow_major_version_upgradeBoolean? (readonly)

Note:

Default: - false

Whether to allow upgrade of major version for the DB instance.

Returns:

  • (Boolean, nil)


62
63
64
# File 'rds/cluster_instance_props.rb', line 62

def allow_major_version_upgrade
  @allow_major_version_upgrade
end

#apply_immediatelyBoolean? (readonly)

Note:

Default: - Changes will be applied immediately

Specifies whether changes to the DB instance and any pending modifications are applied immediately, regardless of the preferredMaintenanceWindow setting.

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.



75
76
77
# File 'rds/cluster_instance_props.rb', line 75

def apply_immediately
  @apply_immediately
end

#auto_minor_version_upgradeBoolean? (readonly)

Note:

Default: - true

Whether to enable automatic upgrade of minor version for the DB instance.

Returns:

  • (Boolean, nil)


80
81
82
# File 'rds/cluster_instance_props.rb', line 80

def auto_minor_version_upgrade
  @auto_minor_version_upgrade
end

#availability_zoneString? (readonly)

Note:

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

The Availability Zone (AZ) where the database will be created.

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.



89
90
91
# File 'rds/cluster_instance_props.rb', line 89

def availability_zone
  @availability_zone
end

#ca_certificateAWSCDK::RDS::CaCertificate? (readonly)

Note:

Default: - RDS will choose a certificate authority

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

Specifying or updating this property triggers a reboot.

For RDS DB engines:



99
100
101
# File 'rds/cluster_instance_props.rb', line 99

def ca_certificate
  @ca_certificate
end

#enable_performance_insightsBoolean? (readonly)

Note:

Default: - false, unless performanceInsightRetention or performanceInsightEncryptionKey is set.

Whether to enable Performance Insights for the DB instance.

Returns:

  • (Boolean, nil)


104
105
106
# File 'rds/cluster_instance_props.rb', line 104

def enable_performance_insights
  @enable_performance_insights
end

#instance_identifierString? (readonly)

Note:

Default: - CloudFormation generated identifier

The identifier for the database instance.

Returns:

  • (String, nil)


109
110
111
# File 'rds/cluster_instance_props.rb', line 109

def instance_identifier
  @instance_identifier
end

#instance_typeAWSCDK::RDS::ClusterInstanceType (readonly)

The type of cluster instance to create.

Can be either provisioned or serverless v2



205
206
207
# File 'rds/cluster_instance_props.rb', line 205

def instance_type
  @instance_type
end

#is_from_legacy_instance_propsBoolean? (readonly)

Note:

Default: false

Only used for migrating existing clusters from using instanceProps to writer and readers.

Examples:

# Example automatically generated from non-compiling source. May contain errors.
# existing cluster
vpc = nil
cluster = RDS::DatabaseCluster.new(self, "Database", {
    engine: RDS::DatabaseClusterEngine.aurora_mysql({
        version: RDS::AuroraMysqlEngineVersion::VER_3_03_0,
    }),
    instances: 2,
    instance_props: {
        instance_type: EC2::InstanceType.of(EC2::InstanceClass::BURSTABLE3, EC2::InstanceSize::SMALL),
        vpc_subnets: {subnet_type: EC2::SubnetType::PUBLIC},
        vpc: vpc,
    },
})

# migration

instance_props = {
    instance_type: EC2::InstanceType.of(EC2::InstanceClass::BURSTABLE3, EC2::InstanceSize::SMALL),
    is_from_legacy_instance_props: true,
}

my_cluster = RDS::DatabaseCluster.new(self, "Database", {
    engine: RDS::DatabaseClusterEngine.aurora_mysql({
        version: RDS::AuroraMysqlEngineVersion::VER_3_03_0,
    }),
    vpc_subnets: {subnet_type: EC2::SubnetType::PUBLIC},
    vpc: vpc,
    writer: RDS::ClusterInstance.provisioned("Instance1", {
        instance_type: instance_props.instance_type,
        is_from_legacy_instance_props: instance_props.is_from_legacy_instance_props,
    }),
    readers: [
        RDS::ClusterInstance.provisioned("Instance2", {
            instance_type: instance_props.instance_type,
            is_from_legacy_instance_props: instance_props.is_from_legacy_instance_props,
        }),
    ],
})

Returns:

  • (Boolean, nil)


154
155
156
# File 'rds/cluster_instance_props.rb', line 154

def is_from_legacy_instance_props
  @is_from_legacy_instance_props
end

#parameter_groupAWSCDK::RDS::IParameterGroup? (readonly)

Note:

Default: the cluster parameter group is used

The DB parameter group to associate with the instance.

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



163
164
165
# File 'rds/cluster_instance_props.rb', line 163

def parameter_group
  @parameter_group
end

#parametersHash{String => String}? (readonly)

Note:

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

Returns:

  • (Hash{String => String}, nil)


171
172
173
# File 'rds/cluster_instance_props.rb', line 171

def parameters
  @parameters
end

#performance_insight_encryption_keyAWSCDK::KMS::IKey? (readonly)

Note:

Default: - default master key

The AWS KMS key for encryption of Performance Insights data.

Returns:



176
177
178
# File 'rds/cluster_instance_props.rb', line 176

def performance_insight_encryption_key
  @performance_insight_encryption_key
end

#performance_insight_retentionAWSCDK::RDS::PerformanceInsightRetention? (readonly)

Note:

Default: 7

The amount of time, in days, to retain Performance Insights data.



181
182
183
# File 'rds/cluster_instance_props.rb', line 181

def performance_insight_retention
  @performance_insight_retention
end

#preferred_maintenance_windowString? (readonly)

Note:

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.

A preferred maintenance window day/time range. Should be specified as a range ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC).

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



189
190
191
# File 'rds/cluster_instance_props.rb', line 189

def preferred_maintenance_window
  @preferred_maintenance_window
end

#promotion_tierNumeric? (readonly)

Note:

Default: 2

The promotion tier of the cluster instance.

This matters more for serverlessV2 instances. If a serverless instance is in tier 0-1 then it will scale with the writer.

For provisioned instances this just determines the failover priority. If multiple instances have the same priority then one will be picked at random

Returns:

  • (Numeric, nil)


216
217
218
# File 'rds/cluster_instance_props.rb', line 216

def promotion_tier
  @promotion_tier
end

#publicly_accessibleBoolean? (readonly)

Note:

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

Indicates whether the DB instance is an internet-facing instance.

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

Returns:

  • (Boolean, nil)


198
199
200
# File 'rds/cluster_instance_props.rb', line 198

def publicly_accessible
  @publicly_accessible
end

Class Method Details

.jsii_propertiesObject



218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'rds/cluster_instance_props.rb', line 218

def self.jsii_properties
  {
    :allow_major_version_upgrade => "allowMajorVersionUpgrade",
    :apply_immediately => "applyImmediately",
    :auto_minor_version_upgrade => "autoMinorVersionUpgrade",
    :availability_zone => "availabilityZone",
    :ca_certificate => "caCertificate",
    :enable_performance_insights => "enablePerformanceInsights",
    :instance_identifier => "instanceIdentifier",
    :is_from_legacy_instance_props => "isFromLegacyInstanceProps",
    :parameter_group => "parameterGroup",
    :parameters => "parameters",
    :performance_insight_encryption_key => "performanceInsightEncryptionKey",
    :performance_insight_retention => "performanceInsightRetention",
    :preferred_maintenance_window => "preferredMaintenanceWindow",
    :publicly_accessible => "publiclyAccessible",
    :instance_type => "instanceType",
    :promotion_tier => "promotionTier",
  }
end

Instance Method Details

#to_jsiiObject



239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# File 'rds/cluster_instance_props.rb', line 239

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "allowMajorVersionUpgrade" => @allow_major_version_upgrade,
    "applyImmediately" => @apply_immediately,
    "autoMinorVersionUpgrade" => @auto_minor_version_upgrade,
    "availabilityZone" => @availability_zone,
    "caCertificate" => @ca_certificate,
    "enablePerformanceInsights" => @enable_performance_insights,
    "instanceIdentifier" => @instance_identifier,
    "isFromLegacyInstanceProps" => @is_from_legacy_instance_props,
    "parameterGroup" => @parameter_group,
    "parameters" => @parameters,
    "performanceInsightEncryptionKey" => @performance_insight_encryption_key,
    "performanceInsightRetention" => @performance_insight_retention,
    "preferredMaintenanceWindow" => @preferred_maintenance_window,
    "publiclyAccessible" => @publicly_accessible,
    "instanceType" => @instance_type,
    "promotionTier" => @promotion_tier,
  })
  result.compact
end