Class: AWSCDK::Autoscaling::AutoScalingGroup

Inherits:
Resource
  • Object
show all
Includes:
IAutoScalingGroup, EC2::IConnectable, ElasticLoadBalancing::ILoadBalancerTarget, ElasticLoadBalancingv2::IApplicationLoadBalancerTarget, ElasticLoadBalancingv2::INetworkLoadBalancerTarget
Defined in:
autoscaling/auto_scaling_group.rb

Overview

A Fleet represents a managed set of EC2 instances.

The Fleet models a number of AutoScalingGroups, a launch configuration, a security group and an instance role.

It allows adding arbitrary commands to the startup scripts of the instances in the fleet.

The ASG spans the availability zones specified by vpcSubnets, falling back to the Vpc default strategy if not specified.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, id, props) ⇒ AutoScalingGroup

Returns a new instance of AutoScalingGroup.

Parameters:



25
26
27
28
29
30
31
# File 'autoscaling/auto_scaling_group.rb', line 25

def initialize(scope, id, props)
  props = props.is_a?(Hash) ? ::AWSCDK::Autoscaling::AutoScalingGroupProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuQXV0b1NjYWxpbmdHcm91cFByb3BzIn0=")), "props")
  Jsii::Object.instance_method(:initialize).bind(self).call(scope, id, props)
end

Class Method Details

.from_auto_scaling_group_name(scope, id, auto_scaling_group_name) ⇒ AWSCDK::Autoscaling::IAutoScalingGroup

Parameters:

  • scope (Constructs::Construct)
  • id (String)
  • auto_scaling_group_name (String)

Returns:



84
85
86
87
88
89
# File 'autoscaling/auto_scaling_group.rb', line 84

def self.from_auto_scaling_group_name(scope, id, auto_scaling_group_name)
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  Jsii::Type.check_type(auto_scaling_group_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "autoScalingGroupName")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_autoscaling.AutoScalingGroup", "fromAutoScalingGroupName", [scope, id, auto_scaling_group_name])
end

.jsii_overridable_methodsObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'autoscaling/auto_scaling_group.rb', line 33

def self.jsii_overridable_methods
  {
    :node => { kind: :property, name: "node", is_optional: false },
    :env => { kind: :property, name: "env", is_optional: false },
    :physical_name => { kind: :property, name: "physicalName", is_optional: false },
    :stack => { kind: :property, name: "stack", is_optional: false },
    :auto_scaling_group_arn => { kind: :property, name: "autoScalingGroupArn", is_optional: false },
    :auto_scaling_group_name => { kind: :property, name: "autoScalingGroupName", is_optional: false },
    :auto_scaling_group_ref => { kind: :property, name: "autoScalingGroupRef", is_optional: false },
    :connections => { kind: :property, name: "connections", is_optional: false },
    :grant_principal => { kind: :property, name: "grantPrincipal", is_optional: false },
    :os_type => { kind: :property, name: "osType", is_optional: false },
    :role => { kind: :property, name: "role", is_optional: false },
    :user_data => { kind: :property, name: "userData", is_optional: false },
    :max_instance_lifetime => { kind: :property, name: "maxInstanceLifetime", is_optional: true },
    :spot_price => { kind: :property, name: "spotPrice", is_optional: true },
    :has_called_scale_on_request_count => { kind: :property, name: "hasCalledScaleOnRequestCount", is_optional: false },
    :alb_target_group => { kind: :property, name: "albTargetGroup", is_optional: true },
    :new_instances_protected_from_scale_in => { kind: :property, name: "newInstancesProtectedFromScaleIn", is_optional: true },
    :to_string => { kind: :method, name: "toString", is_optional: false },
    :with => { kind: :method, name: "with", is_optional: false },
    :apply_cross_stack_reference_strength => { kind: :method, name: "applyCrossStackReferenceStrength", is_optional: false },
    :apply_removal_policy => { kind: :method, name: "applyRemovalPolicy", is_optional: false },
    :generate_physical_name => { kind: :method, name: "generatePhysicalName", is_optional: false },
    :get_resource_arn_attribute => { kind: :method, name: "getResourceArnAttribute", is_optional: false },
    :get_resource_name_attribute => { kind: :method, name: "getResourceNameAttribute", is_optional: false },
    :add_lifecycle_hook => { kind: :method, name: "addLifecycleHook", is_optional: false },
    :add_security_group => { kind: :method, name: "addSecurityGroup", is_optional: false },
    :add_to_role_policy => { kind: :method, name: "addToRolePolicy", is_optional: false },
    :add_user_data => { kind: :method, name: "addUserData", is_optional: false },
    :add_warm_pool => { kind: :method, name: "addWarmPool", is_optional: false },
    :apply_cloud_formation_init => { kind: :method, name: "applyCloudFormationInit", is_optional: false },
    :are_new_instances_protected_from_scale_in => { kind: :method, name: "areNewInstancesProtectedFromScaleIn", is_optional: false },
    :attach_to_application_target_group => { kind: :method, name: "attachToApplicationTargetGroup", is_optional: false },
    :attach_to_classic_lb => { kind: :method, name: "attachToClassicLB", is_optional: false },
    :attach_to_network_target_group => { kind: :method, name: "attachToNetworkTargetGroup", is_optional: false },
    :protect_new_instances_from_scale_in => { kind: :method, name: "protectNewInstancesFromScaleIn", is_optional: false },
    :scale_on_cpu_utilization => { kind: :method, name: "scaleOnCpuUtilization", is_optional: false },
    :scale_on_incoming_bytes => { kind: :method, name: "scaleOnIncomingBytes", is_optional: false },
    :scale_on_metric => { kind: :method, name: "scaleOnMetric", is_optional: false },
    :scale_on_outgoing_bytes => { kind: :method, name: "scaleOnOutgoingBytes", is_optional: false },
    :scale_on_request_count => { kind: :method, name: "scaleOnRequestCount", is_optional: false },
    :scale_on_schedule => { kind: :method, name: "scaleOnSchedule", is_optional: false },
    :scale_to_track_metric => { kind: :method, name: "scaleToTrackMetric", is_optional: false },
  }
end

.PROPERTY_INJECTION_IDString

Uniquely identifies this class.

Returns:

  • (String)


137
138
139
# File 'autoscaling/auto_scaling_group.rb', line 137

def self.PROPERTY_INJECTION_ID()
  Jsii::Kernel.instance.get_static("aws-cdk-lib.aws_autoscaling.AutoScalingGroup", "PROPERTY_INJECTION_ID")
end

Instance Method Details

#add_lifecycle_hook(id, props) ⇒ AWSCDK::Autoscaling::LifecycleHook

Send a message to either an SQS queue or SNS topic when instances launch or terminate.



339
340
341
342
343
344
# File 'autoscaling/auto_scaling_group.rb', line 339

def add_lifecycle_hook(id, props)
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  props = props.is_a?(Hash) ? ::AWSCDK::Autoscaling::BasicLifecycleHookProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuQmFzaWNMaWZlY3ljbGVIb29rUHJvcHMifQ==")), "props")
  jsii_call_method("addLifecycleHook", [id, props])
end

#add_security_group(security_group) ⇒ void

This method returns an undefined value.

Add the security group to all instances via the launch template security groups array.

Parameters:



350
351
352
353
# File 'autoscaling/auto_scaling_group.rb', line 350

def add_security_group(security_group)
  Jsii::Type.check_type(security_group, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklTZWN1cml0eUdyb3VwIn0=")), "securityGroup")
  jsii_call_method("addSecurityGroup", [security_group])
end

#add_to_role_policy(statement) ⇒ void

This method returns an undefined value.

Adds a statement to the IAM role assumed by instances of this fleet.

Parameters:



359
360
361
362
# File 'autoscaling/auto_scaling_group.rb', line 359

def add_to_role_policy(statement)
  Jsii::Type.check_type(statement, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeVN0YXRlbWVudCJ9")), "statement")
  jsii_call_method("addToRolePolicy", [statement])
end

#add_user_data(*commands) ⇒ void

This method returns an undefined value.

Add command to the startup script of fleet instances.

The command must be in the scripting language supported by the fleet's OS (i.e. Linux/Windows). Does nothing for imported ASGs.

Parameters:

  • commands (Array<String>)


371
372
373
374
375
376
# File 'autoscaling/auto_scaling_group.rb', line 371

def add_user_data(*commands)
  commands.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "commands[#{index}]")
  end
  jsii_call_method("addUserData", [*commands])
end

#add_warm_pool(options = nil) ⇒ AWSCDK::Autoscaling::WarmPool

Add a pool of pre-initialized EC2 instances that sits alongside an Auto Scaling group.

Parameters:

Returns:



382
383
384
385
386
# File 'autoscaling/auto_scaling_group.rb', line 382

def add_warm_pool(options = nil)
  options = options.is_a?(Hash) ? ::AWSCDK::Autoscaling::WarmPoolOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuV2FybVBvb2xPcHRpb25zIn0=")), "options") unless options.nil?
  jsii_call_method("addWarmPool", [options])
end

#alb_target_groupAWSCDK::ElasticLoadBalancingv2::ApplicationTargetGroup?



225
226
227
# File 'autoscaling/auto_scaling_group.rb', line 225

def alb_target_group()
  jsii_get_property("albTargetGroup")
end

#alb_target_group=(value) ⇒ Object



229
230
231
232
# File 'autoscaling/auto_scaling_group.rb', line 229

def alb_target_group=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWxhc3RpY2xvYWRiYWxhbmNpbmd2Mi5BcHBsaWNhdGlvblRhcmdldEdyb3VwIn0=")), "albTargetGroup") unless value.nil?
  jsii_set_property("albTargetGroup", value)
end

#apply_cloud_formation_init(init, options = nil) ⇒ void

This method returns an undefined value.

Use a CloudFormation Init configuration at instance startup.

This does the following:

  • Attaches the CloudFormation Init metadata to the AutoScalingGroup resource.
  • Add commands to the UserData to run cfn-init and cfn-signal.
  • Update the instance's CreationPolicy to wait for cfn-init to finish before reporting success.

Parameters:



400
401
402
403
404
405
# File 'autoscaling/auto_scaling_group.rb', line 400

def apply_cloud_formation_init(init, options = nil)
  Jsii::Type.check_type(init, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkNsb3VkRm9ybWF0aW9uSW5pdCJ9")), "init")
  options = options.is_a?(Hash) ? ::AWSCDK::Autoscaling::ApplyCloudFormationInitOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuQXBwbHlDbG91ZEZvcm1hdGlvbkluaXRPcHRpb25zIn0=")), "options") unless options.nil?
  jsii_call_method("applyCloudFormationInit", [init, options])
end

#apply_cross_stack_reference_strength(strength) ⇒ void

This method returns an undefined value.

Override the cross-stack reference strength for this resource.

When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.

Parameters:



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

def apply_cross_stack_reference_strength(strength)
  Jsii::Type.check_type(strength, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZWZlcmVuY2VTdHJlbmd0aCJ9")), "strength")
  jsii_call_method("applyCrossStackReferenceStrength", [strength])
end

#apply_removal_policy(policy) ⇒ void

This method returns an undefined value.

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters:



294
295
296
297
# File 'autoscaling/auto_scaling_group.rb', line 294

def apply_removal_policy(policy)
  Jsii::Type.check_type(policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "policy")
  jsii_call_method("applyRemovalPolicy", [policy])
end

#are_new_instances_protected_from_scale_inBoolean

Returns true if newly-launched instances are protected from scale-in.

Returns:

  • (Boolean)


410
411
412
# File 'autoscaling/auto_scaling_group.rb', line 410

def are_new_instances_protected_from_scale_in()
  jsii_call_method("areNewInstancesProtectedFromScaleIn", [])
end

#attach_to_application_target_group(target_group) ⇒ AWSCDK::ElasticLoadBalancingv2::LoadBalancerTargetProps

Attach to ELBv2 Application Target Group.



418
419
420
421
# File 'autoscaling/auto_scaling_group.rb', line 418

def attach_to_application_target_group(target_group)
  Jsii::Type.check_type(target_group, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWxhc3RpY2xvYWRiYWxhbmNpbmd2Mi5JQXBwbGljYXRpb25UYXJnZXRHcm91cCJ9")), "targetGroup")
  jsii_call_method("attachToApplicationTargetGroup", [target_group])
end

#attach_to_classic_lb(load_balancer) ⇒ void

This method returns an undefined value.

Attach to a classic load balancer.

Parameters:



427
428
429
430
# File 'autoscaling/auto_scaling_group.rb', line 427

def attach_to_classic_lb(load_balancer)
  Jsii::Type.check_type(load_balancer, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWxhc3RpY2xvYWRiYWxhbmNpbmcuTG9hZEJhbGFuY2VyIn0=")), "loadBalancer")
  jsii_call_method("attachToClassicLB", [load_balancer])
end

#attach_to_network_target_group(target_group) ⇒ AWSCDK::ElasticLoadBalancingv2::LoadBalancerTargetProps

Attach to ELBv2 Application Target Group.



436
437
438
439
# File 'autoscaling/auto_scaling_group.rb', line 436

def attach_to_network_target_group(target_group)
  Jsii::Type.check_type(target_group, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWxhc3RpY2xvYWRiYWxhbmNpbmd2Mi5JTmV0d29ya1RhcmdldEdyb3VwIn0=")), "targetGroup")
  jsii_call_method("attachToNetworkTargetGroup", [target_group])
end

#auto_scaling_group_arnString

Arn of the AutoScalingGroup.

Returns:

  • (String)


144
145
146
# File 'autoscaling/auto_scaling_group.rb', line 144

def auto_scaling_group_arn()
  jsii_get_property("autoScalingGroupArn")
end

#auto_scaling_group_nameString

Name of the AutoScalingGroup.

Returns:

  • (String)


151
152
153
# File 'autoscaling/auto_scaling_group.rb', line 151

def auto_scaling_group_name()
  jsii_get_property("autoScalingGroupName")
end

#auto_scaling_group_refAWSCDK::Interfaces::AWSAutoscaling::AutoScalingGroupReference

A reference to a AutoScalingGroup resource.



158
159
160
# File 'autoscaling/auto_scaling_group.rb', line 158

def auto_scaling_group_ref()
  jsii_get_property("autoScalingGroupRef")
end

#connectionsAWSCDK::EC2::Connections

The network connections associated with this resource.



165
166
167
# File 'autoscaling/auto_scaling_group.rb', line 165

def connections()
  jsii_get_property("connections")
end

#envAWSCDK::Interfaces::ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.



109
110
111
# File 'autoscaling/auto_scaling_group.rb', line 109

def env()
  jsii_get_property("env")
end

#generate_physical_nameString

Returns:

  • (String)


300
301
302
# File 'autoscaling/auto_scaling_group.rb', line 300

def generate_physical_name()
  jsii_call_method("generatePhysicalName", [])
end

#get_resource_arn_attribute(arn_attr, arn_components) ⇒ String

Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. bucket.bucketArn).

Normally, this token will resolve to arn_attr, but if the resource is referenced across environments, arn_components will be used to synthesize a concrete ARN with the resource's physical name. Make sure to reference this.physicalName in arn_components.

Parameters:

  • arn_attr (String)

    The CFN attribute which resolves to the ARN of the resource.

  • arn_components (AWSCDK::ARNComponents)

    The format of the ARN of this resource.

Returns:

  • (String)


314
315
316
317
318
319
# File 'autoscaling/auto_scaling_group.rb', line 314

def get_resource_arn_attribute(arn_attr, arn_components)
  Jsii::Type.check_type(arn_attr, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "arnAttr")
  arn_components = arn_components.is_a?(Hash) ? ::AWSCDK::ARNComponents.new(**arn_components.transform_keys(&:to_sym)) : arn_components
  Jsii::Type.check_type(arn_components, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5Bcm5Db21wb25lbnRzIn0=")), "arnComponents")
  jsii_call_method("getResourceArnAttribute", [arn_attr, arn_components])
end

#get_resource_name_attribute(name_attr) ⇒ String

Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. bucket.bucketName).

Normally, this token will resolve to name_attr, but if the resource is referenced across environments, it will be resolved to this.physicalName, which will be a concrete name.

Parameters:

  • name_attr (String)

    The CFN attribute which resolves to the resource's name.

Returns:

  • (String)


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

def get_resource_name_attribute(name_attr)
  Jsii::Type.check_type(name_attr, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "nameAttr")
  jsii_call_method("getResourceNameAttribute", [name_attr])
end

#grant_principalAWSCDK::IAM::IPrincipal

The principal to grant permissions to.



172
173
174
# File 'autoscaling/auto_scaling_group.rb', line 172

def grant_principal()
  jsii_get_property("grantPrincipal")
end

#has_called_scale_on_request_countBoolean

Returns:

  • (Boolean)


215
216
217
# File 'autoscaling/auto_scaling_group.rb', line 215

def has_called_scale_on_request_count()
  jsii_get_property("hasCalledScaleOnRequestCount")
end

#has_called_scale_on_request_count=(value) ⇒ Object



219
220
221
222
# File 'autoscaling/auto_scaling_group.rb', line 219

def has_called_scale_on_request_count=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "hasCalledScaleOnRequestCount")
  jsii_set_property("hasCalledScaleOnRequestCount", value)
end

#max_instance_lifetimeAWSCDK::Duration?

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

Returns:



200
201
202
# File 'autoscaling/auto_scaling_group.rb', line 200

def max_instance_lifetime()
  jsii_get_property("maxInstanceLifetime")
end

#new_instances_protected_from_scale_inBoolean?

Returns:

  • (Boolean, nil)


235
236
237
# File 'autoscaling/auto_scaling_group.rb', line 235

def new_instances_protected_from_scale_in()
  jsii_get_property("newInstancesProtectedFromScaleIn")
end

#new_instances_protected_from_scale_in=(value) ⇒ Object



239
240
241
242
# File 'autoscaling/auto_scaling_group.rb', line 239

def new_instances_protected_from_scale_in=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "newInstancesProtectedFromScaleIn") unless value.nil?
  jsii_set_property("newInstancesProtectedFromScaleIn", value)
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


94
95
96
# File 'autoscaling/auto_scaling_group.rb', line 94

def node()
  jsii_get_property("node")
end

#os_typeAWSCDK::EC2::OperatingSystemType

The type of OS instances of this fleet are running.



179
180
181
# File 'autoscaling/auto_scaling_group.rb', line 179

def os_type()
  jsii_get_property("osType")
end

#physical_nameString

Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.

This value will resolve to one of the following:

  • a concrete value (e.g. "my-awesome-bucket")
  • undefined, when a name should be generated by CloudFormation
  • a concrete name generated automatically during synthesis, in cross-environment scenarios.

Returns:

  • (String)


123
124
125
# File 'autoscaling/auto_scaling_group.rb', line 123

def physical_name()
  jsii_get_property("physicalName")
end

#protect_new_instances_from_scale_invoid

This method returns an undefined value.

Ensures newly-launched instances are protected from scale-in.



444
445
446
# File 'autoscaling/auto_scaling_group.rb', line 444

def protect_new_instances_from_scale_in()
  jsii_call_method("protectNewInstancesFromScaleIn", [])
end

#roleAWSCDK::IAM::IRole

The IAM Role in the instance profile.

Returns:



186
187
188
# File 'autoscaling/auto_scaling_group.rb', line 186

def role()
  jsii_get_property("role")
end

#scale_on_cpu_utilization(id, props) ⇒ AWSCDK::Autoscaling::TargetTrackingScalingPolicy

Scale out or in to achieve a target CPU utilization.



453
454
455
456
457
458
# File 'autoscaling/auto_scaling_group.rb', line 453

def scale_on_cpu_utilization(id, props)
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  props = props.is_a?(Hash) ? ::AWSCDK::Autoscaling::CpuUtilizationScalingProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuQ3B1VXRpbGl6YXRpb25TY2FsaW5nUHJvcHMifQ==")), "props")
  jsii_call_method("scaleOnCpuUtilization", [id, props])
end

#scale_on_incoming_bytes(id, props) ⇒ AWSCDK::Autoscaling::TargetTrackingScalingPolicy

Scale out or in to achieve a target network ingress rate.



465
466
467
468
469
470
# File 'autoscaling/auto_scaling_group.rb', line 465

def scale_on_incoming_bytes(id, props)
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  props = props.is_a?(Hash) ? ::AWSCDK::Autoscaling::NetworkUtilizationScalingProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuTmV0d29ya1V0aWxpemF0aW9uU2NhbGluZ1Byb3BzIn0=")), "props")
  jsii_call_method("scaleOnIncomingBytes", [id, props])
end

#scale_on_metric(id, props) ⇒ AWSCDK::Autoscaling::StepScalingPolicy

Scale out or in, in response to a metric.



477
478
479
480
481
482
# File 'autoscaling/auto_scaling_group.rb', line 477

def scale_on_metric(id, props)
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  props = props.is_a?(Hash) ? ::AWSCDK::Autoscaling::BasicStepScalingPolicyProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuQmFzaWNTdGVwU2NhbGluZ1BvbGljeVByb3BzIn0=")), "props")
  jsii_call_method("scaleOnMetric", [id, props])
end

#scale_on_outgoing_bytes(id, props) ⇒ AWSCDK::Autoscaling::TargetTrackingScalingPolicy

Scale out or in to achieve a target network egress rate.



489
490
491
492
493
494
# File 'autoscaling/auto_scaling_group.rb', line 489

def scale_on_outgoing_bytes(id, props)
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  props = props.is_a?(Hash) ? ::AWSCDK::Autoscaling::NetworkUtilizationScalingProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuTmV0d29ya1V0aWxpemF0aW9uU2NhbGluZ1Byb3BzIn0=")), "props")
  jsii_call_method("scaleOnOutgoingBytes", [id, props])
end

#scale_on_request_count(id, props) ⇒ AWSCDK::Autoscaling::TargetTrackingScalingPolicy

Scale out or in to achieve a target request handling rate.

The AutoScalingGroup must have been attached to an Application Load Balancer in order to be able to call this.



504
505
506
507
508
509
# File 'autoscaling/auto_scaling_group.rb', line 504

def scale_on_request_count(id, props)
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  props = props.is_a?(Hash) ? ::AWSCDK::Autoscaling::RequestCountScalingProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuUmVxdWVzdENvdW50U2NhbGluZ1Byb3BzIn0=")), "props")
  jsii_call_method("scaleOnRequestCount", [id, props])
end

#scale_on_schedule(id, props) ⇒ AWSCDK::Autoscaling::ScheduledAction

Scale out or in based on time.



516
517
518
519
520
521
# File 'autoscaling/auto_scaling_group.rb', line 516

def scale_on_schedule(id, props)
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  props = props.is_a?(Hash) ? ::AWSCDK::Autoscaling::BasicScheduledActionProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuQmFzaWNTY2hlZHVsZWRBY3Rpb25Qcm9wcyJ9")), "props")
  jsii_call_method("scaleOnSchedule", [id, props])
end

#scale_to_track_metric(id, props) ⇒ AWSCDK::Autoscaling::TargetTrackingScalingPolicy

Scale out or in in order to keep a metric around a target value.



528
529
530
531
532
533
# File 'autoscaling/auto_scaling_group.rb', line 528

def scale_to_track_metric(id, props)
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  props = props.is_a?(Hash) ? ::AWSCDK::Autoscaling::MetricTargetTrackingProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYXV0b3NjYWxpbmcuTWV0cmljVGFyZ2V0VHJhY2tpbmdQcm9wcyJ9")), "props")
  jsii_call_method("scaleToTrackMetric", [id, props])
end

#spot_priceString?

The maximum spot price configured for the autoscaling group.

undefined indicates that this group uses on-demand capacity.

Returns:

  • (String, nil)


210
211
212
# File 'autoscaling/auto_scaling_group.rb', line 210

def spot_price()
  jsii_get_property("spotPrice")
end

#stackAWSCDK::Stack

The stack in which this resource is defined.

Returns:



130
131
132
# File 'autoscaling/auto_scaling_group.rb', line 130

def stack()
  jsii_get_property("stack")
end

#to_stringString

Returns a string representation of this construct.

Returns:

  • (String)


247
248
249
# File 'autoscaling/auto_scaling_group.rb', line 247

def to_string()
  jsii_call_method("toString", [])
end

#user_dataAWSCDK::EC2::UserData

The Base64-encoded user data to make available to the launched EC2 instances.



193
194
195
# File 'autoscaling/auto_scaling_group.rb', line 193

def user_data()
  jsii_get_property("userData")
end

#with(*mixins) ⇒ Constructs::IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

Parameters:

  • mixins (Array<Constructs::IMixin>)

Returns:

  • (Constructs::IConstruct)


260
261
262
263
264
265
# File 'autoscaling/auto_scaling_group.rb', line 260

def with(*mixins)
  mixins.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]")
  end
  jsii_call_method("with", [*mixins])
end