Class LifecycleHook
Provides an AutoScaling Lifecycle Hook resource.
NOTE: This provider has two types of ways you can add lifecycle hooks - via the
initial_lifecycle_hookattribute from theaws.autoscaling.Groupresource, or via this one. Hooks added via this resource will not be added until the autoscaling group has been created, and depending on your capacity settings, after the initial instances have been launched, creating unintended behavior. If you need hooks to run on all instances, add them withinitial_lifecycle_hookinaws.autoscaling.Group, but take care to not duplicate those hooks with this resource.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var foobarGroup = new Aws.AutoScaling.Group("foobarGroup", new Aws.AutoScaling.GroupArgs
{
AvailabilityZones =
{
"us-west-2a",
},
HealthCheckType = "EC2",
Tags =
{
new Aws.AutoScaling.Inputs.GroupTagArgs
{
Key = "Foo",
PropagateAtLaunch = true,
Value = "foo-bar",
},
},
TerminationPolicies =
{
"OldestInstance",
},
});
var foobarLifecycleHook = new Aws.AutoScaling.LifecycleHook("foobarLifecycleHook", new Aws.AutoScaling.LifecycleHookArgs
{
AutoscalingGroupName = foobarGroup.Name,
DefaultResult = "CONTINUE",
HeartbeatTimeout = 2000,
LifecycleTransition = "autoscaling:EC2_INSTANCE_LAUNCHING",
NotificationMetadata = @"{
""foo"": ""bar""
}
",
NotificationTargetArn = "arn:aws:sqs:us-east-1:444455556666:queue1*",
RoleArn = "arn:aws:iam::123456789012:role/S3Access",
});
}
}
Inherited Members
Namespace: Pulumi.Aws.AutoScaling
Assembly: Pulumi.Aws.dll
Syntax
public class LifecycleHook : CustomResource
Constructors
View SourceLifecycleHook(String, LifecycleHookArgs, CustomResourceOptions)
Create a LifecycleHook resource with the given unique name, arguments, and options.
Declaration
public LifecycleHook(string name, LifecycleHookArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| LifecycleHookArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceAutoscalingGroupName
The name of the Auto Scaling group to which you want to assign the lifecycle hook
Declaration
public Output<string> AutoscalingGroupName { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
DefaultResult
Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. The value for this parameter can be either CONTINUE or ABANDON. The default value for this parameter is ABANDON.
Declaration
public Output<string> DefaultResult { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
HeartbeatTimeout
Defines the amount of time, in seconds, that can elapse before the lifecycle hook times out. When the lifecycle hook times out, Auto Scaling performs the action defined in the DefaultResult parameter
Declaration
public Output<int?> HeartbeatTimeout { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Int32>> |
LifecycleTransition
The instance state to which you want to attach the lifecycle hook. For a list of lifecycle hook types, see describe-lifecycle-hook-types
Declaration
public Output<string> LifecycleTransition { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Name
The name of the lifecycle hook.
Declaration
public Output<string> Name { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
NotificationMetadata
Contains additional information that you want to include any time Auto Scaling sends a message to the notification target.
Declaration
public Output<string> NotificationMetadata { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
NotificationTargetArn
The ARN of the notification target that Auto Scaling will use to notify you when an instance is in the transition state for the lifecycle hook. This ARN target can be either an SQS queue or an SNS topic.
Declaration
public Output<string> NotificationTargetArn { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
RoleArn
The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.
Declaration
public Output<string> RoleArn { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, LifecycleHookState, CustomResourceOptions)
Get an existing LifecycleHook resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static LifecycleHook Get(string name, Input<string> id, LifecycleHookState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| LifecycleHookState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| LifecycleHook |