Class: AWSCDK::Autoscaling::AutoScalingGroupProps
- Inherits:
-
CommonAutoScalingGroupProps
- Object
- CommonAutoScalingGroupProps
- AWSCDK::Autoscaling::AutoScalingGroupProps
- Defined in:
- autoscaling/auto_scaling_group_props.rb
Overview
Properties of a Fleet.
Instance Attribute Summary collapse
-
#allow_all_outbound ⇒ Boolean?
readonly
Whether the instances can initiate connections to anywhere by default.
-
#associate_public_ip_address ⇒ Boolean?
readonly
Whether instances in the Auto Scaling Group should have public IP addresses associated with them.
-
#auto_scaling_group_name ⇒ String?
readonly
The name of the Auto Scaling group.
-
#az_capacity_distribution_strategy ⇒ AWSCDK::Autoscaling::CapacityDistributionStrategy?
readonly
The strategy for distributing instances across Availability Zones.
-
#block_devices ⇒ Array<AWSCDK::Autoscaling::BlockDevice>?
readonly
Specifies how block devices are exposed to the instance.
-
#capacity_rebalance ⇒ Boolean?
readonly
Indicates whether Capacity Rebalancing is enabled.
-
#cooldown ⇒ AWSCDK::Duration?
readonly
Default scaling cooldown for this AutoScalingGroup.
-
#default_instance_warmup ⇒ AWSCDK::Duration?
readonly
The amount of time, in seconds, until a newly launched instance can contribute to the Amazon CloudWatch metrics.
-
#deletion_protection ⇒ AWSCDK::Autoscaling::DeletionProtection?
readonly
Deletion protection for the Auto Scaling group.
-
#desired_capacity ⇒ Numeric?
readonly
Initial amount of instances in the fleet.
-
#group_metrics ⇒ Array<AWSCDK::Autoscaling::GroupMetrics>?
readonly
Enable monitoring for group metrics, these metrics describe the group rather than any of its instances.
-
#health_check ⇒ AWSCDK::Autoscaling::HealthCheck?
readonly
deprecated
Deprecated.
Use
healthChecksinstead -
#health_checks ⇒ AWSCDK::Autoscaling::HealthChecks?
readonly
Configuration for EC2 or additional health checks.
-
#ignore_unmodified_size_properties ⇒ Boolean?
readonly
If the ASG has scheduled actions, don't reset unchanged group sizes.
-
#init ⇒ AWSCDK::EC2::CloudFormationInit?
readonly
Apply the given CloudFormation Init configuration to the instances in the AutoScalingGroup at startup.
-
#init_options ⇒ AWSCDK::Autoscaling::ApplyCloudFormationInitOptions?
readonly
Use the given options for applying CloudFormation Init.
-
#instance_lifecycle_policy ⇒ AWSCDK::Autoscaling::InstanceLifecyclePolicy?
readonly
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?
readonly
Controls whether instances in this group are launched with detailed or basic monitoring.
-
#instance_type ⇒ AWSCDK::EC2::InstanceType?
readonly
Type of instance to launch.
- #key_name ⇒ String? readonly deprecated Deprecated.
-
#key_pair ⇒ AWSCDK::EC2::IKeyPair?
readonly
The SSH keypair to grant access to the instance.
-
#launch_template ⇒ AWSCDK::EC2::ILaunchTemplate?
readonly
Launch template to use.
-
#machine_image ⇒ AWSCDK::EC2::IMachineImage?
readonly
AMI to launch.
-
#max_capacity ⇒ Numeric?
readonly
Maximum number of instances in the fleet.
-
#max_healthy_percentage ⇒ Numeric?
readonly
Specifies the upper threshold as a percentage of the desired capacity of the Auto Scaling group.
-
#max_instance_lifetime ⇒ AWSCDK::Duration?
readonly
The maximum amount of time that an instance can be in service.
-
#migrate_to_launch_template ⇒ Boolean?
readonly
Whether safety guardrail should be enforced when migrating to the launch template.
-
#min_capacity ⇒ Numeric?
readonly
Minimum number of instances in the fleet.
-
#min_healthy_percentage ⇒ Numeric?
readonly
Specifies the lower threshold as a percentage of the desired capacity of the Auto Scaling group.
-
#mixed_instances_policy ⇒ AWSCDK::Autoscaling::MixedInstancesPolicy?
readonly
Mixed Instances Policy to use.
-
#new_instances_protected_from_scale_in ⇒ Boolean?
readonly
Whether newly-launched instances are protected from termination by Amazon EC2 Auto Scaling when scaling in.
-
#notifications ⇒ Array<AWSCDK::Autoscaling::NotificationConfiguration>?
readonly
Configure autoscaling group to send notifications about fleet changes to an SNS topic(s).
-
#require_imdsv2 ⇒ Boolean?
readonly
Whether IMDSv2 should be required on launched instances.
-
#role ⇒ AWSCDK::IAM::IRole?
readonly
An IAM role to associate with the instance profile assigned to this Auto Scaling Group.
-
#security_group ⇒ AWSCDK::EC2::ISecurityGroup?
readonly
Security group to launch the instances in.
-
#signals ⇒ AWSCDK::Autoscaling::Signals?
readonly
Configure waiting for signals during deployment.
-
#spot_price ⇒ String?
readonly
The maximum hourly price (in USD) to be paid for any Spot Instance launched to fulfill the request.
-
#ssm_session_permissions ⇒ Boolean?
readonly
Add SSM session permissions to the instance role.
-
#termination_policies ⇒ Array<AWSCDK::Autoscaling::TerminationPolicy>?
readonly
A policy or a list of policies that are used to select the instances to terminate.
-
#termination_policy_custom_lambda_function_arn ⇒ String?
readonly
A lambda function Arn that can be used as a custom termination policy to select the instances to terminate.
-
#update_policy ⇒ AWSCDK::Autoscaling::UpdatePolicy?
readonly
What to do when an AutoScalingGroup's instance configuration is changed.
-
#user_data ⇒ AWSCDK::EC2::UserData?
readonly
Specific UserData to use.
-
#vpc ⇒ AWSCDK::EC2::IVPC
readonly
VPC to launch these instances in.
-
#vpc_subnets ⇒ AWSCDK::EC2::SubnetSelection?
readonly
Where to place instances within the VPC.
Class Method Summary collapse
Instance Method Summary collapse
-
#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, vpc:, init: nil, init_options: nil, instance_type: nil, launch_template: nil, machine_image: nil, max_healthy_percentage: nil, migrate_to_launch_template: nil, min_healthy_percentage: nil, mixed_instances_policy: nil, require_imdsv2: nil, role: nil, security_group: nil, user_data: nil) ⇒ AutoScalingGroupProps
constructor
A new instance of AutoScalingGroupProps.
- #to_jsii ⇒ Object
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, vpc:, init: nil, init_options: nil, instance_type: nil, launch_template: nil, machine_image: nil, max_healthy_percentage: nil, migrate_to_launch_template: nil, min_healthy_percentage: nil, mixed_instances_policy: nil, require_imdsv2: nil, role: nil, security_group: nil, user_data: nil) ⇒ AutoScalingGroupProps
Returns a new instance of AutoScalingGroupProps.
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 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'autoscaling/auto_scaling_group_props.rb', line 51 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, vpc:, init: nil, init_options: nil, instance_type: nil, launch_template: nil, machine_image: nil, max_healthy_percentage: nil, migrate_to_launch_template: nil, min_healthy_percentage: nil, mixed_instances_policy: nil, require_imdsv2: nil, role: nil, security_group: nil, user_data: 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 = 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? @vpc = vpc Jsii::Type.check_type(@vpc, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklWcGMifQ==")), "vpc") @init = init Jsii::Type.check_type(@init, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkNsb3VkRm9ybWF0aW9uSW5pdCJ9")), "init") unless @init.nil? @init_options = .is_a?(Hash) ? ::AWSCDK::Autoscaling::ApplyCloudFormationInitOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(@init_options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuQXBwbHlDbG91ZEZvcm1hdGlvbkluaXRPcHRpb25zIn0=")), "initOptions") unless @init_options.nil? @instance_type = instance_type Jsii::Type.check_type(@instance_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkluc3RhbmNlVHlwZSJ9")), "instanceType") unless @instance_type.nil? @launch_template = launch_template Jsii::Type.check_type(@launch_template, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklMYXVuY2hUZW1wbGF0ZSJ9")), "launchTemplate") unless @launch_template.nil? @machine_image = machine_image Jsii::Type.check_type(@machine_image, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklNYWNoaW5lSW1hZ2UifQ==")), "machineImage") unless @machine_image.nil? @max_healthy_percentage = max_healthy_percentage Jsii::Type.check_type(@max_healthy_percentage, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maxHealthyPercentage") unless @max_healthy_percentage.nil? @migrate_to_launch_template = migrate_to_launch_template Jsii::Type.check_type(@migrate_to_launch_template, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "migrateToLaunchTemplate") unless @migrate_to_launch_template.nil? @min_healthy_percentage = min_healthy_percentage Jsii::Type.check_type(@min_healthy_percentage, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "minHealthyPercentage") unless @min_healthy_percentage.nil? @mixed_instances_policy = mixed_instances_policy.is_a?(Hash) ? ::AWSCDK::Autoscaling::MixedInstancesPolicy.new(**mixed_instances_policy.transform_keys(&:to_sym)) : mixed_instances_policy Jsii::Type.check_type(@mixed_instances_policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuTWl4ZWRJbnN0YW5jZXNQb2xpY3kifQ==")), "mixedInstancesPolicy") unless @mixed_instances_policy.nil? @require_imdsv2 = require_imdsv2 Jsii::Type.check_type(@require_imdsv2, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "requireImdsv2") unless @require_imdsv2.nil? @role = role Jsii::Type.check_type(@role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "role") unless @role.nil? @security_group = security_group Jsii::Type.check_type(@security_group, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklTZWN1cml0eUdyb3VwIn0=")), "securityGroup") unless @security_group.nil? @user_data = user_data Jsii::Type.check_type(@user_data, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlVzZXJEYXRhIn0=")), "userData") unless @user_data.nil? end |
Instance Attribute Details
#allow_all_outbound ⇒ Boolean? (readonly)
Default: true
Whether the instances can initiate connections to anywhere by default.
146 147 148 |
# File 'autoscaling/auto_scaling_group_props.rb', line 146 def allow_all_outbound @allow_all_outbound end |
#associate_public_ip_address ⇒ Boolean? (readonly)
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
153 154 155 |
# File 'autoscaling/auto_scaling_group_props.rb', line 153 def associate_public_ip_address @associate_public_ip_address end |
#auto_scaling_group_name ⇒ String? (readonly)
Default: - Auto generated by CloudFormation
The name of the Auto Scaling group.
This name must be unique per Region per account.
160 161 162 |
# File 'autoscaling/auto_scaling_group_props.rb', line 160 def auto_scaling_group_name @auto_scaling_group_name end |
#az_capacity_distribution_strategy ⇒ AWSCDK::Autoscaling::CapacityDistributionStrategy? (readonly)
Default: None
The strategy for distributing instances across Availability Zones.
165 166 167 |
# File 'autoscaling/auto_scaling_group_props.rb', line 165 def az_capacity_distribution_strategy @az_capacity_distribution_strategy end |
#block_devices ⇒ Array<AWSCDK::Autoscaling::BlockDevice>? (readonly)
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
178 179 180 |
# File 'autoscaling/auto_scaling_group_props.rb', line 178 def block_devices @block_devices end |
#capacity_rebalance ⇒ Boolean? (readonly)
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.
188 189 190 |
# File 'autoscaling/auto_scaling_group_props.rb', line 188 def capacity_rebalance @capacity_rebalance end |
#cooldown ⇒ AWSCDK::Duration? (readonly)
Default: Duration.minutes(5)
Default scaling cooldown for this AutoScalingGroup.
193 194 195 |
# File 'autoscaling/auto_scaling_group_props.rb', line 193 def cooldown @cooldown end |
#default_instance_warmup ⇒ AWSCDK::Duration? (readonly)
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
208 209 210 |
# File 'autoscaling/auto_scaling_group_props.rb', line 208 def default_instance_warmup @default_instance_warmup end |
#deletion_protection ⇒ AWSCDK::Autoscaling::DeletionProtection? (readonly)
Default: DeletionProtection.NONE
Deletion protection for the Auto Scaling group.
214 215 216 |
# File 'autoscaling/auto_scaling_group_props.rb', line 214 def deletion_protection @deletion_protection end |
#desired_capacity ⇒ Numeric? (readonly)
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.
223 224 225 |
# File 'autoscaling/auto_scaling_group_props.rb', line 223 def desired_capacity @desired_capacity end |
#group_metrics ⇒ Array<AWSCDK::Autoscaling::GroupMetrics>? (readonly)
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.
231 232 233 |
# File 'autoscaling/auto_scaling_group_props.rb', line 231 def group_metrics @group_metrics end |
#health_check ⇒ AWSCDK::Autoscaling::HealthCheck? (readonly)
Use healthChecks instead
Default: - HealthCheck.ec2 with no grace period
Configuration for health checks.
237 238 239 |
# File 'autoscaling/auto_scaling_group_props.rb', line 237 def health_check @health_check end |
#health_checks ⇒ AWSCDK::Autoscaling::HealthChecks? (readonly)
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.
245 246 247 |
# File 'autoscaling/auto_scaling_group_props.rb', line 245 def health_checks @health_checks end |
#ignore_unmodified_size_properties ⇒ Boolean? (readonly)
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.
256 257 258 |
# File 'autoscaling/auto_scaling_group_props.rb', line 256 def ignore_unmodified_size_properties @ignore_unmodified_size_properties end |
#init ⇒ AWSCDK::EC2::CloudFormationInit? (readonly)
Default: - no CloudFormation init
Apply the given CloudFormation Init configuration to the instances in the AutoScalingGroup at startup.
If you specify init, you must also specify signals to configure
the number of instances to wait for and the timeout for waiting for the
init process.
429 430 431 |
# File 'autoscaling/auto_scaling_group_props.rb', line 429 def init @init end |
#init_options ⇒ AWSCDK::Autoscaling::ApplyCloudFormationInitOptions? (readonly)
Default: - default options
Use the given options for applying CloudFormation Init.
Describes the configsets to use and the timeout to wait
436 437 438 |
# File 'autoscaling/auto_scaling_group_props.rb', line 436 def @init_options end |
#instance_lifecycle_policy ⇒ AWSCDK::Autoscaling::InstanceLifecyclePolicy? (readonly)
Default: None
An instance lifecycle policy that defines how instances should be handled during lifecycle events, particularly when lifecycle hooks are abandoned or fail.
262 263 264 |
# File 'autoscaling/auto_scaling_group_props.rb', line 262 def instance_lifecycle_policy @instance_lifecycle_policy end |
#instance_monitoring ⇒ AWSCDK::Autoscaling::Monitoring? (readonly)
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
273 274 275 |
# File 'autoscaling/auto_scaling_group_props.rb', line 273 def instance_monitoring @instance_monitoring end |
#instance_type ⇒ AWSCDK::EC2::InstanceType? (readonly)
Default: - Do not provide any instance type
Type of instance to launch.
launch_template and mixed_instances_policy must not be specified when this property is specified
443 444 445 |
# File 'autoscaling/auto_scaling_group_props.rb', line 443 def instance_type @instance_type end |
#key_name ⇒ String? (readonly)
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.
283 284 285 |
# File 'autoscaling/auto_scaling_group_props.rb', line 283 def key_name @key_name end |
#key_pair ⇒ AWSCDK::EC2::IKeyPair? (readonly)
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.
294 295 296 |
# File 'autoscaling/auto_scaling_group_props.rb', line 294 def key_pair @key_pair end |
#launch_template ⇒ AWSCDK::EC2::ILaunchTemplate? (readonly)
Default: - Do not provide any launch template
Launch template to use.
Launch configuration related settings and MixedInstancesPolicy must not be specified when a launch template is specified.
451 452 453 |
# File 'autoscaling/auto_scaling_group_props.rb', line 451 def launch_template @launch_template end |
#machine_image ⇒ AWSCDK::EC2::IMachineImage? (readonly)
Default: - Do not provide any machine image
AMI to launch.
launch_template and mixed_instances_policy must not be specified when this property is specified
458 459 460 |
# File 'autoscaling/auto_scaling_group_props.rb', line 458 def machine_image @machine_image end |
#max_capacity ⇒ Numeric? (readonly)
Default: desiredCapacity
Maximum number of instances in the fleet.
299 300 301 |
# File 'autoscaling/auto_scaling_group_props.rb', line 299 def max_capacity @max_capacity end |
#max_healthy_percentage ⇒ Numeric? (readonly)
Default: - No instance maintenance policy.
Specifies the upper threshold as a percentage of the desired capacity of the Auto Scaling group.
It represents the maximum percentage of the group that can be in service and healthy, or pending, to support your workload when replacing instances.
Value range is 0 to 100. After it's set, both min_healthy_percentage and max_healthy_percentage to
-1 will clear the previously set value.
Both or neither of min_healthy_percentage and max_healthy_percentage must be specified, and the
difference between them cannot be greater than 100. A large range increases the number of
instances that can be replaced at the same time.
474 475 476 |
# File 'autoscaling/auto_scaling_group_props.rb', line 474 def max_healthy_percentage @max_healthy_percentage end |
#max_instance_lifetime ⇒ AWSCDK::Duration? (readonly)
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.
312 313 314 |
# File 'autoscaling/auto_scaling_group_props.rb', line 312 def max_instance_lifetime @max_instance_lifetime end |
#migrate_to_launch_template ⇒ Boolean? (readonly)
Default: false
Whether safety guardrail should be enforced when migrating to the launch template.
479 480 481 |
# File 'autoscaling/auto_scaling_group_props.rb', line 479 def migrate_to_launch_template @migrate_to_launch_template end |
#min_capacity ⇒ Numeric? (readonly)
Default: 1
Minimum number of instances in the fleet.
317 318 319 |
# File 'autoscaling/auto_scaling_group_props.rb', line 317 def min_capacity @min_capacity end |
#min_healthy_percentage ⇒ Numeric? (readonly)
Default: - No instance maintenance policy.
Specifies the lower threshold as a percentage of the desired capacity of the Auto Scaling group.
It represents the minimum percentage of the group to keep in service, healthy, and ready to use to support your workload when replacing instances.
Value range is 0 to 100. After it's set, both min_healthy_percentage and max_healthy_percentage to
-1 will clear the previously set value.
Both or neither of min_healthy_percentage and max_healthy_percentage must be specified, and the
difference between them cannot be greater than 100. A large range increases the number of
instances that can be replaced at the same time.
495 496 497 |
# File 'autoscaling/auto_scaling_group_props.rb', line 495 def min_healthy_percentage @min_healthy_percentage end |
#mixed_instances_policy ⇒ AWSCDK::Autoscaling::MixedInstancesPolicy? (readonly)
Default: - Do not provide any MixedInstancesPolicy
Mixed Instances Policy to use.
Launch configuration related settings and Launch Template must not be specified when a MixedInstancesPolicy is specified.
503 504 505 |
# File 'autoscaling/auto_scaling_group_props.rb', line 503 def mixed_instances_policy @mixed_instances_policy end |
#new_instances_protected_from_scale_in ⇒ Boolean? (readonly)
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.
331 332 333 |
# File 'autoscaling/auto_scaling_group_props.rb', line 331 def new_instances_protected_from_scale_in @new_instances_protected_from_scale_in end |
#notifications ⇒ Array<AWSCDK::Autoscaling::NotificationConfiguration>? (readonly)
Default: - No fleet change notifications will be sent.
Configure autoscaling group to send notifications about fleet changes to an SNS topic(s).
337 338 339 |
# File 'autoscaling/auto_scaling_group_props.rb', line 337 def notifications @notifications end |
#require_imdsv2 ⇒ Boolean? (readonly)
Default: false
Whether IMDSv2 should be required on launched instances.
508 509 510 |
# File 'autoscaling/auto_scaling_group_props.rb', line 508 def require_imdsv2 @require_imdsv2 end |
#role ⇒ AWSCDK::IAM::IRole? (readonly)
Default: A role will automatically be created, it can be accessed via the role property
An IAM role to associate with the instance profile assigned to this Auto Scaling Group.
The role must be assumable by the service principal ec2.amazonaws.com:
launch_template and mixed_instances_policy must not be specified when this property is specified
521 522 523 |
# File 'autoscaling/auto_scaling_group_props.rb', line 521 def role @role end |
#security_group ⇒ AWSCDK::EC2::ISecurityGroup? (readonly)
Default: - A SecurityGroup will be created if none is specified.
Security group to launch the instances in.
launch_template and mixed_instances_policy must not be specified when this property is specified
528 529 530 |
# File 'autoscaling/auto_scaling_group_props.rb', line 528 def security_group @security_group end |
#signals ⇒ AWSCDK::Autoscaling::Signals? (readonly)
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:
358 359 360 |
# File 'autoscaling/auto_scaling_group_props.rb', line 358 def signals @signals end |
#spot_price ⇒ String? (readonly)
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
368 369 370 |
# File 'autoscaling/auto_scaling_group_props.rb', line 368 def spot_price @spot_price end |
#ssm_session_permissions ⇒ Boolean? (readonly)
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.
383 384 385 |
# File 'autoscaling/auto_scaling_group_props.rb', line 383 def @ssm_session_permissions end |
#termination_policies ⇒ Array<AWSCDK::Autoscaling::TerminationPolicy>? (readonly)
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.
391 392 393 |
# File 'autoscaling/auto_scaling_group_props.rb', line 391 def termination_policies @termination_policies end |
#termination_policy_custom_lambda_function_arn ⇒ String? (readonly)
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.
400 401 402 |
# File 'autoscaling/auto_scaling_group_props.rb', line 400 def termination_policy_custom_lambda_function_arn @termination_policy_custom_lambda_function_arn end |
#update_policy ⇒ AWSCDK::Autoscaling::UpdatePolicy? (readonly)
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.
411 412 413 |
# File 'autoscaling/auto_scaling_group_props.rb', line 411 def update_policy @update_policy end |
#user_data ⇒ AWSCDK::EC2::UserData? (readonly)
Default: - A UserData object appropriate for the MachineImage's Operating System is created.
Specific UserData to use.
The UserData may still be mutated after creation.
launch_template and mixed_instances_policy must not be specified when this property is specified
537 538 539 |
# File 'autoscaling/auto_scaling_group_props.rb', line 537 def user_data @user_data end |
#vpc ⇒ AWSCDK::EC2::IVPC (readonly)
VPC to launch these instances in.
420 421 422 |
# File 'autoscaling/auto_scaling_group_props.rb', line 420 def vpc @vpc end |
#vpc_subnets ⇒ AWSCDK::EC2::SubnetSelection? (readonly)
Default: - All Private subnets.
Where to place instances within the VPC.
416 417 418 |
# File 'autoscaling/auto_scaling_group_props.rb', line 416 def vpc_subnets @vpc_subnets end |
Class Method Details
.jsii_properties ⇒ Object
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 |
# File 'autoscaling/auto_scaling_group_props.rb', line 539 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", :vpc => "vpc", :init => "init", :init_options => "initOptions", :instance_type => "instanceType", :launch_template => "launchTemplate", :machine_image => "machineImage", :max_healthy_percentage => "maxHealthyPercentage", :migrate_to_launch_template => "migrateToLaunchTemplate", :min_healthy_percentage => "minHealthyPercentage", :mixed_instances_policy => "mixedInstancesPolicy", :require_imdsv2 => "requireImdsv2", :role => "role", :security_group => "securityGroup", :user_data => "userData", } end |
Instance Method Details
#to_jsii ⇒ Object
588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 |
# File 'autoscaling/auto_scaling_group_props.rb', line 588 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, "vpc" => @vpc, "init" => @init, "initOptions" => @init_options, "instanceType" => @instance_type, "launchTemplate" => @launch_template, "machineImage" => @machine_image, "maxHealthyPercentage" => @max_healthy_percentage, "migrateToLaunchTemplate" => @migrate_to_launch_template, "minHealthyPercentage" => @min_healthy_percentage, "mixedInstancesPolicy" => @mixed_instances_policy, "requireImdsv2" => @require_imdsv2, "role" => @role, "securityGroup" => @security_group, "userData" => @user_data, }) result.compact end |