aws-sns-lambda

All classes are under active development and subject to
non-backward compatible changes or removal in any future version.
These are not subject to the
Semantic Versioning
Language | Package |
---|---|
![]() |
aws_solutions_constructs.aws_sns_lambda
|
![]() |
@aws-solutions-constructs/aws-sns-lambda
|
![]() |
software.amazon.awsconstructs.services.snslambda
|
This AWS Solutions Construct implements an Amazon SNS connected to an AWS Lambda function.
Here is a minimal deployable pattern definition in TypeScript:
import { SnsToLambda, SnsToLambdaProps } from "@aws-solutions-constructs/aws-sns-lambda"; new SnsToLambda(this, 'test-sns-lambda', { lambdaFunctionProps: { runtime: lambda.Runtime.NODEJS_12_X, handler: 'index.handler', code: lambda.Code.fromAsset(`${__dirname}/lambda`) } });
Initializer
new SnsToLambda(scope: Construct, id: string, props: SnsToLambdaProps);
Parameters
-
scope
Construct
-
id
string
-
props SnsToLambdaProps
Pattern Construct Props
Name | Type | Description |
---|---|---|
existingLambdaObj? |
lambda.Function
|
An optional, existing Lambda function to be used instead of the default function.
If an existing function is provided, the lambdaFunctionProps property will be ignored.
|
lambdaFunctionProps? |
lambda.FunctionProps
|
Optional user-provided properties to override the default properties for the
Lambda function. Ignored if an existingLambdaObj is provided.
|
existingTopicObj? |
sns.Topic
|
An optional, existing SNS topic to be used instead of the default topic.
If an existing topic is provided, the topicProps property will be ignored.
|
topicProps? |
sns.TopicProps
|
Optional user provided properties to override the default properties for the SNS topic. |
Pattern Properties
Name | Type | Description |
---|---|---|
lambdaFunction |
lambda.Function
|
Returns an instance of the Lambda function created by the pattern. |
snsTopic |
sns.Topic
|
Returns an instance of the SNS topic created by the pattern. |
Default settings
Out-of-the-box implementation of this pattern without any overrides will set the following defaults:
Amazon SNS Topic
-
Configure least privilege access permissions for SNS topic.
-
Enable server-side encryption using AWS managed KMS key.
-
Enforce encryption of data in transit.
AWS Lambda Function
-
Configure limited privilege access IAM role for Lambda function.
-
Enable reusing connections with Keep-Alive for NodeJs Lambda function.
-
Enable X-Ray tracing.
-
Set environment variables:
-
AWS_NODEJS_CONNECTION_REUSE_ENABLED
(for Node 10.x and higher functions)
-
Architecture

GitHub
To view the code for this pattern, create/view issues and pull requests, and more: | |
---|---|
![]() |
@aws-solutions-constructs/aws-sns-lambda |