CDK constructs for defining an interaction between an Amazon SQS queue and an AWS Lambda function.
Project description
aws-sqs-lambda module
---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.
Reference Documentation: | https://docs.aws.amazon.com/solutions/latest/constructs/ |
---|
Language | Package |
---|---|
Python | aws_solutions_constructs.aws_sns_lambda |
Typescript | @aws-solutions-constructs/aws-sns-lambda |
Java | software.amazon.awsconstructs.services.sqslambda |
This AWS Solutions Construct implements an Amazon SQS queue connected to an AWS Lambda function.
Here is a minimal deployable pattern definition:
const { SqsToLambda } = require('@aws-solutions-constructs/aws-sqs-lambda');
new SqsToLambda(stack, 'SqsToLambdaPattern', {
deployLambda: true,
lambdaFunctionProps: {
runtime: lambda.Runtime.NODEJS_10_X,
handler: 'index.handler',
code: lambda.Code.asset(`${__dirname}/lambda`)
}
});
Initializer
new SqsToLambda(scope: Construct, id: string, props: SqsToLambdaProps);
Parameters
- scope
Construct
- id
string
- props
SqsToLambdaProps
Pattern Construct Props
Name | Type | Description |
---|---|---|
deployLambda | boolean |
Whether to create a new Lambda function or use an existing Lambda function. |
existingLambdaObj? | lambda.Function |
An optional, existing Lambda function. |
lambdaFunctionProps? | lambda.FunctionProps |
Optional user-provided props to override the default props for the Lambda function. |
queueProps? | sqs.QueueProps |
Optional user-provided props to override the default props for the SQS queue. |
deployDeadLetterQueue? | boolean |
Whether to create a secondary queue to be used as a dead letter queue. Defaults to true. |
maxReceiveCount? | number |
The number of times a message can be unsuccessfully dequeued before being moved to the dead letter queue. Defaults to 15. |
Pattern Properties
Name | Type | Description |
---|---|---|
lambdaFunction | lambda.Function |
Returns an instance of the Lambda function created by the pattern. |
sqsQueue | sqs.Queue |
Returns an instance of the SQS queue created by the pattern. |
Default settings
Out of the box implementation of the Construct without any override will set the following defaults:
Amazon SQS Queue
- Deploy SQS dead-letter queue for the source SQS Queue
- Enable server-side encryption for source SQS Queue using AWS Managed KMS Key
AWS Lambda Function
- Configure least privilege access IAM role for Lambda function
- Enable reusing connections with Keep-Alive for NodeJs Lambda function
Architecture
© Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for aws-solutions-constructs.aws-sqs-lambda-1.47.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e26741a0d1d2aa2fa612ae68c165d1d663fa661ec60fbfca696de8ea0b0e85b4 |
|
MD5 | 16d9b826672ba7782c2832b23879cd4b |
|
BLAKE2b-256 | e9f272a1807223d1224a72dd19aad0a767480b79e3d7d4ddf405d706dccbb0ef |
Hashes for aws_solutions_constructs.aws_sqs_lambda-1.47.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91dd978fb45e011ab6923d9b3d24c3969c68af870a75755232dd7db7212b9daa |
|
MD5 | 44b1c9088f8016ff8d5c2b09466445bf |
|
BLAKE2b-256 | 1cc20cb8d90fc8f91e4836ec9b7f05daf91d3eb55b24163362779d5cb392b0ae |