EventSubscription
Provides a DB event subscription resource.
Attributes
The following additional atttributes are provided:
id- The name of the RDS event notification subscriptionarn- The Amazon Resource Name of the RDS event notification subscriptioncustomer_aws_id- The AWS customer account associated with the RDS event notification subscription
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var defaultInstance = new Aws.Rds.Instance("defaultInstance", new Aws.Rds.InstanceArgs
{
AllocatedStorage = 10,
DbSubnetGroupName = "my_database_subnet_group",
Engine = "mysql",
EngineVersion = "5.6.17",
InstanceClass = "db.t2.micro",
Name = "mydb",
ParameterGroupName = "default.mysql5.6",
Password = "bar",
Username = "foo",
});
var defaultTopic = new Aws.Sns.Topic("defaultTopic", new Aws.Sns.TopicArgs
{
});
var defaultEventSubscription = new Aws.Rds.EventSubscription("defaultEventSubscription", new Aws.Rds.EventSubscriptionArgs
{
EventCategories =
{
"availability",
"deletion",
"failover",
"failure",
"low storage",
"maintenance",
"notification",
"read replica",
"recovery",
"restoration",
},
SnsTopic = defaultTopic.Arn,
SourceIds =
{
defaultInstance.Id,
},
SourceType = "db-instance",
});
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/rds"
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/sns"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
defaultInstance, err := rds.NewInstance(ctx, "defaultInstance", &rds.InstanceArgs{
AllocatedStorage: pulumi.Int(10),
DbSubnetGroupName: pulumi.String("my_database_subnet_group"),
Engine: pulumi.String("mysql"),
EngineVersion: pulumi.String("5.6.17"),
InstanceClass: pulumi.String("db.t2.micro"),
Name: pulumi.String("mydb"),
ParameterGroupName: pulumi.String("default.mysql5.6"),
Password: pulumi.String("bar"),
Username: pulumi.String("foo"),
})
if err != nil {
return err
}
defaultTopic, err := sns.NewTopic(ctx, "defaultTopic", nil)
if err != nil {
return err
}
_, err = rds.NewEventSubscription(ctx, "defaultEventSubscription", &rds.EventSubscriptionArgs{
EventCategories: pulumi.StringArray{
pulumi.String("availability"),
pulumi.String("deletion"),
pulumi.String("failover"),
pulumi.String("failure"),
pulumi.String("low storage"),
pulumi.String("maintenance"),
pulumi.String("notification"),
pulumi.String("read replica"),
pulumi.String("recovery"),
pulumi.String("restoration"),
},
SnsTopic: defaultTopic.Arn,
SourceIds: pulumi.StringArray{
defaultInstance.ID(),
},
SourceType: pulumi.String("db-instance"),
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
default_instance = aws.rds.Instance("defaultInstance",
allocated_storage=10,
db_subnet_group_name="my_database_subnet_group",
engine="mysql",
engine_version="5.6.17",
instance_class="db.t2.micro",
name="mydb",
parameter_group_name="default.mysql5.6",
password="bar",
username="foo")
default_topic = aws.sns.Topic("defaultTopic")
default_event_subscription = aws.rds.EventSubscription("defaultEventSubscription",
event_categories=[
"availability",
"deletion",
"failover",
"failure",
"low storage",
"maintenance",
"notification",
"read replica",
"recovery",
"restoration",
],
sns_topic=default_topic.arn,
source_ids=[default_instance.id],
source_type="db-instance")import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const defaultInstance = new aws.rds.Instance("default", {
allocatedStorage: 10,
dbSubnetGroupName: "my_database_subnet_group",
engine: "mysql",
engineVersion: "5.6.17",
instanceClass: "db.t2.micro",
name: "mydb",
parameterGroupName: "default.mysql5.6",
password: "bar",
username: "foo",
});
const defaultTopic = new aws.sns.Topic("default", {});
const defaultEventSubscription = new aws.rds.EventSubscription("default", {
eventCategories: [
"availability",
"deletion",
"failover",
"failure",
"low storage",
"maintenance",
"notification",
"read replica",
"recovery",
"restoration",
],
snsTopic: defaultTopic.arn,
sourceIds: [defaultInstance.id],
sourceType: "db-instance",
});Create a EventSubscription Resource
new EventSubscription(name: string, args: EventSubscriptionArgs, opts?: CustomResourceOptions);def EventSubscription(resource_name, opts=None, enabled=None, event_categories=None, name=None, name_prefix=None, sns_topic=None, source_ids=None, source_type=None, tags=None, __props__=None);func NewEventSubscription(ctx *Context, name string, args EventSubscriptionArgs, opts ...ResourceOption) (*EventSubscription, error)public EventSubscription(string name, EventSubscriptionArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args EventSubscriptionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args EventSubscriptionArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args EventSubscriptionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
EventSubscription Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The EventSubscription resource accepts the following input properties:
- Sns
Topic string The SNS topic to send events to.
- Enabled bool
A boolean flag to enable/disable the subscription. Defaults to true.
- Event
Categories List<string> A list of event categories for a SourceType that you want to subscribe to. See http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Events.html or run
aws rds describe-event-categories.- Name string
The name of the DB event subscription. By default generated by this provider.
- Name
Prefix string The name of the DB event subscription. Conflicts with
name.- Source
Ids List<string> A list of identifiers of the event sources for which events will be returned. If not specified, then all sources are included in the response. If specified, a source_type must also be specified.
- Source
Type string The type of source that will be generating the events. Valid options are
db-instance,db-security-group,db-parameter-group,db-snapshot,db-clusterordb-cluster-snapshot. If not set, all sources will be subscribed to.- Dictionary<string, string>
A map of tags to assign to the resource.
- Sns
Topic string The SNS topic to send events to.
- Enabled bool
A boolean flag to enable/disable the subscription. Defaults to true.
- Event
Categories []string A list of event categories for a SourceType that you want to subscribe to. See http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Events.html or run
aws rds describe-event-categories.- Name string
The name of the DB event subscription. By default generated by this provider.
- Name
Prefix string The name of the DB event subscription. Conflicts with
name.- Source
Ids []string A list of identifiers of the event sources for which events will be returned. If not specified, then all sources are included in the response. If specified, a source_type must also be specified.
- Source
Type string The type of source that will be generating the events. Valid options are
db-instance,db-security-group,db-parameter-group,db-snapshot,db-clusterordb-cluster-snapshot. If not set, all sources will be subscribed to.- map[string]string
A map of tags to assign to the resource.
- sns
Topic string The SNS topic to send events to.
- enabled boolean
A boolean flag to enable/disable the subscription. Defaults to true.
- event
Categories string[] A list of event categories for a SourceType that you want to subscribe to. See http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Events.html or run
aws rds describe-event-categories.- name string
The name of the DB event subscription. By default generated by this provider.
- name
Prefix string The name of the DB event subscription. Conflicts with
name.- source
Ids string[] A list of identifiers of the event sources for which events will be returned. If not specified, then all sources are included in the response. If specified, a source_type must also be specified.
- source
Type string The type of source that will be generating the events. Valid options are
db-instance,db-security-group,db-parameter-group,db-snapshot,db-clusterordb-cluster-snapshot. If not set, all sources will be subscribed to.- {[key: string]: string}
A map of tags to assign to the resource.
- sns_
topic str The SNS topic to send events to.
- enabled bool
A boolean flag to enable/disable the subscription. Defaults to true.
- event_
categories List[str] A list of event categories for a SourceType that you want to subscribe to. See http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Events.html or run
aws rds describe-event-categories.- name str
The name of the DB event subscription. By default generated by this provider.
- name_
prefix str The name of the DB event subscription. Conflicts with
name.- source_
ids List[str] A list of identifiers of the event sources for which events will be returned. If not specified, then all sources are included in the response. If specified, a source_type must also be specified.
- source_
type str The type of source that will be generating the events. Valid options are
db-instance,db-security-group,db-parameter-group,db-snapshot,db-clusterordb-cluster-snapshot. If not set, all sources will be subscribed to.- Dict[str, str]
A map of tags to assign to the resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the EventSubscription resource produces the following output properties:
Look up an Existing EventSubscription Resource
Get an existing EventSubscription 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?: EventSubscriptionState, opts?: CustomResourceOptions): EventSubscriptionstatic get(resource_name, id, opts=None, arn=None, customer_aws_id=None, enabled=None, event_categories=None, name=None, name_prefix=None, sns_topic=None, source_ids=None, source_type=None, tags=None, __props__=None);func GetEventSubscription(ctx *Context, name string, id IDInput, state *EventSubscriptionState, opts ...ResourceOption) (*EventSubscription, error)public static EventSubscription Get(string name, Input<string> id, EventSubscriptionState? state, CustomResourceOptions? opts = null)- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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:
- Arn string
- Customer
Aws stringId - Enabled bool
A boolean flag to enable/disable the subscription. Defaults to true.
- Event
Categories List<string> A list of event categories for a SourceType that you want to subscribe to. See http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Events.html or run
aws rds describe-event-categories.- Name string
The name of the DB event subscription. By default generated by this provider.
- Name
Prefix string The name of the DB event subscription. Conflicts with
name.- Sns
Topic string The SNS topic to send events to.
- Source
Ids List<string> A list of identifiers of the event sources for which events will be returned. If not specified, then all sources are included in the response. If specified, a source_type must also be specified.
- Source
Type string The type of source that will be generating the events. Valid options are
db-instance,db-security-group,db-parameter-group,db-snapshot,db-clusterordb-cluster-snapshot. If not set, all sources will be subscribed to.- Dictionary<string, string>
A map of tags to assign to the resource.
- Arn string
- Customer
Aws stringId - Enabled bool
A boolean flag to enable/disable the subscription. Defaults to true.
- Event
Categories []string A list of event categories for a SourceType that you want to subscribe to. See http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Events.html or run
aws rds describe-event-categories.- Name string
The name of the DB event subscription. By default generated by this provider.
- Name
Prefix string The name of the DB event subscription. Conflicts with
name.- Sns
Topic string The SNS topic to send events to.
- Source
Ids []string A list of identifiers of the event sources for which events will be returned. If not specified, then all sources are included in the response. If specified, a source_type must also be specified.
- Source
Type string The type of source that will be generating the events. Valid options are
db-instance,db-security-group,db-parameter-group,db-snapshot,db-clusterordb-cluster-snapshot. If not set, all sources will be subscribed to.- map[string]string
A map of tags to assign to the resource.
- arn string
- customer
Aws stringId - enabled boolean
A boolean flag to enable/disable the subscription. Defaults to true.
- event
Categories string[] A list of event categories for a SourceType that you want to subscribe to. See http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Events.html or run
aws rds describe-event-categories.- name string
The name of the DB event subscription. By default generated by this provider.
- name
Prefix string The name of the DB event subscription. Conflicts with
name.- sns
Topic string The SNS topic to send events to.
- source
Ids string[] A list of identifiers of the event sources for which events will be returned. If not specified, then all sources are included in the response. If specified, a source_type must also be specified.
- source
Type string The type of source that will be generating the events. Valid options are
db-instance,db-security-group,db-parameter-group,db-snapshot,db-clusterordb-cluster-snapshot. If not set, all sources will be subscribed to.- {[key: string]: string}
A map of tags to assign to the resource.
- arn str
- customer_
aws_ strid - enabled bool
A boolean flag to enable/disable the subscription. Defaults to true.
- event_
categories List[str] A list of event categories for a SourceType that you want to subscribe to. See http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Events.html or run
aws rds describe-event-categories.- name str
The name of the DB event subscription. By default generated by this provider.
- name_
prefix str The name of the DB event subscription. Conflicts with
name.- sns_
topic str The SNS topic to send events to.
- source_
ids List[str] A list of identifiers of the event sources for which events will be returned. If not specified, then all sources are included in the response. If specified, a source_type must also be specified.
- source_
type str The type of source that will be generating the events. Valid options are
db-instance,db-security-group,db-parameter-group,db-snapshot,db-clusterordb-cluster-snapshot. If not set, all sources will be subscribed to.- Dict[str, str]
A map of tags to assign to the resource.
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.