--- layout: "aws" page_title: "AWS: aws_autoscaling_lifecycle_hook" sidebar_current: "docs-aws-resource-autoscaling-lifecycle-hook" description: |- Provides an AutoScaling Lifecycle Hooks resource. --- # aws\_autoscaling\_lifecycle\_hook Provides an AutoScaling Lifecycle Hook resource. ~> **NOTE:** Terraform has two types of ways you can add lifecycle hooks - via the `initial_lifecycle_hook` attribute from the [`aws_autoscaling_group`](/docs/providers/aws/r/autoscaling_group.html) resource, 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](/docs/providers/aws/r/autoscaling_group.html#waiting-for-capacity) settings, after the initial instances have been launched, creating unintended behavior. If you need hooks to run on all instances, add them with `initial_lifecycle_hook` in [`aws_autoscaling_group`](/docs/providers/aws/r/autoscaling_group.html), but take care to not duplicate those hooks with this resource. ## Example Usage ```hcl resource "aws_autoscaling_group" "foobar" { availability_zones = ["us-west-2a"] name = "terraform-test-foobar5" health_check_type = "EC2" termination_policies = ["OldestInstance"] tag { key = "Foo" value = "foo-bar" propagate_at_launch = true } } resource "aws_autoscaling_lifecycle_hook" "foobar" { name = "foobar" autoscaling_group_name = "${aws_autoscaling_group.foobar.name}" default_result = "CONTINUE" heartbeat_timeout = 2000 lifecycle_transition = "autoscaling:EC2_INSTANCE_LAUNCHING" notification_metadata = <