Menu
Amazon Relational Database Service
API Reference (API Version 2014-10-31)

CreateEventSubscription

Creates an RDS event notification subscription. This action requires a topic ARN (Amazon Resource Name) created by either the RDS console, the SNS console, or the SNS API. To obtain an ARN with SNS, you must create a topic in Amazon SNS and subscribe to the topic. The ARN is displayed in the SNS console.

You can specify the type of source (SourceType) you want to be notified of, provide a list of RDS sources (SourceIds) that triggers the events, and provide a list of event categories (EventCategories) for events you want to be notified of. For example, you can specify SourceType = db-instance, SourceIds = mydbinstance1, mydbinstance2 and EventCategories = Availability, Backup.

If you specify both the SourceType and SourceIds, such as SourceType = db-instance and SourceIdentifier = myDBInstance1, you will be notified of all the db-instance events for the specified source. If you specify a SourceType but do not specify a SourceIdentifier, you will receive notice of the events for that source type for all your RDS sources. If you do not specify either the SourceType nor the SourceIdentifier, you will be notified of events generated from all RDS sources belonging to your customer account.

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

Enabled

A Boolean value; set to true to activate the subscription, set to false to create the subscription but not active it.

Type: Boolean

Required: No

EventCategories.EventCategory.N

A list of event categories for a SourceType that you want to subscribe to. You can see a list of the categories for a given SourceType in the Events topic in the Amazon RDS User Guide or by using the DescribeEventCategories action.

Type: Array of strings

Required: No

SnsTopicArn

The Amazon Resource Name (ARN) of the SNS topic created for event notification. The ARN is created by Amazon SNS when you create a topic and subscribe to it.

Type: String

Required: Yes

SourceIds.SourceId.N

The list of identifiers of the event sources for which events will be returned. If not specified, then all sources are included in the response. An identifier must begin with a letter and must contain only ASCII letters, digits, and hyphens; it cannot end with a hyphen or contain two consecutive hyphens.

Constraints:

  • If SourceIds are supplied, SourceType must also be provided.

  • If the source type is a DB instance, then a DBInstanceIdentifier must be supplied.

  • If the source type is a DB security group, a DBSecurityGroupName must be supplied.

  • If the source type is a DB parameter group, a DBParameterGroupName must be supplied.

  • If the source type is a DB snapshot, a DBSnapshotIdentifier must be supplied.

Type: Array of strings

Required: No

SourceType

The type of source that will be generating the events. For example, if you want to be notified of events generated by a DB instance, you would set this parameter to db-instance. if this value is not specified, all events are returned.

Valid values: db-instance | db-cluster | db-parameter-group | db-security-group | db-snapshot | db-cluster-snapshot

Type: String

Required: No

SubscriptionName

The name of the subscription.

Constraints: The name must be less than 255 characters.

Type: String

Required: Yes

Tags.Tag.N

A list of tags.

Type: Array of Tag objects

Required: No

Response Elements

The following element is returned by the service.

EventSubscription

Contains the results of a successful invocation of the DescribeEventSubscriptions action.

Type: EventSubscription object

Errors

For information about the errors that are common to all actions, see Common Errors.

EventSubscriptionQuotaExceeded

You have reached the maximum number of event subscriptions.

HTTP Status Code: 400

SNSInvalidTopic

SNS has responded that there is a problem with the SND topic specified.

HTTP Status Code: 400

SNSNoAuthorization

You do not have permission to publish to the SNS topic ARN.

HTTP Status Code: 400

SNSTopicArnNotFound

The SNS topic ARN does not exist.

HTTP Status Code: 404

SourceNotFound

The requested source could not be found.

HTTP Status Code: 404

SubscriptionAlreadyExist

The supplied subscription name already exists.

HTTP Status Code: 400

SubscriptionCategoryNotFound

The supplied category does not exist.

HTTP Status Code: 404

Examples

Example

Sample Request

Copy
https://rds.us-east-1.amazonaws.com/ ?Action=CreateEventSubscription &Enabled=true &EventCategories.member.1=failure &EventCategories.member.2=configuration%20change &SignatureMethod=HmacSHA256 &SignatureVersion=4 &SnsTopicArn=arn%3Aaws%3Asns%3Aus-east-1%3A802#########%3Amyawsuser-RDS &SourceType=db-security-group &SubscriptionName=myawsuser-secgrp &Version=2014-09-01 &X-Amz-Algorithm=AWS4-HMAC-SHA256 &X-Amz-Credential=AKIADQKE4SARGYLE/20140425/us-east-1/rds/aws4_request &X-Amz-Date=20140425T214325Z &X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date &X-Amz-Signature=7045960f6ab15609571fb05278004256e186b7633ab2a3ae46826d7713e0b461

Sample Response

Copy
<CreateEventSubscriptionResponse xmlns="http://rds.amazonaws.com/doc/2014-09-01/"> <CreateEventSubscriptionResult> <EventSubscription> <SourceType>db-security-group</SourceType> <Enabled>true</Enabled> <CustomerAwsId>803#########</CustomerAwsId> <Status>creating</Status> <SubscriptionCreationTime>Fri Apr 25 21:43:25 UTC 2014</SubscriptionCreationTime> <EventCategoriesList> <EventCategory>configuration change</EventCategory> <EventCategory>failure</EventCategory> </EventCategoriesList> <CustSubscriptionId>myawsuser-secgrp</CustSubscriptionId> <SnsTopicArn>arn:aws:sns:us-east-1:802#########:myawsuser-RDS</SnsTopicArn> </EventSubscription> </CreateEventSubscriptionResult> <ResponseMetadata> <RequestId>f15e9dc3-bbb1-11d3-f4c6-37db295f7674</RequestId> </ResponseMetadata> </CreateEventSubscriptionResponse>

Example

Sample Request

Copy
https://rds.us-east-1.amazonaws.com/ ?Action=CreateEventSubscription &Enabled=true &EventCategories.member.1=creation &EventCategories.member.2=deletion &EventCategories.member.3=failover &SignatureMethod=HmacSHA256 &SignatureVersion=4 &SnsTopicArn=arn%3Aaws%3Asns%3Aus-east-1%3A802#########%3Amyawsuser-RDS &SourceType=db-instance &SubscriptionName=myawsuser-inst &Version=2014-09-01 &X-Amz-Algorithm=AWS4-HMAC-SHA256 &X-Amz-Credential=AKIADQKE4SARGYLE/20140429/us-east-1/rds/aws4_request &X-Amz-Date=20140429T184410Z &X-Amz-SignedHeaders=content-type;host;user-agent;x-amz-content-sha256;x-amz-date &X-Amz-Signature=1e1879f20ef3aec07135d69cc192426bf1cc5c42fc9d1acc7726bcd93155fb71

Sample Response

Copy
<CreateEventSubscriptionResponse xmlns="http://rds.amazonaws.com/doc/2014-09-01/"> <CreateEventSubscriptionResult> <EventSubscription> <SourceType>db-instance</SourceType> <Enabled>true</Enabled> <CustomerAwsId>803#########</CustomerAwsId> <Status>creating</Status> <SubscriptionCreationTime>Tue Apr 29 18:44:10 UTC 2014</SubscriptionCreationTime> <EventCategoriesList> <EventCategory>creation</EventCategory> <EventCategory>deletion</EventCategory> <EventCategory>failover</EventCategory> </EventCategoriesList> <CustSubscriptionId>myawsuser-inst</CustSubscriptionId> <SnsTopicArn>arn:aws:sns:us-east-1:802#########:myawsuser-RDS</SnsTopicArn> </EventSubscription> </CreateEventSubscriptionResult> <ResponseMetadata> <RequestId>30feb307-bebd-11d3-f4c6-37db295f7674</RequestId> </ResponseMetadata> </CreateEventSubscriptionResponse>

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: