Class: AWSCDK::Autoscaling::CommonAutoScalingGroupProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
autoscaling/common_auto_scaling_group_props.rb

Overview

Basic properties of an AutoScalingGroup, except the exact machines to run and where they should run.

Constructs that want to create AutoScalingGroups can inherit this interface and specialize the essential parts in various ways.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(allow_all_outbound: nil, associate_public_ip_address: nil, auto_scaling_group_name: nil, az_capacity_distribution_strategy: nil, block_devices: nil, capacity_rebalance: nil, cooldown: nil, default_instance_warmup: nil, deletion_protection: nil, desired_capacity: nil, group_metrics: nil, health_check: nil, health_checks: nil, ignore_unmodified_size_properties: nil, instance_lifecycle_policy: nil, instance_monitoring: nil, key_name: nil, key_pair: nil, max_capacity: nil, max_instance_lifetime: nil, min_capacity: nil, new_instances_protected_from_scale_in: nil, notifications: nil, signals: nil, spot_price: nil, ssm_session_permissions: nil, termination_policies: nil, termination_policy_custom_lambda_function_arn: nil, update_policy: nil, vpc_subnets: nil) ⇒ CommonAutoScalingGroupProps

Returns a new instance of CommonAutoScalingGroupProps.

Parameters:

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

    Whether the instances can initiate connections to anywhere by default.

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

    Whether instances in the Auto Scaling Group should have public IP addresses associated with them.

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

    The name of the Auto Scaling group.

  • az_capacity_distribution_strategy (AWSCDK::Autoscaling::CapacityDistributionStrategy, nil) (defaults to: nil)

    The strategy for distributing instances across Availability Zones.

  • block_devices (Array<AWSCDK::Autoscaling::BlockDevice>, nil) (defaults to: nil)

    Specifies how block devices are exposed to the instance. You can specify virtual devices and EBS volumes.

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

    Indicates whether Capacity Rebalancing is enabled.

  • cooldown (AWSCDK::Duration, nil) (defaults to: nil)

    Default scaling cooldown for this AutoScalingGroup.

  • default_instance_warmup (AWSCDK::Duration, nil) (defaults to: nil)

    The amount of time, in seconds, until a newly launched instance can contribute to the Amazon CloudWatch metrics.

  • deletion_protection (AWSCDK::Autoscaling::DeletionProtection, nil) (defaults to: nil)

    Deletion protection for the Auto Scaling group.

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

    Initial amount of instances in the fleet.

  • group_metrics (Array<AWSCDK::Autoscaling::GroupMetrics>, nil) (defaults to: nil)

    Enable monitoring for group metrics, these metrics describe the group rather than any of its instances.

  • health_check (AWSCDK::Autoscaling::HealthCheck, nil) (defaults to: nil)

    Configuration for health checks.

  • health_checks (AWSCDK::Autoscaling::HealthChecks, nil) (defaults to: nil)

    Configuration for EC2 or additional health checks.

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

    If the ASG has scheduled actions, don't reset unchanged group sizes.

  • instance_lifecycle_policy (AWSCDK::Autoscaling::InstanceLifecyclePolicy, nil) (defaults to: nil)

    An instance lifecycle policy that defines how instances should be handled during lifecycle events, particularly when lifecycle hooks are abandoned or fail.

  • instance_monitoring (AWSCDK::Autoscaling::Monitoring, nil) (defaults to: nil)

    Controls whether instances in this group are launched with detailed or basic monitoring.

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

    Name of SSH keypair to grant access to instances.

  • key_pair (AWSCDK::EC2::IKeyPair, nil) (defaults to: nil)

    The SSH keypair to grant access to the instance.

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

    Maximum number of instances in the fleet.

  • max_instance_lifetime (AWSCDK::Duration, nil) (defaults to: nil)

    The maximum amount of time that an instance can be in service.

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

    Minimum number of instances in the fleet.

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

    Whether newly-launched instances are protected from termination by Amazon EC2 Auto Scaling when scaling in.

  • notifications (Array<AWSCDK::Autoscaling::NotificationConfiguration>, nil) (defaults to: nil)

    Configure autoscaling group to send notifications about fleet changes to an SNS topic(s).

  • signals (AWSCDK::Autoscaling::Signals, nil) (defaults to: nil)

    Configure waiting for signals during deployment.

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

    The maximum hourly price (in USD) to be paid for any Spot Instance launched to fulfill the request.

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

    Add SSM session permissions to the instance role.

  • termination_policies (Array<AWSCDK::Autoscaling::TerminationPolicy>, nil) (defaults to: nil)

    A policy or a list of policies that are used to select the instances to terminate.

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

    A lambda function Arn that can be used as a custom termination policy to select the instances to terminate.

  • update_policy (AWSCDK::Autoscaling::UpdatePolicy, nil) (defaults to: nil)

    What to do when an AutoScalingGroup's instance configuration is changed.

  • vpc_subnets (AWSCDK::EC2::SubnetSelection, nil) (defaults to: nil)

    Where to place instances within the VPC.



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'autoscaling/common_auto_scaling_group_props.rb', line 40

def initialize(allow_all_outbound: nil, associate_public_ip_address: nil, auto_scaling_group_name: nil, az_capacity_distribution_strategy: nil, block_devices: nil, capacity_rebalance: nil, cooldown: nil, default_instance_warmup: nil, deletion_protection: nil, desired_capacity: nil, group_metrics: nil, health_check: nil, health_checks: nil, ignore_unmodified_size_properties: nil, instance_lifecycle_policy: nil, instance_monitoring: nil, key_name: nil, key_pair: nil, max_capacity: nil, max_instance_lifetime: nil, min_capacity: nil, new_instances_protected_from_scale_in: nil, notifications: nil, signals: nil, spot_price: nil, ssm_session_permissions: nil, termination_policies: nil, termination_policy_custom_lambda_function_arn: nil, update_policy: nil, vpc_subnets: nil)
  @allow_all_outbound = allow_all_outbound
  Jsii::Type.check_type(@allow_all_outbound, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "allowAllOutbound") unless @allow_all_outbound.nil?
  @associate_public_ip_address = associate_public_ip_address
  Jsii::Type.check_type(@associate_public_ip_address, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "associatePublicIpAddress") unless @associate_public_ip_address.nil?
  @auto_scaling_group_name = auto_scaling_group_name
  Jsii::Type.check_type(@auto_scaling_group_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "autoScalingGroupName") unless @auto_scaling_group_name.nil?
  @az_capacity_distribution_strategy = az_capacity_distribution_strategy
  Jsii::Type.check_type(@az_capacity_distribution_strategy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuQ2FwYWNpdHlEaXN0cmlidXRpb25TdHJhdGVneSJ9")), "azCapacityDistributionStrategy") unless @az_capacity_distribution_strategy.nil?
  @block_devices = block_devices.is_a?(Array) ? block_devices.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::Autoscaling::BlockDevice.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : block_devices
  Jsii::Type.check_type(@block_devices, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hdXRvc2NhbGluZy5CbG9ja0RldmljZSJ9LCJraW5kIjoiYXJyYXkifX0=")), "blockDevices") unless @block_devices.nil?
  @capacity_rebalance = capacity_rebalance
  Jsii::Type.check_type(@capacity_rebalance, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "capacityRebalance") unless @capacity_rebalance.nil?
  @cooldown = cooldown
  Jsii::Type.check_type(@cooldown, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "cooldown") unless @cooldown.nil?
  @default_instance_warmup = default_instance_warmup
  Jsii::Type.check_type(@default_instance_warmup, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "defaultInstanceWarmup") unless @default_instance_warmup.nil?
  @deletion_protection = deletion_protection
  Jsii::Type.check_type(@deletion_protection, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuRGVsZXRpb25Qcm90ZWN0aW9uIn0=")), "deletionProtection") unless @deletion_protection.nil?
  @desired_capacity = desired_capacity
  Jsii::Type.check_type(@desired_capacity, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "desiredCapacity") unless @desired_capacity.nil?
  @group_metrics = group_metrics
  Jsii::Type.check_type(@group_metrics, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hdXRvc2NhbGluZy5Hcm91cE1ldHJpY3MifSwia2luZCI6ImFycmF5In19")), "groupMetrics") unless @group_metrics.nil?
  @health_check = health_check
  Jsii::Type.check_type(@health_check, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuSGVhbHRoQ2hlY2sifQ==")), "healthCheck") unless @health_check.nil?
  @health_checks = health_checks
  Jsii::Type.check_type(@health_checks, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuSGVhbHRoQ2hlY2tzIn0=")), "healthChecks") unless @health_checks.nil?
  @ignore_unmodified_size_properties = ignore_unmodified_size_properties
  Jsii::Type.check_type(@ignore_unmodified_size_properties, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "ignoreUnmodifiedSizeProperties") unless @ignore_unmodified_size_properties.nil?
  @instance_lifecycle_policy = instance_lifecycle_policy.is_a?(Hash) ? ::AWSCDK::Autoscaling::InstanceLifecyclePolicy.new(**instance_lifecycle_policy.transform_keys(&:to_sym)) : instance_lifecycle_policy
  Jsii::Type.check_type(@instance_lifecycle_policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuSW5zdGFuY2VMaWZlY3ljbGVQb2xpY3kifQ==")), "instanceLifecyclePolicy") unless @instance_lifecycle_policy.nil?
  @instance_monitoring = instance_monitoring
  Jsii::Type.check_type(@instance_monitoring, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuTW9uaXRvcmluZyJ9")), "instanceMonitoring") unless @instance_monitoring.nil?
  @key_name = key_name
  Jsii::Type.check_type(@key_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "keyName") unless @key_name.nil?
  @key_pair = key_pair
  Jsii::Type.check_type(@key_pair, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklLZXlQYWlyIn0=")), "keyPair") unless @key_pair.nil?
  @max_capacity = max_capacity
  Jsii::Type.check_type(@max_capacity, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maxCapacity") unless @max_capacity.nil?
  @max_instance_lifetime = max_instance_lifetime
  Jsii::Type.check_type(@max_instance_lifetime, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "maxInstanceLifetime") unless @max_instance_lifetime.nil?
  @min_capacity = min_capacity
  Jsii::Type.check_type(@min_capacity, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "minCapacity") unless @min_capacity.nil?
  @new_instances_protected_from_scale_in = new_instances_protected_from_scale_in
  Jsii::Type.check_type(@new_instances_protected_from_scale_in, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "newInstancesProtectedFromScaleIn") unless @new_instances_protected_from_scale_in.nil?
  @notifications = notifications.is_a?(Array) ? notifications.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::Autoscaling::NotificationConfiguration.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : notifications
  Jsii::Type.check_type(@notifications, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hdXRvc2NhbGluZy5Ob3RpZmljYXRpb25Db25maWd1cmF0aW9uIn0sImtpbmQiOiJhcnJheSJ9fQ==")), "notifications") unless @notifications.nil?
  @signals = signals
  Jsii::Type.check_type(@signals, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuU2lnbmFscyJ9")), "signals") unless @signals.nil?
  @spot_price = spot_price
  Jsii::Type.check_type(@spot_price, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "spotPrice") unless @spot_price.nil?
  @ssm_session_permissions = ssm_session_permissions
  Jsii::Type.check_type(@ssm_session_permissions, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "ssmSessionPermissions") unless @ssm_session_permissions.nil?
  @termination_policies = termination_policies
  Jsii::Type.check_type(@termination_policies, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19hdXRvc2NhbGluZy5UZXJtaW5hdGlvblBvbGljeSJ9LCJraW5kIjoiYXJyYXkifX0=")), "terminationPolicies") unless @termination_policies.nil?
  @termination_policy_custom_lambda_function_arn = termination_policy_custom_lambda_function_arn
  Jsii::Type.check_type(@termination_policy_custom_lambda_function_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "terminationPolicyCustomLambdaFunctionArn") unless @termination_policy_custom_lambda_function_arn.nil?
  @update_policy = update_policy
  Jsii::Type.check_type(@update_policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuVXBkYXRlUG9saWN5In0=")), "updatePolicy") unless @update_policy.nil?
  @vpc_subnets = vpc_subnets.is_a?(Hash) ? ::AWSCDK::EC2::SubnetSelection.new(**vpc_subnets.transform_keys(&:to_sym)) : vpc_subnets
  Jsii::Type.check_type(@vpc_subnets, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlN1Ym5ldFNlbGVjdGlvbiJ9")), "vpcSubnets") unless @vpc_subnets.nil?
end

Instance Attribute Details

#allow_all_outboundBoolean? (readonly)

Note:

Default: true

Whether the instances can initiate connections to anywhere by default.

Returns:

  • (Boolean, nil)


107
108
109
# File 'autoscaling/common_auto_scaling_group_props.rb', line 107

def allow_all_outbound
  @allow_all_outbound
end

#associate_public_ip_addressBoolean? (readonly)

Note:

Default: - Use subnet setting.

Whether instances in the Auto Scaling Group should have public IP addresses associated with them.

launch_template and mixed_instances_policy must not be specified when this property is specified

Returns:

  • (Boolean, nil)


114
115
116
# File 'autoscaling/common_auto_scaling_group_props.rb', line 114

def associate_public_ip_address
  @associate_public_ip_address
end

#auto_scaling_group_nameString? (readonly)

Note:

Default: - Auto generated by CloudFormation

The name of the Auto Scaling group.

This name must be unique per Region per account.

Returns:

  • (String, nil)


121
122
123
# File 'autoscaling/common_auto_scaling_group_props.rb', line 121

def auto_scaling_group_name
  @auto_scaling_group_name
end

#az_capacity_distribution_strategyAWSCDK::Autoscaling::CapacityDistributionStrategy? (readonly)

Note:

Default: None

The strategy for distributing instances across Availability Zones.



126
127
128
# File 'autoscaling/common_auto_scaling_group_props.rb', line 126

def az_capacity_distribution_strategy
  @az_capacity_distribution_strategy
end

#block_devicesArray<AWSCDK::Autoscaling::BlockDevice>? (readonly)

Note:

Default: - Uses the block device mapping of the AMI

Specifies how block devices are exposed to the instance. You can specify virtual devices and EBS volumes.

Each instance that is launched has an associated root device volume, either an Amazon EBS volume or an instance store volume. You can use block device mappings to specify additional EBS volumes or instance store volumes to attach to an instance when it is launched.

launch_template and mixed_instances_policy must not be specified when this property is specified



139
140
141
# File 'autoscaling/common_auto_scaling_group_props.rb', line 139

def block_devices
  @block_devices
end

#capacity_rebalanceBoolean? (readonly)

Note:

Default: false

Indicates whether Capacity Rebalancing is enabled.

When you turn on Capacity Rebalancing, Amazon EC2 Auto Scaling attempts to launch a Spot Instance whenever Amazon EC2 notifies that a Spot Instance is at an elevated risk of interruption. After launching a new instance, it then terminates an old instance.



149
150
151
# File 'autoscaling/common_auto_scaling_group_props.rb', line 149

def capacity_rebalance
  @capacity_rebalance
end

#cooldownAWSCDK::Duration? (readonly)

Note:

Default: Duration.minutes(5)

Default scaling cooldown for this AutoScalingGroup.

Returns:



154
155
156
# File 'autoscaling/common_auto_scaling_group_props.rb', line 154

def cooldown
  @cooldown
end

#default_instance_warmupAWSCDK::Duration? (readonly)

Note:

Default: None

The amount of time, in seconds, until a newly launched instance can contribute to the Amazon CloudWatch metrics.

This delay lets an instance finish initializing before Amazon EC2 Auto Scaling aggregates instance metrics, resulting in more reliable usage data. Set this value equal to the amount of time that it takes for resource consumption to become stable after an instance reaches the InService state.

To optimize the performance of scaling policies that scale continuously, such as target tracking and step scaling policies, we strongly recommend that you enable the default instance warmup, even if its value is set to 0 seconds

Default instance warmup will not be added if no value is specified



169
170
171
# File 'autoscaling/common_auto_scaling_group_props.rb', line 169

def default_instance_warmup
  @default_instance_warmup
end

#deletion_protectionAWSCDK::Autoscaling::DeletionProtection? (readonly)

Note:

Default: DeletionProtection.NONE

Deletion protection for the Auto Scaling group.



175
176
177
# File 'autoscaling/common_auto_scaling_group_props.rb', line 175

def deletion_protection
  @deletion_protection
end

#desired_capacityNumeric? (readonly)

Note:

Default: minCapacity, and leave unchanged during deployment

Initial amount of instances in the fleet.

If this is set to a number, every deployment will reset the amount of instances to this number. It is recommended to leave this value blank.



184
185
186
# File 'autoscaling/common_auto_scaling_group_props.rb', line 184

def desired_capacity
  @desired_capacity
end

#group_metricsArray<AWSCDK::Autoscaling::GroupMetrics>? (readonly)

Note:

Default: - no group metrics will be reported

Enable monitoring for group metrics, these metrics describe the group rather than any of its instances.

To report all group metrics use GroupMetrics.all() Group metrics are reported in a granularity of 1 minute at no additional charge.

Returns:



192
193
194
# File 'autoscaling/common_auto_scaling_group_props.rb', line 192

def group_metrics
  @group_metrics
end

#health_checkAWSCDK::Autoscaling::HealthCheck? (readonly)

Deprecated.

Use healthChecks instead

Note:

Default: - HealthCheck.ec2 with no grace period

Configuration for health checks.



198
199
200
# File 'autoscaling/common_auto_scaling_group_props.rb', line 198

def health_check
  @health_check
end

#health_checksAWSCDK::Autoscaling::HealthChecks? (readonly)

Note:

Default: - EC2 type with no grace period

Configuration for EC2 or additional health checks.

Even when using HealthChecks.withAdditionalChecks(), the EC2 type is implicitly included.



206
207
208
# File 'autoscaling/common_auto_scaling_group_props.rb', line 206

def health_checks
  @health_checks
end

#ignore_unmodified_size_propertiesBoolean? (readonly)

Note:

Default: true

If the ASG has scheduled actions, don't reset unchanged group sizes.

Only used if the ASG has scheduled actions (which may scale your ASG up or down regardless of cdk deployments). If true, the size of the group will only be reset if it has been changed in the CDK app. If false, the sizes will always be changed back to what they were in the CDK app on deployment.

Returns:

  • (Boolean, nil)


217
218
219
# File 'autoscaling/common_auto_scaling_group_props.rb', line 217

def ignore_unmodified_size_properties
  @ignore_unmodified_size_properties
end

#instance_lifecycle_policyAWSCDK::Autoscaling::InstanceLifecyclePolicy? (readonly)

Note:

Default: None

An instance lifecycle policy that defines how instances should be handled during lifecycle events, particularly when lifecycle hooks are abandoned or fail.



223
224
225
# File 'autoscaling/common_auto_scaling_group_props.rb', line 223

def instance_lifecycle_policy
  @instance_lifecycle_policy
end

#instance_monitoringAWSCDK::Autoscaling::Monitoring? (readonly)

Note:

Default: - Monitoring.DETAILED

Controls whether instances in this group are launched with detailed or basic monitoring.

When detailed monitoring is enabled, Amazon CloudWatch generates metrics every minute and your account is charged a fee. When you disable detailed monitoring, CloudWatch generates metrics every 5 minutes.

launch_template and mixed_instances_policy must not be specified when this property is specified



234
235
236
# File 'autoscaling/common_auto_scaling_group_props.rb', line 234

def instance_monitoring
  @instance_monitoring
end

#key_nameString? (readonly)

Note:

Default: - No SSH access will be possible.

Name of SSH keypair to grant access to instances.

launch_template and mixed_instances_policy must not be specified when this property is specified

You can either specify key_pair or key_name, not both.

Returns:

  • (String, nil)


244
245
246
# File 'autoscaling/common_auto_scaling_group_props.rb', line 244

def key_name
  @key_name
end

#key_pairAWSCDK::EC2::IKeyPair? (readonly)

Note:

Default: - No SSH access will be possible.

The SSH keypair to grant access to the instance.

Feature flag AUTOSCALING_GENERATE_LAUNCH_TEMPLATE must be enabled to use this property.

launch_template and mixed_instances_policy must not be specified when this property is specified.

You can either specify key_pair or key_name, not both.

Returns:



255
256
257
# File 'autoscaling/common_auto_scaling_group_props.rb', line 255

def key_pair
  @key_pair
end

#max_capacityNumeric? (readonly)

Note:

Default: desiredCapacity

Maximum number of instances in the fleet.

Returns:

  • (Numeric, nil)


260
261
262
# File 'autoscaling/common_auto_scaling_group_props.rb', line 260

def max_capacity
  @max_capacity
end

#max_instance_lifetimeAWSCDK::Duration? (readonly)

Note:

Default: none

The maximum amount of time that an instance can be in service.

The maximum duration applies to all current and future instances in the group. As an instance approaches its maximum duration, it is terminated and replaced, and cannot be used again.

You must specify a value of at least 86,400 seconds (one day). To clear a previously set value, leave this property undefined.



273
274
275
# File 'autoscaling/common_auto_scaling_group_props.rb', line 273

def max_instance_lifetime
  @max_instance_lifetime
end

#min_capacityNumeric? (readonly)

Note:

Default: 1

Minimum number of instances in the fleet.

Returns:

  • (Numeric, nil)


278
279
280
# File 'autoscaling/common_auto_scaling_group_props.rb', line 278

def min_capacity
  @min_capacity
end

#new_instances_protected_from_scale_inBoolean? (readonly)

Note:

Default: false

Whether newly-launched instances are protected from termination by Amazon EC2 Auto Scaling when scaling in.

By default, Auto Scaling can terminate an instance at any time after launch when scaling in an Auto Scaling Group, subject to the group's termination policy. However, you may wish to protect newly-launched instances from being scaled in if they are going to run critical applications that should not be prematurely terminated.

This flag must be enabled if the Auto Scaling Group will be associated with an ECS Capacity Provider with managed termination protection.

Returns:

  • (Boolean, nil)


292
293
294
# File 'autoscaling/common_auto_scaling_group_props.rb', line 292

def new_instances_protected_from_scale_in
  @new_instances_protected_from_scale_in
end

#notificationsArray<AWSCDK::Autoscaling::NotificationConfiguration>? (readonly)

Note:

Default: - No fleet change notifications will be sent.

Configure autoscaling group to send notifications about fleet changes to an SNS topic(s).



298
299
300
# File 'autoscaling/common_auto_scaling_group_props.rb', line 298

def notifications
  @notifications
end

#signalsAWSCDK::Autoscaling::Signals? (readonly)

Note:

Default: - Do not wait for signals

Configure waiting for signals during deployment.

Use this to pause the CloudFormation deployment to wait for the instances in the AutoScalingGroup to report successful startup during creation and updates. The UserData script needs to invoke cfn-signal with a success or failure code after it is done setting up the instance.

Without waiting for signals, the CloudFormation deployment will proceed as soon as the AutoScalingGroup has been created or updated but before the instances in the group have been started.

For example, to have instances wait for an Elastic Load Balancing health check before they signal success, add a health-check verification by using the cfn-init helper script. For an example, see the verify_instance_health command in the Auto Scaling rolling updates sample template:

https://github.com/awslabs/aws-cloudformation-templates/blob/master/aws/services/AutoScaling/AutoScalingRollingUpdates.yaml



319
320
321
# File 'autoscaling/common_auto_scaling_group_props.rb', line 319

def signals
  @signals
end

#spot_priceString? (readonly)

Note:

Default: none

The maximum hourly price (in USD) to be paid for any Spot Instance launched to fulfill the request.

Spot Instances are launched when the price you specify exceeds the current Spot market price.

launch_template and mixed_instances_policy must not be specified when this property is specified

Returns:

  • (String, nil)


329
330
331
# File 'autoscaling/common_auto_scaling_group_props.rb', line 329

def spot_price
  @spot_price
end

#ssm_session_permissionsBoolean? (readonly)

Note:

Default: false

Add SSM session permissions to the instance role.

Setting this to true adds the necessary permissions to connect to the instance using SSM Session Manager. You can do this from the AWS Console.

NOTE: Setting this flag to true may not be enough by itself. You must also use an AMI that comes with the SSM Agent, or install the SSM Agent yourself. See Working with SSM Agent in the SSM Developer Guide.

Returns:

  • (Boolean, nil)


344
345
346
# File 'autoscaling/common_auto_scaling_group_props.rb', line 344

def ssm_session_permissions
  @ssm_session_permissions
end

#termination_policiesArray<AWSCDK::Autoscaling::TerminationPolicy>? (readonly)

Note:

Default: - TerminationPolicy.DEFAULT

A policy or a list of policies that are used to select the instances to terminate.

The policies are executed in the order that you list them.



352
353
354
# File 'autoscaling/common_auto_scaling_group_props.rb', line 352

def termination_policies
  @termination_policies
end

#termination_policy_custom_lambda_function_arnString? (readonly)

Note:

Default: - No lambda function Arn will be supplied

A lambda function Arn that can be used as a custom termination policy to select the instances to terminate.

This property must be specified if the TerminationPolicy.CUSTOM_LAMBDA_FUNCTION is used.



361
362
363
# File 'autoscaling/common_auto_scaling_group_props.rb', line 361

def termination_policy_custom_lambda_function_arn
  @termination_policy_custom_lambda_function_arn
end

#update_policyAWSCDK::Autoscaling::UpdatePolicy? (readonly)

Note:

Default: - UpdatePolicy.rollingUpdate() if using init, UpdatePolicy.none() otherwise

What to do when an AutoScalingGroup's instance configuration is changed.

This is applied when any of the settings on the ASG are changed that affect how the instances should be created (VPC, instance type, startup scripts, etc.). It indicates how the existing instances should be replaced with new instances matching the new config. By default, nothing is done and only new instances are launched with the new config.



372
373
374
# File 'autoscaling/common_auto_scaling_group_props.rb', line 372

def update_policy
  @update_policy
end

#vpc_subnetsAWSCDK::EC2::SubnetSelection? (readonly)

Note:

Default: - All Private subnets.

Where to place instances within the VPC.



377
378
379
# File 'autoscaling/common_auto_scaling_group_props.rb', line 377

def vpc_subnets
  @vpc_subnets
end

Class Method Details

.jsii_propertiesObject



379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
# File 'autoscaling/common_auto_scaling_group_props.rb', line 379

def self.jsii_properties
  {
    :allow_all_outbound => "allowAllOutbound",
    :associate_public_ip_address => "associatePublicIpAddress",
    :auto_scaling_group_name => "autoScalingGroupName",
    :az_capacity_distribution_strategy => "azCapacityDistributionStrategy",
    :block_devices => "blockDevices",
    :capacity_rebalance => "capacityRebalance",
    :cooldown => "cooldown",
    :default_instance_warmup => "defaultInstanceWarmup",
    :deletion_protection => "deletionProtection",
    :desired_capacity => "desiredCapacity",
    :group_metrics => "groupMetrics",
    :health_check => "healthCheck",
    :health_checks => "healthChecks",
    :ignore_unmodified_size_properties => "ignoreUnmodifiedSizeProperties",
    :instance_lifecycle_policy => "instanceLifecyclePolicy",
    :instance_monitoring => "instanceMonitoring",
    :key_name => "keyName",
    :key_pair => "keyPair",
    :max_capacity => "maxCapacity",
    :max_instance_lifetime => "maxInstanceLifetime",
    :min_capacity => "minCapacity",
    :new_instances_protected_from_scale_in => "newInstancesProtectedFromScaleIn",
    :notifications => "notifications",
    :signals => "signals",
    :spot_price => "spotPrice",
    :ssm_session_permissions => "ssmSessionPermissions",
    :termination_policies => "terminationPolicies",
    :termination_policy_custom_lambda_function_arn => "terminationPolicyCustomLambdaFunctionArn",
    :update_policy => "updatePolicy",
    :vpc_subnets => "vpcSubnets",
  }
end

Instance Method Details

#to_jsiiObject



414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
# File 'autoscaling/common_auto_scaling_group_props.rb', line 414

def to_jsii
  result = {}
  result.merge!({
    "allowAllOutbound" => @allow_all_outbound,
    "associatePublicIpAddress" => @associate_public_ip_address,
    "autoScalingGroupName" => @auto_scaling_group_name,
    "azCapacityDistributionStrategy" => @az_capacity_distribution_strategy,
    "blockDevices" => @block_devices,
    "capacityRebalance" => @capacity_rebalance,
    "cooldown" => @cooldown,
    "defaultInstanceWarmup" => @default_instance_warmup,
    "deletionProtection" => @deletion_protection,
    "desiredCapacity" => @desired_capacity,
    "groupMetrics" => @group_metrics,
    "healthCheck" => @health_check,
    "healthChecks" => @health_checks,
    "ignoreUnmodifiedSizeProperties" => @ignore_unmodified_size_properties,
    "instanceLifecyclePolicy" => @instance_lifecycle_policy,
    "instanceMonitoring" => @instance_monitoring,
    "keyName" => @key_name,
    "keyPair" => @key_pair,
    "maxCapacity" => @max_capacity,
    "maxInstanceLifetime" => @max_instance_lifetime,
    "minCapacity" => @min_capacity,
    "newInstancesProtectedFromScaleIn" => @new_instances_protected_from_scale_in,
    "notifications" => @notifications,
    "signals" => @signals,
    "spotPrice" => @spot_price,
    "ssmSessionPermissions" => @ssm_session_permissions,
    "terminationPolicies" => @termination_policies,
    "terminationPolicyCustomLambdaFunctionArn" => @termination_policy_custom_lambda_function_arn,
    "updatePolicy" => @update_policy,
    "vpcSubnets" => @vpc_subnets,
  })
  result.compact
end