Class: AWSCDK::Autoscaling::CfnAutoScalingGroup::LifecycleHookSpecificationProperty

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

Overview

LifecycleHookSpecification specifies a lifecycle hook for the LifecycleHookSpecificationList property of the AWS::AutoScaling::AutoScalingGroup resource. A lifecycle hook specifies actions to perform when Amazon EC2 Auto Scaling launches or terminates instances.

For more information, see Amazon EC2 Auto Scaling lifecycle hooks in the Amazon EC2 Auto Scaling User Guide . You can find a sample template snippet in the Examples section of the AWS::AutoScaling::LifecycleHook resource.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lifecycle_hook_name:, lifecycle_transition:, default_result: nil, heartbeat_timeout: nil, notification_metadata: nil, notification_target_arn: nil, role_arn: nil) ⇒ LifecycleHookSpecificationProperty

Returns a new instance of LifecycleHookSpecificationProperty.

Parameters:

  • lifecycle_hook_name (String)

    The name of the lifecycle hook.

  • lifecycle_transition (String)

    The lifecycle transition. For Auto Scaling groups, there are two major lifecycle transitions.

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

    The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs.

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

    The maximum time, in seconds, that can elapse before the lifecycle hook times out.

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

    Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target.

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

    The Amazon Resource Name (ARN) of the notification target that Amazon EC2 Auto Scaling sends notifications to when an instance is in a wait state for the lifecycle hook.

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

    The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.



2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
# File 'autoscaling/cfn_auto_scaling_group.rb', line 2247

def initialize(lifecycle_hook_name:, lifecycle_transition:, default_result: nil, heartbeat_timeout: nil, notification_metadata: nil, notification_target_arn: nil, role_arn: nil)
  @lifecycle_hook_name = lifecycle_hook_name
  Jsii::Type.check_type(@lifecycle_hook_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "lifecycleHookName")
  @lifecycle_transition = lifecycle_transition
  Jsii::Type.check_type(@lifecycle_transition, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "lifecycleTransition")
  @default_result = default_result
  Jsii::Type.check_type(@default_result, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "defaultResult") unless @default_result.nil?
  @heartbeat_timeout = heartbeat_timeout
  Jsii::Type.check_type(@heartbeat_timeout, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "heartbeatTimeout") unless @heartbeat_timeout.nil?
  @notification_metadata = 
  Jsii::Type.check_type(@notification_metadata, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "notificationMetadata") unless @notification_metadata.nil?
  @notification_target_arn = notification_target_arn
  Jsii::Type.check_type(@notification_target_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "notificationTargetArn") unless @notification_target_arn.nil?
  @role_arn = role_arn
  Jsii::Type.check_type(@role_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "roleArn") unless @role_arn.nil?
end

Instance Attribute Details

#default_resultString? (readonly)

The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs.

The default value is ABANDON .

Valid values: CONTINUE | ABANDON



2285
2286
2287
# File 'autoscaling/cfn_auto_scaling_group.rb', line 2285

def default_result
  @default_result
end

#heartbeat_timeoutNumeric? (readonly)

The maximum time, in seconds, that can elapse before the lifecycle hook times out.

The range is from 30 to 7200 seconds. The default value is 3600 seconds (1 hour).



2292
2293
2294
# File 'autoscaling/cfn_auto_scaling_group.rb', line 2292

def heartbeat_timeout
  @heartbeat_timeout
end

#lifecycle_hook_nameString (readonly)

The name of the lifecycle hook.



2268
2269
2270
# File 'autoscaling/cfn_auto_scaling_group.rb', line 2268

def lifecycle_hook_name
  @lifecycle_hook_name
end

#lifecycle_transitionString (readonly)

The lifecycle transition. For Auto Scaling groups, there are two major lifecycle transitions.

  • To create a lifecycle hook for scale-out events, specify autoscaling:EC2_INSTANCE_LAUNCHING .
  • To create a lifecycle hook for scale-in events, specify autoscaling:EC2_INSTANCE_TERMINATING .


2276
2277
2278
# File 'autoscaling/cfn_auto_scaling_group.rb', line 2276

def lifecycle_transition
  @lifecycle_transition
end

#notification_metadataString? (readonly)

Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target.



2297
2298
2299
# File 'autoscaling/cfn_auto_scaling_group.rb', line 2297

def 
  @notification_metadata
end

#notification_target_arnString? (readonly)

The Amazon Resource Name (ARN) of the notification target that Amazon EC2 Auto Scaling sends notifications to when an instance is in a wait state for the lifecycle hook.

You can specify an Amazon SNS topic or an Amazon SQS queue.



2304
2305
2306
# File 'autoscaling/cfn_auto_scaling_group.rb', line 2304

def notification_target_arn
  @notification_target_arn
end

#role_arnString? (readonly)

The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.

For information about creating this role, see Prepare to add a lifecycle hook to your Auto Scaling group in the Amazon EC2 Auto Scaling User Guide .

Valid only if the notification target is an Amazon SNS topic or an Amazon SQS queue.



2313
2314
2315
# File 'autoscaling/cfn_auto_scaling_group.rb', line 2313

def role_arn
  @role_arn
end

Class Method Details

.jsii_propertiesObject



2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
# File 'autoscaling/cfn_auto_scaling_group.rb', line 2315

def self.jsii_properties
  {
    :lifecycle_hook_name => "lifecycleHookName",
    :lifecycle_transition => "lifecycleTransition",
    :default_result => "defaultResult",
    :heartbeat_timeout => "heartbeatTimeout",
    :notification_metadata => "notificationMetadata",
    :notification_target_arn => "notificationTargetArn",
    :role_arn => "roleArn",
  }
end

Instance Method Details

#to_jsiiObject



2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
# File 'autoscaling/cfn_auto_scaling_group.rb', line 2327

def to_jsii
  result = {}
  result.merge!({
    "lifecycleHookName" => @lifecycle_hook_name,
    "lifecycleTransition" => @lifecycle_transition,
    "defaultResult" => @default_result,
    "heartbeatTimeout" => @heartbeat_timeout,
    "notificationMetadata" => @notification_metadata,
    "notificationTargetArn" => @notification_target_arn,
    "roleArn" => @role_arn,
  })
  result.compact
end