Skip to content

Data Source: awsAutoscalingGroups

The Autoscaling Groups data source allows access to the list of AWS ASGs within a specific region. This will allow you to pass a list of AutoScaling Groups to other resources.

Example 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 dataAwsAutoscalingGroupsGroups =
  new aws.dataAwsAutoscalingGroups.DataAwsAutoscalingGroups(this, "groups", {
    filter: [
      {
        name: "tag:Team",
        values: ["Pets"],
      },
      {
        name: "tag-key",
        values: ["Environment"],
      },
    ],
  });
new aws.autoscalingNotification.AutoscalingNotification(
  this,
  "slack_notifications",
  {
    groupNames: dataAwsAutoscalingGroupsGroups.names,
    notifications: [
      "autoscaling:EC2_INSTANCE_LAUNCH",
      "autoscaling:EC2_INSTANCE_TERMINATE",
      "autoscaling:EC2_INSTANCE_LAUNCH_ERROR",
      "autoscaling:EC2_INSTANCE_TERMINATE_ERROR",
    ],
    topicArn: "TOPIC ARN",
  }
);

Argument Reference

  • names - (Optional) List of autoscaling group names
  • filter - (Optional) Filter used to scope the list e.g., by tags. See related docs.
  • name - (Required) Name of the DescribeAutoScalingGroup filter. The recommended values are: tagKey, tagValue, and tag:<tagName>
  • values - (Required) Value of the filter.

Attributes Reference

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

  • arns - List of the Autoscaling Groups Arns in the current region.
  • id - AWS Region.
  • names - List of the Autoscaling Groups in the current region.