![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
@aws-cdk/aws-sns
Advanced tools
Changelog
1.67.0 (2020-10-07)
monocdk
. Note that monocdk
is still experimental..
in the name (#10441) (063798b), closes #10109addExecuteFileCommand
arguments cannot be omitted (#10692) (7178374), closes #10687InitCommand.shellCommand()
renders an argv command instead (#10691) (de9d2f7), closes #10684Readme
Add an SNS Topic to your stack:
import * as sns from '@aws-cdk/aws-sns';
const topic = new sns.Topic(this, 'Topic', {
displayName: 'Customer subscription topic'
});
Various subscriptions can be added to the topic by calling the
.addSubscription(...)
method on the topic. It accepts a subscription object,
default implementations of which can be found in the
@aws-cdk/aws-sns-subscriptions
package:
Add an HTTPS Subscription to your topic:
import * as subs from '@aws-cdk/aws-sns-subscriptions';
const myTopic = new sns.Topic(this, 'MyTopic');
myTopic.addSubscription(new subs.UrlSubscription('https://foobar.com/'));
Subscribe a queue to the topic:
myTopic.addSubscription(new subs.SqsSubscription(queue));
Note that subscriptions of queues in different accounts need to be manually confirmed by reading the initial message from the queue and visiting the link found in it.
A filter policy can be specified when subscribing an endpoint to a topic.
Example with a Lambda subscription:
const myTopic = new sns.Topic(this, 'MyTopic');
const fn = new lambda.Function(this, 'Function', ...);
// Lambda should receive only message matching the following conditions on attributes:
// color: 'red' or 'orange' or begins with 'bl'
// size: anything but 'small' or 'medium'
// price: between 100 and 200 or greater than 300
// store: attribute must be present
topic.addSubscription(new subs.LambdaSubscription(fn, {
filterPolicy: {
color: sns.SubscriptionFilter.stringFilter({
whitelist: ['red', 'orange'],
matchPrefixes: ['bl']
}),
size: sns.SubscriptionFilter.stringFilter({
blacklist: ['small', 'medium'],
}),
price: sns.SubscriptionFilter.numericFilter({
between: { start: 100, stop: 200 },
greaterThan: 300
}),
store: sns.SubscriptionFilter.existsFilter(),
}
}));
CDK can attach provided Queue as DLQ for your SNS subscription. See the SNS DLQ configuration docs for more information about this feature.
Example of usage with user provided DLQ.
const topic = new sns.Topic(stack, 'Topic');
const dlQueue = new Queue(stack, 'DeadLetterQueue', {
queueName: 'MySubscription_DLQ',
retentionPeriod: cdk.Duration.days(14),
});
new sns.Subscription(stack, 'Subscription', {
endpoint: 'endpoint',
protocol: sns.SubscriptionProtocol.LAMBDA,
topic,
deadLetterQueue: dlQueue,
});
SNS topics can be used as targets for CloudWatch event rules.
Use the @aws-cdk/aws-events-targets.SnsTopic
:
import * as targets from '@aws-cdk/aws-events-targets';
codeCommitRepository.onCommit(new targets.SnsTopic(myTopic));
This will result in adding a target to the event rule and will also modify the topic resource policy to allow CloudWatch events to publish to the topic.
FAQs
The CDK Construct Library for AWS::SNS
The npm package @aws-cdk/aws-sns receives a total of 110,783 weekly downloads. As such, @aws-cdk/aws-sns popularity was classified as popular.
We found that @aws-cdk/aws-sns demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.