Class: AWSCDK::RDS::ClusterInstanceOptions

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
rds/cluster_instance_options.rb

Overview

Common options for creating a cluster 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) ⇒ ClusterInstanceOptions

Returns a new instance of ClusterInstanceOptions.

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.



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

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)
  @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?
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)


56
57
58
# File 'rds/cluster_instance_options.rb', line 56

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.



69
70
71
# File 'rds/cluster_instance_options.rb', line 69

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)


74
75
76
# File 'rds/cluster_instance_options.rb', line 74

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.



83
84
85
# File 'rds/cluster_instance_options.rb', line 83

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:



93
94
95
# File 'rds/cluster_instance_options.rb', line 93

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)


98
99
100
# File 'rds/cluster_instance_options.rb', line 98

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)


103
104
105
# File 'rds/cluster_instance_options.rb', line 103

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:

# existing cluster
vpc = nil # AWSCDK::EC2::VPC

cluster = AWSCDK::RDS::DatabaseCluster.new(self, "Database", {
    engine: AWSCDK::RDS::DatabaseClusterEngine.aurora_mysql({
        version: AWSCDK::RDS::AuroraMysqlEngineVersion.VER_3_03_0,
    }),
    instances: 2,
    instance_props: {
        instance_type: AWSCDK::EC2::InstanceType.of(AWSCDK::EC2::InstanceClass::BURSTABLE3, AWSCDK::EC2::InstanceSize::SMALL),
        vpc_subnets: {subnet_type: AWSCDK::EC2::SubnetType::PUBLIC},
        vpc: vpc,
    },
})

# migration

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

my_cluster = AWSCDK::RDS::DatabaseCluster.new(self, "Database", {
    engine: AWSCDK::RDS::DatabaseClusterEngine.aurora_mysql({
        version: AWSCDK::RDS::AuroraMysqlEngineVersion.VER_3_03_0,
    }),
    vpc_subnets: {subnet_type: AWSCDK::EC2::SubnetType::PUBLIC},
    vpc: vpc,
    writer: AWSCDK::RDS::ClusterInstance.provisioned("Instance1", {
        instance_type: instance_props.instance_type,
        is_from_legacy_instance_props: instance_props.is_from_legacy_instance_props,
    }),
    readers: [
        AWSCDK::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)


148
149
150
# File 'rds/cluster_instance_options.rb', line 148

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



157
158
159
# File 'rds/cluster_instance_options.rb', line 157

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)


165
166
167
# File 'rds/cluster_instance_options.rb', line 165

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:



170
171
172
# File 'rds/cluster_instance_options.rb', line 170

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.



175
176
177
# File 'rds/cluster_instance_options.rb', line 175

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'



183
184
185
# File 'rds/cluster_instance_options.rb', line 183

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)


192
193
194
# File 'rds/cluster_instance_options.rb', line 192

def publicly_accessible
  @publicly_accessible
end

Class Method Details

.jsii_propertiesObject



194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'rds/cluster_instance_options.rb', line 194

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",
  }
end

Instance Method Details

#to_jsiiObject



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'rds/cluster_instance_options.rb', line 213

def to_jsii
  result = {}
  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,
  })
  result.compact
end