Class: AWSCDK::EKS::AutoScalingGroupCapacityOptions

Inherits:
Autoscaling::CommonAutoScalingGroupProps
  • Object
show all
Defined in:
eks/auto_scaling_group_capacity_options.rb

Overview

Options for adding worker nodes.

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, instance_type:, bootstrap_enabled: nil, bootstrap_options: nil, machine_image_type: nil, map_role: nil, spot_interrupt_handler: nil) ⇒ AutoScalingGroupCapacityOptions

Returns a new instance of AutoScalingGroupCapacityOptions.

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.

  • instance_type (AWSCDK::EC2::InstanceType)

    Instance type of the instances to start.

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

    Configures the EC2 user-data script for instances in this autoscaling group to bootstrap the node (invoke /etc/eks/bootstrap.sh) and associate it with the EKS cluster.

  • bootstrap_options (AWSCDK::EKS::BootstrapOptions, nil) (defaults to: nil)

    EKS node bootstrapping options.

  • machine_image_type (AWSCDK::EKS::MachineImageType, nil) (defaults to: nil)

    Machine image type.

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

    Will automatically update the aws-auth ConfigMap to map the IAM instance role to RBAC.

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

    Installs the AWS spot instance interrupt handler on the cluster if it's not already added.



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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'eks/auto_scaling_group_capacity_options.rb', line 43

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, instance_type:, bootstrap_enabled: nil, bootstrap_options: nil, machine_image_type: nil, map_role: nil, spot_interrupt_handler: 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?
  @instance_type = instance_type
  Jsii::Type.check_type(@instance_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkluc3RhbmNlVHlwZSJ9")), "instanceType")
  @bootstrap_enabled = bootstrap_enabled
  Jsii::Type.check_type(@bootstrap_enabled, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "bootstrapEnabled") unless @bootstrap_enabled.nil?
  @bootstrap_options = bootstrap_options.is_a?(Hash) ? ::AWSCDK::EKS::BootstrapOptions.new(**bootstrap_options.transform_keys(&:to_sym)) : bootstrap_options
  Jsii::Type.check_type(@bootstrap_options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzLkJvb3RzdHJhcE9wdGlvbnMifQ==")), "bootstrapOptions") unless @bootstrap_options.nil?
  @machine_image_type = machine_image_type
  Jsii::Type.check_type(@machine_image_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzLk1hY2hpbmVJbWFnZVR5cGUifQ==")), "machineImageType") unless @machine_image_type.nil?
  @map_role = map_role
  Jsii::Type.check_type(@map_role, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "mapRole") unless @map_role.nil?
  @spot_interrupt_handler = spot_interrupt_handler
  Jsii::Type.check_type(@spot_interrupt_handler, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "spotInterruptHandler") unless @spot_interrupt_handler.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)


122
123
124
# File 'eks/auto_scaling_group_capacity_options.rb', line 122

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)


129
130
131
# File 'eks/auto_scaling_group_capacity_options.rb', line 129

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)


136
137
138
# File 'eks/auto_scaling_group_capacity_options.rb', line 136

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.



141
142
143
# File 'eks/auto_scaling_group_capacity_options.rb', line 141

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



154
155
156
# File 'eks/auto_scaling_group_capacity_options.rb', line 154

def block_devices
  @block_devices
end

#bootstrap_enabledBoolean? (readonly)

Note:

Default: true

Configures the EC2 user-data script for instances in this autoscaling group to bootstrap the node (invoke /etc/eks/bootstrap.sh) and associate it with the EKS cluster.

If you wish to provide a custom user data script, set this to false and manually invoke autoscalingGroup.addUserData().

Returns:

  • (Boolean, nil)


404
405
406
# File 'eks/auto_scaling_group_capacity_options.rb', line 404

def bootstrap_enabled
  @bootstrap_enabled
end

#bootstrap_optionsAWSCDK::EKS::BootstrapOptions? (readonly)

Note:

Default: - none

EKS node bootstrapping options.



409
410
411
# File 'eks/auto_scaling_group_capacity_options.rb', line 409

def bootstrap_options
  @bootstrap_options
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.



164
165
166
# File 'eks/auto_scaling_group_capacity_options.rb', line 164

def capacity_rebalance
  @capacity_rebalance
end

#cooldownAWSCDK::Duration? (readonly)

Note:

Default: Duration.minutes(5)

Default scaling cooldown for this AutoScalingGroup.

Returns:



169
170
171
# File 'eks/auto_scaling_group_capacity_options.rb', line 169

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



184
185
186
# File 'eks/auto_scaling_group_capacity_options.rb', line 184

def default_instance_warmup
  @default_instance_warmup
end

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

Note:

Default: DeletionProtection.NONE

Deletion protection for the Auto Scaling group.



190
191
192
# File 'eks/auto_scaling_group_capacity_options.rb', line 190

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.



199
200
201
# File 'eks/auto_scaling_group_capacity_options.rb', line 199

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:



207
208
209
# File 'eks/auto_scaling_group_capacity_options.rb', line 207

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.



213
214
215
# File 'eks/auto_scaling_group_capacity_options.rb', line 213

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.



221
222
223
# File 'eks/auto_scaling_group_capacity_options.rb', line 221

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)


232
233
234
# File 'eks/auto_scaling_group_capacity_options.rb', line 232

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.



238
239
240
# File 'eks/auto_scaling_group_capacity_options.rb', line 238

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



249
250
251
# File 'eks/auto_scaling_group_capacity_options.rb', line 249

def instance_monitoring
  @instance_monitoring
end

#instance_typeAWSCDK::EC2::InstanceType (readonly)

Instance type of the instances to start.



396
397
398
# File 'eks/auto_scaling_group_capacity_options.rb', line 396

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


259
260
261
# File 'eks/auto_scaling_group_capacity_options.rb', line 259

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:



270
271
272
# File 'eks/auto_scaling_group_capacity_options.rb', line 270

def key_pair
  @key_pair
end

#machine_image_typeAWSCDK::EKS::MachineImageType? (readonly)

Note:

Default: MachineImageType.AMAZON_LINUX_2

Machine image type.



414
415
416
# File 'eks/auto_scaling_group_capacity_options.rb', line 414

def machine_image_type
  @machine_image_type
end

#map_roleBoolean? (readonly)

Note:

Default: - true if the cluster has kubectl enabled (which is the default).

Will automatically update the aws-auth ConfigMap to map the IAM instance role to RBAC.

This cannot be explicitly set to true if the cluster has kubectl disabled.

Returns:

  • (Boolean, nil)


421
422
423
# File 'eks/auto_scaling_group_capacity_options.rb', line 421

def map_role
  @map_role
end

#max_capacityNumeric? (readonly)

Note:

Default: desiredCapacity

Maximum number of instances in the fleet.

Returns:

  • (Numeric, nil)


275
276
277
# File 'eks/auto_scaling_group_capacity_options.rb', line 275

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.



288
289
290
# File 'eks/auto_scaling_group_capacity_options.rb', line 288

def max_instance_lifetime
  @max_instance_lifetime
end

#min_capacityNumeric? (readonly)

Note:

Default: 1

Minimum number of instances in the fleet.

Returns:

  • (Numeric, nil)


293
294
295
# File 'eks/auto_scaling_group_capacity_options.rb', line 293

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)


307
308
309
# File 'eks/auto_scaling_group_capacity_options.rb', line 307

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).



313
314
315
# File 'eks/auto_scaling_group_capacity_options.rb', line 313

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



334
335
336
# File 'eks/auto_scaling_group_capacity_options.rb', line 334

def signals
  @signals
end

#spot_interrupt_handlerBoolean? (readonly)

Note:

Default: true

Installs the AWS spot instance interrupt handler on the cluster if it's not already added.

Only relevant if spot_price is used.

Returns:

  • (Boolean, nil)


428
429
430
# File 'eks/auto_scaling_group_capacity_options.rb', line 428

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


344
345
346
# File 'eks/auto_scaling_group_capacity_options.rb', line 344

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)


359
360
361
# File 'eks/auto_scaling_group_capacity_options.rb', line 359

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.



367
368
369
# File 'eks/auto_scaling_group_capacity_options.rb', line 367

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.



376
377
378
# File 'eks/auto_scaling_group_capacity_options.rb', line 376

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.



387
388
389
# File 'eks/auto_scaling_group_capacity_options.rb', line 387

def update_policy
  @update_policy
end

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

Note:

Default: - All Private subnets.

Where to place instances within the VPC.



392
393
394
# File 'eks/auto_scaling_group_capacity_options.rb', line 392

def vpc_subnets
  @vpc_subnets
end

Class Method Details

.jsii_propertiesObject



430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
# File 'eks/auto_scaling_group_capacity_options.rb', line 430

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",
    :instance_type => "instanceType",
    :bootstrap_enabled => "bootstrapEnabled",
    :bootstrap_options => "bootstrapOptions",
    :machine_image_type => "machineImageType",
    :map_role => "mapRole",
    :spot_interrupt_handler => "spotInterruptHandler",
  }
end

Instance Method Details

#to_jsiiObject



471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
# File 'eks/auto_scaling_group_capacity_options.rb', line 471

def to_jsii
  result = {}
  result.merge!(super)
  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,
    "instanceType" => @instance_type,
    "bootstrapEnabled" => @bootstrap_enabled,
    "bootstrapOptions" => @bootstrap_options,
    "machineImageType" => @machine_image_type,
    "mapRole" => @map_role,
    "spotInterruptHandler" => @spot_interrupt_handler,
  })
  result.compact
end