Class: AWSCDK::ECS::AsgCapacityProviderProps
- Inherits:
-
AddAutoScalingGroupCapacityOptions
- Object
- AddAutoScalingGroupCapacityOptions
- AWSCDK::ECS::AsgCapacityProviderProps
- Defined in:
- ecs/asg_capacity_provider_props.rb
Overview
The options for creating an Auto Scaling Group Capacity Provider.
Instance Attribute Summary collapse
-
#auto_scaling_group ⇒ AWSCDK::Autoscaling::IAutoScalingGroup
readonly
The autoscaling group to add as a Capacity Provider.
-
#capacity_provider_name ⇒ String?
readonly
The name of the capacity provider.
-
#enable_managed_draining ⇒ Boolean?
readonly
Managed instance draining facilitates graceful termination of Amazon ECS instances.
-
#enable_managed_scaling ⇒ Boolean?
readonly
When enabled the scale-in and scale-out actions of the cluster's Auto Scaling Group will be managed for you.
-
#enable_managed_termination_protection ⇒ Boolean?
readonly
When enabled the Auto Scaling Group will only terminate EC2 instances that no longer have running non-daemon tasks.
-
#instance_warmup_period ⇒ Numeric?
readonly
The period of time, in seconds, after a newly launched Amazon EC2 instance can contribute to CloudWatch metrics for Auto Scaling group.
-
#machine_image_type ⇒ AWSCDK::ECS::MachineImageType?
readonly
What type of machine image this is.
-
#maximum_scaling_step_size ⇒ Numeric?
readonly
Maximum scaling step size.
-
#minimum_scaling_step_size ⇒ Numeric?
readonly
Minimum scaling step size.
-
#spot_instance_draining ⇒ Boolean?
readonly
Specify whether to enable Automated Draining for Spot Instances running Amazon ECS Services.
-
#target_capacity_percent ⇒ Numeric?
readonly
Target capacity percent.
-
#topic_encryption_key ⇒ AWSCDK::KMS::IKey?
readonly
If
AddAutoScalingGroupCapacityOptions.taskDrainTimeis non-zero, then the ECS cluster creates an SNS Topic to as part of a system to drain instances of tasks when the instance is being shut down.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(machine_image_type: nil, spot_instance_draining: nil, topic_encryption_key: nil, auto_scaling_group:, capacity_provider_name: nil, enable_managed_draining: nil, enable_managed_scaling: nil, enable_managed_termination_protection: nil, instance_warmup_period: nil, maximum_scaling_step_size: nil, minimum_scaling_step_size: nil, target_capacity_percent: nil) ⇒ AsgCapacityProviderProps
constructor
A new instance of AsgCapacityProviderProps.
- #to_jsii ⇒ Object
Constructor Details
#initialize(machine_image_type: nil, spot_instance_draining: nil, topic_encryption_key: nil, auto_scaling_group:, capacity_provider_name: nil, enable_managed_draining: nil, enable_managed_scaling: nil, enable_managed_termination_protection: nil, instance_warmup_period: nil, maximum_scaling_step_size: nil, minimum_scaling_step_size: nil, target_capacity_percent: nil) ⇒ AsgCapacityProviderProps
Returns a new instance of AsgCapacityProviderProps.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'ecs/asg_capacity_provider_props.rb', line 19 def initialize(machine_image_type: nil, spot_instance_draining: nil, topic_encryption_key: nil, auto_scaling_group:, capacity_provider_name: nil, enable_managed_draining: nil, enable_managed_scaling: nil, enable_managed_termination_protection: nil, instance_warmup_period: nil, maximum_scaling_step_size: nil, minimum_scaling_step_size: nil, target_capacity_percent: nil) @machine_image_type = machine_image_type Jsii::Type.check_type(@machine_image_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLk1hY2hpbmVJbWFnZVR5cGUifQ==")), "machineImageType") unless @machine_image_type.nil? @spot_instance_draining = spot_instance_draining Jsii::Type.check_type(@spot_instance_draining, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "spotInstanceDraining") unless @spot_instance_draining.nil? @topic_encryption_key = topic_encryption_key Jsii::Type.check_type(@topic_encryption_key, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfa21zLklLZXkifQ==")), "topicEncryptionKey") unless @topic_encryption_key.nil? @auto_scaling_group = auto_scaling_group Jsii::Type.check_type(@auto_scaling_group, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuSUF1dG9TY2FsaW5nR3JvdXAifQ==")), "autoScalingGroup") @capacity_provider_name = capacity_provider_name Jsii::Type.check_type(@capacity_provider_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "capacityProviderName") unless @capacity_provider_name.nil? @enable_managed_draining = enable_managed_draining Jsii::Type.check_type(@enable_managed_draining, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enableManagedDraining") unless @enable_managed_draining.nil? @enable_managed_scaling = enable_managed_scaling Jsii::Type.check_type(@enable_managed_scaling, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enableManagedScaling") unless @enable_managed_scaling.nil? @enable_managed_termination_protection = enable_managed_termination_protection Jsii::Type.check_type(@enable_managed_termination_protection, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enableManagedTerminationProtection") unless @enable_managed_termination_protection.nil? @instance_warmup_period = instance_warmup_period Jsii::Type.check_type(@instance_warmup_period, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "instanceWarmupPeriod") unless @instance_warmup_period.nil? @maximum_scaling_step_size = maximum_scaling_step_size Jsii::Type.check_type(@maximum_scaling_step_size, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maximumScalingStepSize") unless @maximum_scaling_step_size.nil? @minimum_scaling_step_size = minimum_scaling_step_size Jsii::Type.check_type(@minimum_scaling_step_size, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "minimumScalingStepSize") unless @minimum_scaling_step_size.nil? @target_capacity_percent = target_capacity_percent Jsii::Type.check_type(@target_capacity_percent, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "targetCapacityPercent") unless @target_capacity_percent.nil? end |
Instance Attribute Details
#auto_scaling_group ⇒ AWSCDK::Autoscaling::IAutoScalingGroup (readonly)
The autoscaling group to add as a Capacity Provider.
Warning: When passing an imported resource using AutoScalingGroup.fromAutoScalingGroupName along with enableManagedTerminationProtection: true,
the AsgCapacityProvider construct will not be able to enforce the option new_instances_protected_from_scale_in of the AutoScalingGroup.
In this case the constructor of AsgCapacityProvider will throw an exception.
78 79 80 |
# File 'ecs/asg_capacity_provider_props.rb', line 78 def auto_scaling_group @auto_scaling_group end |
#capacity_provider_name ⇒ String? (readonly)
Default: CloudFormation-generated name
The name of the capacity provider.
If a name is specified,
it cannot start with aws, ecs, or fargate. If no name is specified,
a default name in the CFNStackName-CFNResourceName-RandomString format is used.
If the stack name starts with aws, ecs, or fargate, a unique resource name
is generated that starts with cp-.
89 90 91 |
# File 'ecs/asg_capacity_provider_props.rb', line 89 def capacity_provider_name @capacity_provider_name end |
#enable_managed_draining ⇒ Boolean? (readonly)
Default: true
Managed instance draining facilitates graceful termination of Amazon ECS instances.
This allows your service workloads to stop safely and be rescheduled to non-terminating instances. Infrastructure maintenance and updates are preformed without disruptions to workloads. To use managed instance draining, set enableManagedDraining to true.
98 99 100 |
# File 'ecs/asg_capacity_provider_props.rb', line 98 def enable_managed_draining @enable_managed_draining end |
#enable_managed_scaling ⇒ Boolean? (readonly)
Default: true
When enabled the scale-in and scale-out actions of the cluster's Auto Scaling Group will be managed for you.
This means your cluster will automatically scale instances based on the load your tasks put on the cluster. For more information, see Using Managed Scaling in the ECS Developer Guide.
106 107 108 |
# File 'ecs/asg_capacity_provider_props.rb', line 106 def enable_managed_scaling @enable_managed_scaling end |
#enable_managed_termination_protection ⇒ Boolean? (readonly)
Default: true
When enabled the Auto Scaling Group will only terminate EC2 instances that no longer have running non-daemon tasks.
Scale-in protection will be automatically enabled on instances. When all non-daemon tasks are stopped on an instance, ECS initiates the scale-in process and turns off scale-in protection for the instance. The Auto Scaling Group can then terminate the instance. For more information see Managed termination protection in the ECS Developer Guide.
Managed scaling must also be enabled.
119 120 121 |
# File 'ecs/asg_capacity_provider_props.rb', line 119 def enable_managed_termination_protection @enable_managed_termination_protection end |
#instance_warmup_period ⇒ Numeric? (readonly)
Default: 300
The period of time, in seconds, after a newly launched Amazon EC2 instance can contribute to CloudWatch metrics for Auto Scaling group.
Must be between 0 and 10000.
126 127 128 |
# File 'ecs/asg_capacity_provider_props.rb', line 126 def instance_warmup_period @instance_warmup_period end |
#machine_image_type ⇒ AWSCDK::ECS::MachineImageType? (readonly)
Default: - Automatically determined from machineImage, if available, otherwise MachineImageType.AMAZON_LINUX_2.
What type of machine image this is.
Depending on the setting, different UserData will automatically be added
to the AutoScalingGroup to configure it properly for use with ECS.
If you create an AutoScalingGroup yourself and are adding it via
add_auto_scaling_group(), you must specify this value. If you are adding an
auto_scaling_group via add_capacity, this value will be determined
from the machine_image you pass.
58 59 60 |
# File 'ecs/asg_capacity_provider_props.rb', line 58 def machine_image_type @machine_image_type end |
#maximum_scaling_step_size ⇒ Numeric? (readonly)
Default: 1000
Maximum scaling step size.
In most cases this should be left alone.
133 134 135 |
# File 'ecs/asg_capacity_provider_props.rb', line 133 def maximum_scaling_step_size @maximum_scaling_step_size end |
#minimum_scaling_step_size ⇒ Numeric? (readonly)
Default: 1
Minimum scaling step size.
In most cases this should be left alone.
140 141 142 |
# File 'ecs/asg_capacity_provider_props.rb', line 140 def minimum_scaling_step_size @minimum_scaling_step_size end |
#spot_instance_draining ⇒ Boolean? (readonly)
Default: false
Specify whether to enable Automated Draining for Spot Instances running Amazon ECS Services.
For more information, see Using Spot Instances.
65 66 67 |
# File 'ecs/asg_capacity_provider_props.rb', line 65 def spot_instance_draining @spot_instance_draining end |
#target_capacity_percent ⇒ Numeric? (readonly)
Default: 100
Target capacity percent.
In most cases this should be left alone.
147 148 149 |
# File 'ecs/asg_capacity_provider_props.rb', line 147 def target_capacity_percent @target_capacity_percent end |
#topic_encryption_key ⇒ AWSCDK::KMS::IKey? (readonly)
Default: The SNS Topic will not be encrypted.
If AddAutoScalingGroupCapacityOptions.taskDrainTime is non-zero, then the ECS cluster creates an SNS Topic to as part of a system to drain instances of tasks when the instance is being shut down. If this property is provided, then this key will be used to encrypt the contents of that SNS Topic. See SNS Data Encryption for more information.
70 71 72 |
# File 'ecs/asg_capacity_provider_props.rb', line 70 def topic_encryption_key @topic_encryption_key end |
Class Method Details
.jsii_properties ⇒ Object
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'ecs/asg_capacity_provider_props.rb', line 149 def self.jsii_properties { :machine_image_type => "machineImageType", :spot_instance_draining => "spotInstanceDraining", :topic_encryption_key => "topicEncryptionKey", :auto_scaling_group => "autoScalingGroup", :capacity_provider_name => "capacityProviderName", :enable_managed_draining => "enableManagedDraining", :enable_managed_scaling => "enableManagedScaling", :enable_managed_termination_protection => "enableManagedTerminationProtection", :instance_warmup_period => "instanceWarmupPeriod", :maximum_scaling_step_size => "maximumScalingStepSize", :minimum_scaling_step_size => "minimumScalingStepSize", :target_capacity_percent => "targetCapacityPercent", } end |
Instance Method Details
#to_jsii ⇒ Object
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'ecs/asg_capacity_provider_props.rb', line 166 def to_jsii result = {} result.merge!(super) result.merge!({ "machineImageType" => @machine_image_type, "spotInstanceDraining" => @spot_instance_draining, "topicEncryptionKey" => @topic_encryption_key, "autoScalingGroup" => @auto_scaling_group, "capacityProviderName" => @capacity_provider_name, "enableManagedDraining" => @enable_managed_draining, "enableManagedScaling" => @enable_managed_scaling, "enableManagedTerminationProtection" => @enable_managed_termination_protection, "instanceWarmupPeriod" => @instance_warmup_period, "maximumScalingStepSize" => @maximum_scaling_step_size, "minimumScalingStepSize" => @minimum_scaling_step_size, "targetCapacityPercent" => @target_capacity_percent, }) result.compact end |