Class: AWSCDK::RDS::ServerlessV2ClusterInstanceProps

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

Overview

Options for creating a serverless v2 instance.

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, scale_with_writer: nil) ⇒ ServerlessV2ClusterInstanceProps

Returns a new instance of ServerlessV2ClusterInstanceProps.

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.

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

    Only applicable to reader instances.



22
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
# File 'rds/serverless_v2_cluster_instance_props.rb', line 22

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, scale_with_writer: 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?
  @scale_with_writer = scale_with_writer
  Jsii::Type.check_type(@scale_with_writer, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "scaleWithWriter") unless @scale_with_writer.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)


59
60
61
# File 'rds/serverless_v2_cluster_instance_props.rb', line 59

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.



72
73
74
# File 'rds/serverless_v2_cluster_instance_props.rb', line 72

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)


77
78
79
# File 'rds/serverless_v2_cluster_instance_props.rb', line 77

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.



86
87
88
# File 'rds/serverless_v2_cluster_instance_props.rb', line 86

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:



96
97
98
# File 'rds/serverless_v2_cluster_instance_props.rb', line 96

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)


101
102
103
# File 'rds/serverless_v2_cluster_instance_props.rb', line 101

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)


106
107
108
# File 'rds/serverless_v2_cluster_instance_props.rb', line 106

def instance_identifier
  @instance_identifier
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)


151
152
153
# File 'rds/serverless_v2_cluster_instance_props.rb', line 151

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



160
161
162
# File 'rds/serverless_v2_cluster_instance_props.rb', line 160

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)


168
169
170
# File 'rds/serverless_v2_cluster_instance_props.rb', line 168

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:



173
174
175
# File 'rds/serverless_v2_cluster_instance_props.rb', line 173

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.



178
179
180
# File 'rds/serverless_v2_cluster_instance_props.rb', line 178

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'



186
187
188
# File 'rds/serverless_v2_cluster_instance_props.rb', line 186

def preferred_maintenance_window
  @preferred_maintenance_window
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)


195
196
197
# File 'rds/serverless_v2_cluster_instance_props.rb', line 195

def publicly_accessible
  @publicly_accessible
end

#scale_with_writerBoolean? (readonly)

Note:

Default: false

Only applicable to reader instances.

If this is true then the instance will be placed in promotion tier 1, otherwise it will be placed in promotion tier 2.

For serverless v2 instances this means:

  • true: The serverless v2 reader will scale to match the writer instance (provisioned or serverless)
  • false: The serverless v2 reader will scale with the read workload on the instance

Returns:

  • (Boolean, nil)


208
209
210
# File 'rds/serverless_v2_cluster_instance_props.rb', line 208

def scale_with_writer
  @scale_with_writer
end

Class Method Details

.jsii_propertiesObject



210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'rds/serverless_v2_cluster_instance_props.rb', line 210

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",
    :scale_with_writer => "scaleWithWriter",
  }
end

Instance Method Details

#to_jsiiObject



230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# File 'rds/serverless_v2_cluster_instance_props.rb', line 230

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,
    "scaleWithWriter" => @scale_with_writer,
  })
  result.compact
end