Skip to content

Resource: awsAutoscalingNotification

Provides an AutoScaling Group with Notification support, via SNS Topics. Each of the notifications map to a Notification Configuration inside Amazon Web Services, and are applied to each AutoScaling Group you supply.

Example Usage

Basic usage:

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsAutoscalingGroupBar = new aws.autoscalingGroup.AutoscalingGroup(
  this,
  "bar",
  {
    name: "foobar1-terraform-test",
  }
);
const awsAutoscalingGroupFoo = new aws.autoscalingGroup.AutoscalingGroup(
  this,
  "foo",
  {
    name: "barfoo-terraform-test",
  }
);
const awsSnsTopicExample = new aws.snsTopic.SnsTopic(this, "example", {
  name: "example-topic",
});
new aws.autoscalingNotification.AutoscalingNotification(
  this,
  "example_notifications",
  {
    groupNames: [awsAutoscalingGroupBar.name, awsAutoscalingGroupFoo.name],
    notifications: [
      "autoscaling:EC2_INSTANCE_LAUNCH",
      "autoscaling:EC2_INSTANCE_TERMINATE",
      "autoscaling:EC2_INSTANCE_LAUNCH_ERROR",
      "autoscaling:EC2_INSTANCE_TERMINATE_ERROR",
    ],
    topicArn: awsSnsTopicExample.arn,
  }
);

Argument Reference

The following arguments are supported:

  • groupNames - (Required) List of AutoScaling Group Names
  • notifications - (Required) List of Notification Types that trigger notifications. Acceptable values are documented in the AWS documentation here
  • topicArn - (Required) Topic ARN for notifications to be sent through

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • groupNames
  • notifications
  • topicArn