aws-sns-lambda - AWS Solutions Constructs

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 model. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.

Language Package
Python
aws_solutions_constructs.aws_sns_lambda
Typescript
@aws-solutions-constructs/aws-sns-lambda
Java
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

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.

Architecture