EventSubscription class
Provides a DB event subscription resource.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const _default = new aws.rds.Instance("default", {
allocatedStorage: 10,
engine: "mysql",
engineVersion: "5.6.17",
instanceClass: aws.rds.InstanceType.T2_Micro,
dbName: "mydb",
username: "foo",
password: "bar",
dbSubnetGroupName: "my_database_subnet_group",
parameterGroupName: "default.mysql5.6",
});
const defaultTopic = new aws.sns.Topic("default", {name: "rds-events"});
const defaultEventSubscription = new aws.rds.EventSubscription("default", {
name: "rds-event-sub",
snsTopic: defaultTopic.arn,
sourceType: "db-instance",
sourceIds: [_default.identifier],
eventCategories: [
"availability",
"deletion",
"failover",
"failure",
"low storage",
"maintenance",
"notification",
"read replica",
"recovery",
"restoration",
],
});
import pulumi
import pulumi_aws as aws
default = aws.rds.Instance("default",
allocated_storage=10,
engine="mysql",
engine_version="5.6.17",
instance_class=aws.rds.InstanceType.T2_MICRO,
db_name="mydb",
username="foo",
password="bar",
db_subnet_group_name="my_database_subnet_group",
parameter_group_name="default.mysql5.6")
default_topic = aws.sns.Topic("default", name="rds-events")
default_event_subscription = aws.rds.EventSubscription("default",
name="rds-event-sub",
sns_topic=default_topic.arn,
source_type="db-instance",
source_ids=[default.identifier],
event_categories=[
"availability",
"deletion",
"failover",
"failure",
"low storage",
"maintenance",
"notification",
"read replica",
"recovery",
"restoration",
])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var @default = new Aws.Rds.Instance("default", new()
{
AllocatedStorage = 10,
Engine = "mysql",
EngineVersion = "5.6.17",
InstanceClass = Aws.Rds.InstanceType.T2_Micro,
DbName = "mydb",
Username = "foo",
Password = "bar",
DbSubnetGroupName = "my_database_subnet_group",
ParameterGroupName = "default.mysql5.6",
});
var defaultTopic = new Aws.Sns.Topic("default", new()
{
Name = "rds-events",
});
var defaultEventSubscription = new Aws.Rds.EventSubscription("default", new()
{
Name = "rds-event-sub",
SnsTopic = defaultTopic.Arn,
SourceType = "db-instance",
SourceIds = new[]
{
@default.Identifier,
},
EventCategories = new[]
{
"availability",
"deletion",
"failover",
"failure",
"low storage",
"maintenance",
"notification",
"read replica",
"recovery",
"restoration",
},
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/rds"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/sns"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_default, err := rds.NewInstance(ctx, "default", &rds.InstanceArgs{
AllocatedStorage: pulumi.Int(10),
Engine: pulumi.String("mysql"),
EngineVersion: pulumi.String("5.6.17"),
InstanceClass: pulumi.String(rds.InstanceType_T2_Micro),
DbName: pulumi.String("mydb"),
Username: pulumi.String("foo"),
Password: pulumi.String("bar"),
DbSubnetGroupName: pulumi.String("my_database_subnet_group"),
ParameterGroupName: pulumi.String("default.mysql5.6"),
})
if err != nil {
return err
}
defaultTopic, err := sns.NewTopic(ctx, "default", &sns.TopicArgs{
Name: pulumi.String("rds-events"),
})
if err != nil {
return err
}
_, err = rds.NewEventSubscription(ctx, "default", &rds.EventSubscriptionArgs{
Name: pulumi.String("rds-event-sub"),
SnsTopic: defaultTopic.Arn,
SourceType: pulumi.String("db-instance"),
SourceIds: pulumi.StringArray{
_default.Identifier,
},
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"),
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_rds_instance" "default" {
allocated_storage = 10
engine = "mysql"
engine_version = "5.6.17"
instance_class = "db.t2.micro"
db_name = "mydb"
username = "foo"
password = "bar"
db_subnet_group_name = "my_database_subnet_group"
parameter_group_name = "default.mysql5.6"
}
resource "aws_sns_topic" "default" {
name = "rds-events"
}
resource "aws_rds_eventsubscription" "default" {
name = "rds-event-sub"
sns_topic = aws_sns_topic.default.arn
source_type = "db-instance"
source_ids = [aws_rds_instance.default.identifier]
event_categories = ["availability", "deletion", "failover", "failure", "low storage", "maintenance", "notification", "read replica", "recovery", "restoration"]
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.rds.Instance;
import com.pulumi.aws.rds.InstanceArgs;
import com.pulumi.aws.sns.Topic;
import com.pulumi.aws.sns.TopicArgs;
import com.pulumi.aws.rds.EventSubscription;
import com.pulumi.aws.rds.EventSubscriptionArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 default_ = new Instance("default", InstanceArgs.builder()
.allocatedStorage(10)
.engine("mysql")
.engineVersion("5.6.17")
.instanceClass("db.t2.micro")
.dbName("mydb")
.username("foo")
.password("bar")
.dbSubnetGroupName("my_database_subnet_group")
.parameterGroupName("default.mysql5.6")
.build());
var defaultTopic = new Topic("defaultTopic", TopicArgs.builder()
.name("rds-events")
.build());
var defaultEventSubscription = new EventSubscription("defaultEventSubscription", EventSubscriptionArgs.builder()
.name("rds-event-sub")
.snsTopic(defaultTopic.arn())
.sourceType("db-instance")
.sourceIds(default_.identifier())
.eventCategories(
"availability",
"deletion",
"failover",
"failure",
"low storage",
"maintenance",
"notification",
"read replica",
"recovery",
"restoration")
.build());
}
}
resources:
default:
type: aws:rds:Instance
properties:
allocatedStorage: 10
engine: mysql
engineVersion: 5.6.17
instanceClass: db.t2.micro
dbName: mydb
username: foo
password: bar
dbSubnetGroupName: my_database_subnet_group
parameterGroupName: default.mysql5.6
defaultTopic:
type: aws:sns:Topic
name: default
properties:
name: rds-events
defaultEventSubscription:
type: aws:rds:EventSubscription
name: default
properties:
name: rds-event-sub
snsTopic: ${defaultTopic.arn}
sourceType: db-instance
sourceIds:
- ${default.identifier}
eventCategories:
- availability
- deletion
- failover
- failure
- low storage
- maintenance
- notification
- read replica
- recovery
- restoration
Import
Using pulumi import, import DB Event Subscriptions using the name. For example:
$ pulumi import aws:rds/eventSubscription:EventSubscription default rds-event-sub
Constructors
- EventSubscription(String name, {EventSubscriptionArgs? args, CustomResourceOptions? options})
-
Creates a new EventSubscription.
nameThe Pulumi resource name.argsArguments used to configure this EventSubscription. The set of arguments for EventSubscription.optionsResource options controlling this resource's behavior. - EventSubscription.reference(String urn)
- Creates a typed reference to an existing EventSubscription resource.
Properties
-
arn
↔ Output<
String> -
ARN of the RDS event notification subscription
latefinal
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
customerAwsId
↔ Output<
String> -
The AWS customer account associated with the RDS event notification subscription
latefinal
-
enabled
↔ Output<
bool?> -
A boolean flag to enable/disable the subscription. Defaults to true.
latefinal
-
eventCategories
↔ Output<
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.latefinal - hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
name
↔ Output<
String> -
The name of the DB event subscription. By default generated by this provider.
latefinal
-
namePrefix
↔ Output<
String> -
The name of the DB event subscription. Conflicts with
name.latefinal -
region
↔ Output<
String> -
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
snsTopic
↔ Output<
String> -
The SNS topic to send events to.
latefinal
-
sourceIds
↔ Output<
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 sourceType must also be specified.
latefinal
-
sourceType
↔ Output<
String?> -
The type of source that will be generating the events. Valid options are
db-instance,db-parameter-group,db-security-group,db-snapshot,db-cluster,db-cluster-snapshot,custom-engine-version,db-proxy,blue-green-deployment,db-shard-group, andzero-etl. If not set, all sources will be subscribed to.latefinal -
A map of tags to assign to the resource. .If configured with a provider
defaultTagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.latefinal -
A map of tags assigned to the resource, including those inherited from the provider
defaultTagsconfiguration block.latefinal -
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
get(
String name, Input< String> id, {EventSubscriptionState? state, CustomResourceOptions? options}) → EventSubscription -
Gets an existing EventSubscription resource's state with the given
nameandid.