Viewing docs for AWS v7.24.0
published on Tuesday, Mar 31, 2026 by Pulumi
published on Tuesday, Mar 31, 2026 by Pulumi
Viewing docs for AWS v7.24.0
published on Tuesday, Mar 31, 2026 by Pulumi
published on Tuesday, Mar 31, 2026 by Pulumi
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
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const groups = aws.autoscaling.getAmiIds({
filters: [
{
name: "tag:Team",
values: ["Pets"],
},
{
name: "tag-key",
values: ["Environment"],
},
],
});
const slackNotifications = new aws.autoscaling.Notification("slack_notifications", {
groupNames: groups.then(groups => groups.names),
notifications: [
aws.autoscaling.NotificationType.InstanceLaunch,
aws.autoscaling.NotificationType.InstanceTerminate,
aws.autoscaling.NotificationType.InstanceLaunchError,
aws.autoscaling.NotificationType.InstanceTerminateError,
],
topicArn: "TOPIC ARN",
});
import pulumi
import pulumi_aws as aws
groups = aws.autoscaling.get_ami_ids(filters=[
{
"name": "tag:Team",
"values": ["Pets"],
},
{
"name": "tag-key",
"values": ["Environment"],
},
])
slack_notifications = aws.autoscaling.Notification("slack_notifications",
group_names=groups.names,
notifications=[
aws.autoscaling.NotificationType.INSTANCE_LAUNCH,
aws.autoscaling.NotificationType.INSTANCE_TERMINATE,
aws.autoscaling.NotificationType.INSTANCE_LAUNCH_ERROR,
aws.autoscaling.NotificationType.INSTANCE_TERMINATE_ERROR,
],
topic_arn="TOPIC ARN")
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/autoscaling"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
groups, err := autoscaling.GetAmiIds(ctx, &autoscaling.GetAmiIdsArgs{
Filters: []autoscaling.GetAmiIdsFilter{
{
Name: "tag:Team",
Values: []string{
"Pets",
},
},
{
Name: "tag-key",
Values: []string{
"Environment",
},
},
},
}, nil)
if err != nil {
return err
}
_, err = autoscaling.NewNotification(ctx, "slack_notifications", &autoscaling.NotificationArgs{
GroupNames: interface{}(groups.Names),
Notifications: autoscaling.NotificationTypeArray{
autoscaling.NotificationTypeInstanceLaunch,
autoscaling.NotificationTypeInstanceTerminate,
autoscaling.NotificationTypeInstanceLaunchError,
autoscaling.NotificationTypeInstanceTerminateError,
},
TopicArn: pulumi.String("TOPIC ARN"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var groups = Aws.AutoScaling.GetAmiIds.Invoke(new()
{
Filters = new[]
{
new Aws.AutoScaling.Inputs.GetAmiIdsFilterInputArgs
{
Name = "tag:Team",
Values = new[]
{
"Pets",
},
},
new Aws.AutoScaling.Inputs.GetAmiIdsFilterInputArgs
{
Name = "tag-key",
Values = new[]
{
"Environment",
},
},
},
});
var slackNotifications = new Aws.AutoScaling.Notification("slack_notifications", new()
{
GroupNames = groups.Apply(getAmiIdsResult => getAmiIdsResult.Names),
Notifications = new[]
{
Aws.AutoScaling.NotificationType.InstanceLaunch,
Aws.AutoScaling.NotificationType.InstanceTerminate,
Aws.AutoScaling.NotificationType.InstanceLaunchError,
Aws.AutoScaling.NotificationType.InstanceTerminateError,
},
TopicArn = "TOPIC ARN",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.autoscaling.AutoscalingFunctions;
import com.pulumi.aws.autoscaling.inputs.GetAmiIdsArgs;
import com.pulumi.aws.autoscaling.Notification;
import com.pulumi.aws.autoscaling.NotificationArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var groups = AutoscalingFunctions.getAmiIds(GetAmiIdsArgs.builder()
.filters(
GetAmiIdsFilterArgs.builder()
.name("tag:Team")
.values("Pets")
.build(),
GetAmiIdsFilterArgs.builder()
.name("tag-key")
.values("Environment")
.build())
.build());
var slackNotifications = new Notification("slackNotifications", NotificationArgs.builder()
.groupNames(groups.names())
.notifications(
"autoscaling:EC2_INSTANCE_LAUNCH",
"autoscaling:EC2_INSTANCE_TERMINATE",
"autoscaling:EC2_INSTANCE_LAUNCH_ERROR",
"autoscaling:EC2_INSTANCE_TERMINATE_ERROR")
.topicArn("TOPIC ARN")
.build());
}
}
resources:
slackNotifications:
type: aws:autoscaling:Notification
name: slack_notifications
properties:
groupNames: ${groups.names}
notifications:
- autoscaling:EC2_INSTANCE_LAUNCH
- autoscaling:EC2_INSTANCE_TERMINATE
- autoscaling:EC2_INSTANCE_LAUNCH_ERROR
- autoscaling:EC2_INSTANCE_TERMINATE_ERROR
topicArn: TOPIC ARN
variables:
groups:
fn::invoke:
function: aws:autoscaling:getAmiIds
arguments:
filters:
- name: tag:Team
values:
- Pets
- name: tag-key
values:
- Environment
Using getAmiIds
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getAmiIds(args: GetAmiIdsArgs, opts?: InvokeOptions): Promise<GetAmiIdsResult>
function getAmiIdsOutput(args: GetAmiIdsOutputArgs, opts?: InvokeOptions): Output<GetAmiIdsResult>def get_ami_ids(filters: Optional[Sequence[GetAmiIdsFilter]] = None,
names: Optional[Sequence[str]] = None,
region: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetAmiIdsResult
def get_ami_ids_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetAmiIdsFilterArgs]]]] = None,
names: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
region: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetAmiIdsResult]func GetAmiIds(ctx *Context, args *GetAmiIdsArgs, opts ...InvokeOption) (*GetAmiIdsResult, error)
func GetAmiIdsOutput(ctx *Context, args *GetAmiIdsOutputArgs, opts ...InvokeOption) GetAmiIdsResultOutput> Note: This function is named GetAmiIds in the Go SDK.
public static class GetAmiIds
{
public static Task<GetAmiIdsResult> InvokeAsync(GetAmiIdsArgs args, InvokeOptions? opts = null)
public static Output<GetAmiIdsResult> Invoke(GetAmiIdsInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetAmiIdsResult> getAmiIds(GetAmiIdsArgs args, InvokeOptions options)
public static Output<GetAmiIdsResult> getAmiIds(GetAmiIdsArgs args, InvokeOptions options)
fn::invoke:
function: aws:autoscaling/getAmiIds:getAmiIds
arguments:
# arguments dictionaryThe following arguments are supported:
- Filters
List<Get
Ami Ids Filter> - Filter used to scope the list e.g., by tags. See related docs.
- Names List<string>
- List of autoscaling group names
- Region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- Filters
[]Get
Ami Ids Filter - Filter used to scope the list e.g., by tags. See related docs.
- Names []string
- List of autoscaling group names
- Region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- filters
List<Get
Ami Ids Filter> - Filter used to scope the list e.g., by tags. See related docs.
- names List<String>
- List of autoscaling group names
- region String
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- filters
Get
Ami Ids Filter[] - Filter used to scope the list e.g., by tags. See related docs.
- names string[]
- List of autoscaling group names
- region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- filters
Sequence[Get
Ami Ids Filter] - Filter used to scope the list e.g., by tags. See related docs.
- names Sequence[str]
- List of autoscaling group names
- region str
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- filters List<Property Map>
- Filter used to scope the list e.g., by tags. See related docs.
- names List<String>
- List of autoscaling group names
- region String
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
getAmiIds Result
The following output properties are available:
Supporting Types
GetAmiIdsFilter
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.
Viewing docs for AWS v7.24.0
published on Tuesday, Mar 31, 2026 by Pulumi
published on Tuesday, Mar 31, 2026 by Pulumi
