1. Packages
  2. AWS
  3. API Docs
  4. autoscaling
  5. Notification
AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi

aws.autoscaling.Notification

Explore with Pulumi AI

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:

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.sns.Topic("example", {name: "example-topic"});
const bar = new aws.autoscaling.Group("bar", {name: "foobar1-test"});
const foo = new aws.autoscaling.Group("foo", {name: "barfoo-test"});
const exampleNotifications = new aws.autoscaling.Notification("example_notifications", {
    groupNames: [
        bar.name,
        foo.name,
    ],
    notifications: [
        "autoscaling:EC2_INSTANCE_LAUNCH",
        "autoscaling:EC2_INSTANCE_TERMINATE",
        "autoscaling:EC2_INSTANCE_LAUNCH_ERROR",
        "autoscaling:EC2_INSTANCE_TERMINATE_ERROR",
    ],
    topicArn: example.arn,
});
Copy
import pulumi
import pulumi_aws as aws

example = aws.sns.Topic("example", name="example-topic")
bar = aws.autoscaling.Group("bar", name="foobar1-test")
foo = aws.autoscaling.Group("foo", name="barfoo-test")
example_notifications = aws.autoscaling.Notification("example_notifications",
    group_names=[
        bar.name,
        foo.name,
    ],
    notifications=[
        "autoscaling:EC2_INSTANCE_LAUNCH",
        "autoscaling:EC2_INSTANCE_TERMINATE",
        "autoscaling:EC2_INSTANCE_LAUNCH_ERROR",
        "autoscaling:EC2_INSTANCE_TERMINATE_ERROR",
    ],
    topic_arn=example.arn)
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/autoscaling"
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sns"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := sns.NewTopic(ctx, "example", &sns.TopicArgs{
			Name: pulumi.String("example-topic"),
		})
		if err != nil {
			return err
		}
		bar, err := autoscaling.NewGroup(ctx, "bar", &autoscaling.GroupArgs{
			Name: pulumi.String("foobar1-test"),
		})
		if err != nil {
			return err
		}
		foo, err := autoscaling.NewGroup(ctx, "foo", &autoscaling.GroupArgs{
			Name: pulumi.String("barfoo-test"),
		})
		if err != nil {
			return err
		}
		_, err = autoscaling.NewNotification(ctx, "example_notifications", &autoscaling.NotificationArgs{
			GroupNames: pulumi.StringArray{
				bar.Name,
				foo.Name,
			},
			Notifications: pulumi.StringArray{
				pulumi.String("autoscaling:EC2_INSTANCE_LAUNCH"),
				pulumi.String("autoscaling:EC2_INSTANCE_TERMINATE"),
				pulumi.String("autoscaling:EC2_INSTANCE_LAUNCH_ERROR"),
				pulumi.String("autoscaling:EC2_INSTANCE_TERMINATE_ERROR"),
			},
			TopicArn: example.Arn,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = new Aws.Sns.Topic("example", new()
    {
        Name = "example-topic",
    });

    var bar = new Aws.AutoScaling.Group("bar", new()
    {
        Name = "foobar1-test",
    });

    var foo = new Aws.AutoScaling.Group("foo", new()
    {
        Name = "barfoo-test",
    });

    var exampleNotifications = new Aws.AutoScaling.Notification("example_notifications", new()
    {
        GroupNames = new[]
        {
            bar.Name,
            foo.Name,
        },
        Notifications = new[]
        {
            "autoscaling:EC2_INSTANCE_LAUNCH",
            "autoscaling:EC2_INSTANCE_TERMINATE",
            "autoscaling:EC2_INSTANCE_LAUNCH_ERROR",
            "autoscaling:EC2_INSTANCE_TERMINATE_ERROR",
        },
        TopicArn = example.Arn,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.sns.Topic;
import com.pulumi.aws.sns.TopicArgs;
import com.pulumi.aws.autoscaling.Group;
import com.pulumi.aws.autoscaling.GroupArgs;
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) {
        var example = new Topic("example", TopicArgs.builder()
            .name("example-topic")
            .build());

        var bar = new Group("bar", GroupArgs.builder()
            .name("foobar1-test")
            .build());

        var foo = new Group("foo", GroupArgs.builder()
            .name("barfoo-test")
            .build());

        var exampleNotifications = new Notification("exampleNotifications", NotificationArgs.builder()
            .groupNames(            
                bar.name(),
                foo.name())
            .notifications(            
                "autoscaling:EC2_INSTANCE_LAUNCH",
                "autoscaling:EC2_INSTANCE_TERMINATE",
                "autoscaling:EC2_INSTANCE_LAUNCH_ERROR",
                "autoscaling:EC2_INSTANCE_TERMINATE_ERROR")
            .topicArn(example.arn())
            .build());

    }
}
Copy
resources:
  exampleNotifications:
    type: aws:autoscaling:Notification
    name: example_notifications
    properties:
      groupNames:
        - ${bar.name}
        - ${foo.name}
      notifications:
        - autoscaling:EC2_INSTANCE_LAUNCH
        - autoscaling:EC2_INSTANCE_TERMINATE
        - autoscaling:EC2_INSTANCE_LAUNCH_ERROR
        - autoscaling:EC2_INSTANCE_TERMINATE_ERROR
      topicArn: ${example.arn}
  example:
    type: aws:sns:Topic
    properties:
      name: example-topic
  bar:
    type: aws:autoscaling:Group
    properties:
      name: foobar1-test
  foo:
    type: aws:autoscaling:Group
    properties:
      name: barfoo-test
Copy

Create Notification Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new Notification(name: string, args: NotificationArgs, opts?: CustomResourceOptions);
@overload
def Notification(resource_name: str,
                 args: NotificationArgs,
                 opts: Optional[ResourceOptions] = None)

@overload
def Notification(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 group_names: Optional[Sequence[str]] = None,
                 notifications: Optional[Sequence[str]] = None,
                 topic_arn: Optional[str] = None)
func NewNotification(ctx *Context, name string, args NotificationArgs, opts ...ResourceOption) (*Notification, error)
public Notification(string name, NotificationArgs args, CustomResourceOptions? opts = null)
public Notification(String name, NotificationArgs args)
public Notification(String name, NotificationArgs args, CustomResourceOptions options)
type: aws:autoscaling:Notification
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. NotificationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. NotificationArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. NotificationArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. NotificationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. NotificationArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var notificationResource = new Aws.AutoScaling.Notification("notificationResource", new()
{
    GroupNames = new[]
    {
        "string",
    },
    Notifications = new[]
    {
        "string",
    },
    TopicArn = "string",
});
Copy
example, err := autoscaling.NewNotification(ctx, "notificationResource", &autoscaling.NotificationArgs{
	GroupNames: pulumi.StringArray{
		pulumi.String("string"),
	},
	Notifications: pulumi.StringArray{
		pulumi.String("string"),
	},
	TopicArn: pulumi.String("string"),
})
Copy
var notificationResource = new Notification("notificationResource", NotificationArgs.builder()
    .groupNames("string")
    .notifications("string")
    .topicArn("string")
    .build());
Copy
notification_resource = aws.autoscaling.Notification("notificationResource",
    group_names=["string"],
    notifications=["string"],
    topic_arn="string")
Copy
const notificationResource = new aws.autoscaling.Notification("notificationResource", {
    groupNames: ["string"],
    notifications: ["string"],
    topicArn: "string",
});
Copy
type: aws:autoscaling:Notification
properties:
    groupNames:
        - string
    notifications:
        - string
    topicArn: string
Copy

Notification Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Notification resource accepts the following input properties:

GroupNames This property is required. List<string>
List of AutoScaling Group Names
Notifications This property is required. List<string>
List of Notification Types that trigger notifications. Acceptable values are documented in the AWS documentation here
TopicArn
This property is required.
Changes to this property will trigger replacement.
string
Topic ARN for notifications to be sent through
GroupNames This property is required. []string
List of AutoScaling Group Names
Notifications This property is required. []string
List of Notification Types that trigger notifications. Acceptable values are documented in the AWS documentation here
TopicArn
This property is required.
Changes to this property will trigger replacement.
string
Topic ARN for notifications to be sent through
groupNames This property is required. List<String>
List of AutoScaling Group Names
notifications This property is required. List<String>
List of Notification Types that trigger notifications. Acceptable values are documented in the AWS documentation here
topicArn
This property is required.
Changes to this property will trigger replacement.
String
Topic ARN for notifications to be sent through
groupNames This property is required. string[]
List of AutoScaling Group Names
notifications This property is required. NotificationType[]
List of Notification Types that trigger notifications. Acceptable values are documented in the AWS documentation here
topicArn
This property is required.
Changes to this property will trigger replacement.
string
Topic ARN for notifications to be sent through
group_names This property is required. Sequence[str]
List of AutoScaling Group Names
notifications This property is required. Sequence[str]
List of Notification Types that trigger notifications. Acceptable values are documented in the AWS documentation here
topic_arn
This property is required.
Changes to this property will trigger replacement.
str
Topic ARN for notifications to be sent through
groupNames This property is required. List<String>
List of AutoScaling Group Names
notifications This property is required. List<>
List of Notification Types that trigger notifications. Acceptable values are documented in the AWS documentation here
topicArn
This property is required.
Changes to this property will trigger replacement.
String
Topic ARN for notifications to be sent through

Outputs

All input properties are implicitly available as output properties. Additionally, the Notification resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing Notification Resource

Get an existing Notification resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: NotificationState, opts?: CustomResourceOptions): Notification
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        group_names: Optional[Sequence[str]] = None,
        notifications: Optional[Sequence[str]] = None,
        topic_arn: Optional[str] = None) -> Notification
func GetNotification(ctx *Context, name string, id IDInput, state *NotificationState, opts ...ResourceOption) (*Notification, error)
public static Notification Get(string name, Input<string> id, NotificationState? state, CustomResourceOptions? opts = null)
public static Notification get(String name, Output<String> id, NotificationState state, CustomResourceOptions options)
resources:  _:    type: aws:autoscaling:Notification    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
GroupNames List<string>
List of AutoScaling Group Names
Notifications List<string>
List of Notification Types that trigger notifications. Acceptable values are documented in the AWS documentation here
TopicArn Changes to this property will trigger replacement. string
Topic ARN for notifications to be sent through
GroupNames []string
List of AutoScaling Group Names
Notifications []string
List of Notification Types that trigger notifications. Acceptable values are documented in the AWS documentation here
TopicArn Changes to this property will trigger replacement. string
Topic ARN for notifications to be sent through
groupNames List<String>
List of AutoScaling Group Names
notifications List<String>
List of Notification Types that trigger notifications. Acceptable values are documented in the AWS documentation here
topicArn Changes to this property will trigger replacement. String
Topic ARN for notifications to be sent through
groupNames string[]
List of AutoScaling Group Names
notifications NotificationType[]
List of Notification Types that trigger notifications. Acceptable values are documented in the AWS documentation here
topicArn Changes to this property will trigger replacement. string
Topic ARN for notifications to be sent through
group_names Sequence[str]
List of AutoScaling Group Names
notifications Sequence[str]
List of Notification Types that trigger notifications. Acceptable values are documented in the AWS documentation here
topic_arn Changes to this property will trigger replacement. str
Topic ARN for notifications to be sent through
groupNames List<String>
List of AutoScaling Group Names
notifications List<>
List of Notification Types that trigger notifications. Acceptable values are documented in the AWS documentation here
topicArn Changes to this property will trigger replacement. String
Topic ARN for notifications to be sent through

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.