aws-solutions-constructs.aws-dynamodb-stream-lambda


Nameaws-solutions-constructs.aws-dynamodb-stream-lambda JSON
Version 1.181.1 PyPI version JSON
download
home_pagehttps://github.com/awslabs/aws-solutions-constructs.git
SummaryCDK Constructs for AWS DynamoDB Stream to AWS Lambda integration.
upload_time2022-12-02 03:33:13
maintainer
docs_urlNone
authorAmazon Web Services
requires_python~=3.7
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # aws-dynamodb-stream-lambda module

<!--BEGIN STABILITY BANNER-->---


![Stability: Deprecated](https://img.shields.io/badge/STABILITY-DEPRECATED-red?style=for-the-badge)

> Some of our early constructs don’t meet the naming standards that evolved for the library. We are releasing completely feature compatible versions with corrected names. The underlying implementation code is the same regardless of whether you deploy the construct using the old or new name. We will support both names for all 1.x releases, but in 2.x we will only publish the correctly named constructs. This construct is being replaced by the functionally identical aws-dynamodbstreams-lambda.

---
<!--END STABILITY BANNER-->

| **Reference Documentation**:| <span style="font-weight: normal">https://docs.aws.amazon.com/solutions/latest/constructs/</span>|
|:-------------|:-------------|

<div style="height:8px"></div>

| **Language**     | **Package**        |
|:-------------|-----------------|
|![Python Logo](https://docs.aws.amazon.com/cdk/api/latest/img/python32.png) Python|`aws_solutions_constructs.aws_dynamodb_stream_lambda`|
|![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript|`@aws-solutions-constructs/aws-dynamodb-stream-lambda`|
|![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java|`software.amazon.awsconstructs.services.dynamodbstreamlambda`|

## Overview

This AWS Solutions Construct implements a pattern Amazon DynamoDB table with stream to invoke the AWS Lambda function  with the least privileged permissions.

Here is a minimal deployable pattern definition:

Typescript

```python
// aws-dynamodb-stream-lambda has been deprecated for CDK V2 in favor of aws-dynamodbstreams-lambda.
// This sample uses the CDK V1 syntax
import * as cdk from '@aws-cdk/core';
import { DynamoDBStreamToLambda } from '@aws-solutions-constructs/aws-dynamodb-stream-lambda';
import * as lambda from '@aws-cdk/aws-lambda';

new DynamoDBStreamToLambda(this, 'test-dynamodb-stream-lambda', {
  lambdaFunctionProps: {
    code: lambda.Code.fromAsset(`lambda`),
    runtime: lambda.Runtime.NODEJS_14_X,
    handler: 'index.handler'
  },
});
```

Python

```python
# aws-dynamodb-stream-lambda has been deprecated for CDK V2 in favor of aws-dynamodbstreams-lambda.
# This sample uses the CDK V1 syntax
from aws_solutions_constructs.aws_dynamodb_stream_lambda import DynamoDBStreamToLambda
from aws_cdk import (
    aws_lambda as _lambda,
    core,
)

DynamoDBStreamToLambda(self, 'test-dynamodb-stream-lambda',
                       lambda_function_props=_lambda.FunctionProps(
                           code=_lambda.Code.from_asset('lambda'),
                           runtime=_lambda.Runtime.PYTHON_3_9,
                           handler='index.handler'
                       )
                       )

```

Java

```java
// aws-dynamodb-stream-lambda has been deprecated for CDK V2 in favor of aws-dynamodbstreams-lambda.
// This sample uses the CDK V1 syntax
import software.constructs.Construct;

import software.amazon.awscdk.core.*;
import software.amazon.awscdk.services.lambda.*;
import software.amazon.awscdk.services.lambda.Runtime;
import software.amazon.awsconstructs.services.dynamodbstreamlambda.*;

new DynamoDBStreamToLambda(this, "test-dynamodbstreams-lambda",
        new DynamoDBStreamToLambdaProps.Builder()
                .lambdaFunctionProps(new FunctionProps.Builder()
                        .runtime(Runtime.NODEJS_14_X)
                        .code(Code.fromAsset("lambda"))
                        .handler("index.handler")
                        .build())
                .build());
```

## Pattern Construct Props

| **Name**     | **Type**        | **Description** |
|:-------------|:----------------|-----------------|
|existingLambdaObj?|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.Function.html)|Existing instance of Lambda Function object, providing both this and `lambdaFunctionProps` will cause an error.|
|lambdaFunctionProps?|[`lambda.FunctionProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.FunctionProps.html)|User provided props to override the default props for the Lambda function.|
|dynamoTableProps?|[`dynamodb.TableProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-dynamodb.TableProps.html)|Optional user provided props to override the default props for DynamoDB Table|
|existingTableInterface?|[`dynamodb.ITable`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-dynamodb.ITable.html)|Existing instance of DynamoDB table object or interface, providing both this and `dynamoTableProps` will cause an error.|
|dynamoEventSourceProps?|[`aws-lambda-event-sources.DynamoEventSourceProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda-event-sources.DynamoEventSourceProps.html)|Optional user provided props to override the default props for DynamoDB Event Source|

## Pattern Properties

| **Name**     | **Type**        | **Description** |
|:-------------|:----------------|-----------------|
|dynamoTableInterface|[`dynamodb.ITable`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-dynamodb.ITable.html)|Returns an instance of dynamodb.ITable created by the construct|
|dynamoTable?|[`dynamodb.Table`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-dynamodb.Table.html)|Returns an instance of dynamodb.Table created by the construct. IMPORTANT: If existingTableInterface was provided in Pattern Construct Props, this property will be `undefined`|
|lambdaFunction|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.Function.html)|Returns an instance of lambda.Function created by the construct|

## Lambda Function

This pattern requires a lambda function that can post data into the Elasticsearch. A sample function is provided [here](https://github.com/awslabs/aws-solutions-constructs/blob/master/source/patterns/%40aws-solutions-constructs/aws-dynamodb-stream-lambda-elasticsearch-kibana/test/lambda/index.js).

## Default settings

Out of the box implementation of the Construct without any override will set the following defaults:

### Amazon DynamoDB Table

* Set the billing mode for DynamoDB Table to On-Demand (Pay per request)
* Enable server-side encryption for DynamoDB Table using AWS managed KMS Key
* Creates a partition key called 'id' for DynamoDB Table
* Retain the Table when deleting the CloudFormation stack
* Enable continuous backups and point-in-time recovery

### 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
* Enable Failure-Handling features like enable bisect on function Error, set defaults for Maximum Record Age (24 hours) & Maximum Retry Attempts (500) and deploy SQS dead-letter queue as destination on failure
* Set Environment Variables

  * AWS_NODEJS_CONNECTION_REUSE_ENABLED (for Node 10.x and higher functions)

## Architecture

![Architecture Diagram](architecture.png)

---


© Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/awslabs/aws-solutions-constructs.git",
    "name": "aws-solutions-constructs.aws-dynamodb-stream-lambda",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "~=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "Amazon Web Services",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/8b/cc/7571cafbed5eeb06d2fe8c89ddb84c6d89800cdb3f3d0225978c003ec2ec/aws-solutions-constructs.aws-dynamodb-stream-lambda-1.181.1.tar.gz",
    "platform": null,
    "description": "# aws-dynamodb-stream-lambda module\n\n<!--BEGIN STABILITY BANNER-->---\n\n\n![Stability: Deprecated](https://img.shields.io/badge/STABILITY-DEPRECATED-red?style=for-the-badge)\n\n> Some of our early constructs don\u2019t meet the naming standards that evolved for the library. We are releasing completely feature compatible versions with corrected names. The underlying implementation code is the same regardless of whether you deploy the construct using the old or new name. We will support both names for all 1.x releases, but in 2.x we will only publish the correctly named constructs. This construct is being replaced by the functionally identical aws-dynamodbstreams-lambda.\n\n---\n<!--END STABILITY BANNER-->\n\n| **Reference Documentation**:| <span style=\"font-weight: normal\">https://docs.aws.amazon.com/solutions/latest/constructs/</span>|\n|:-------------|:-------------|\n\n<div style=\"height:8px\"></div>\n\n| **Language**     | **Package**        |\n|:-------------|-----------------|\n|![Python Logo](https://docs.aws.amazon.com/cdk/api/latest/img/python32.png) Python|`aws_solutions_constructs.aws_dynamodb_stream_lambda`|\n|![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript|`@aws-solutions-constructs/aws-dynamodb-stream-lambda`|\n|![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java|`software.amazon.awsconstructs.services.dynamodbstreamlambda`|\n\n## Overview\n\nThis AWS Solutions Construct implements a pattern Amazon DynamoDB table with stream to invoke the AWS Lambda function  with the least privileged permissions.\n\nHere is a minimal deployable pattern definition:\n\nTypescript\n\n```python\n// aws-dynamodb-stream-lambda has been deprecated for CDK V2 in favor of aws-dynamodbstreams-lambda.\n// This sample uses the CDK V1 syntax\nimport * as cdk from '@aws-cdk/core';\nimport { DynamoDBStreamToLambda } from '@aws-solutions-constructs/aws-dynamodb-stream-lambda';\nimport * as lambda from '@aws-cdk/aws-lambda';\n\nnew DynamoDBStreamToLambda(this, 'test-dynamodb-stream-lambda', {\n  lambdaFunctionProps: {\n    code: lambda.Code.fromAsset(`lambda`),\n    runtime: lambda.Runtime.NODEJS_14_X,\n    handler: 'index.handler'\n  },\n});\n```\n\nPython\n\n```python\n# aws-dynamodb-stream-lambda has been deprecated for CDK V2 in favor of aws-dynamodbstreams-lambda.\n# This sample uses the CDK V1 syntax\nfrom aws_solutions_constructs.aws_dynamodb_stream_lambda import DynamoDBStreamToLambda\nfrom aws_cdk import (\n    aws_lambda as _lambda,\n    core,\n)\n\nDynamoDBStreamToLambda(self, 'test-dynamodb-stream-lambda',\n                       lambda_function_props=_lambda.FunctionProps(\n                           code=_lambda.Code.from_asset('lambda'),\n                           runtime=_lambda.Runtime.PYTHON_3_9,\n                           handler='index.handler'\n                       )\n                       )\n\n```\n\nJava\n\n```java\n// aws-dynamodb-stream-lambda has been deprecated for CDK V2 in favor of aws-dynamodbstreams-lambda.\n// This sample uses the CDK V1 syntax\nimport software.constructs.Construct;\n\nimport software.amazon.awscdk.core.*;\nimport software.amazon.awscdk.services.lambda.*;\nimport software.amazon.awscdk.services.lambda.Runtime;\nimport software.amazon.awsconstructs.services.dynamodbstreamlambda.*;\n\nnew DynamoDBStreamToLambda(this, \"test-dynamodbstreams-lambda\",\n        new DynamoDBStreamToLambdaProps.Builder()\n                .lambdaFunctionProps(new FunctionProps.Builder()\n                        .runtime(Runtime.NODEJS_14_X)\n                        .code(Code.fromAsset(\"lambda\"))\n                        .handler(\"index.handler\")\n                        .build())\n                .build());\n```\n\n## Pattern Construct Props\n\n| **Name**     | **Type**        | **Description** |\n|:-------------|:----------------|-----------------|\n|existingLambdaObj?|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.Function.html)|Existing instance of Lambda Function object, providing both this and `lambdaFunctionProps` will cause an error.|\n|lambdaFunctionProps?|[`lambda.FunctionProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.FunctionProps.html)|User provided props to override the default props for the Lambda function.|\n|dynamoTableProps?|[`dynamodb.TableProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-dynamodb.TableProps.html)|Optional user provided props to override the default props for DynamoDB Table|\n|existingTableInterface?|[`dynamodb.ITable`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-dynamodb.ITable.html)|Existing instance of DynamoDB table object or interface, providing both this and `dynamoTableProps` will cause an error.|\n|dynamoEventSourceProps?|[`aws-lambda-event-sources.DynamoEventSourceProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda-event-sources.DynamoEventSourceProps.html)|Optional user provided props to override the default props for DynamoDB Event Source|\n\n## Pattern Properties\n\n| **Name**     | **Type**        | **Description** |\n|:-------------|:----------------|-----------------|\n|dynamoTableInterface|[`dynamodb.ITable`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-dynamodb.ITable.html)|Returns an instance of dynamodb.ITable created by the construct|\n|dynamoTable?|[`dynamodb.Table`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-dynamodb.Table.html)|Returns an instance of dynamodb.Table created by the construct. IMPORTANT: If existingTableInterface was provided in Pattern Construct Props, this property will be `undefined`|\n|lambdaFunction|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.Function.html)|Returns an instance of lambda.Function created by the construct|\n\n## Lambda Function\n\nThis pattern requires a lambda function that can post data into the Elasticsearch. A sample function is provided [here](https://github.com/awslabs/aws-solutions-constructs/blob/master/source/patterns/%40aws-solutions-constructs/aws-dynamodb-stream-lambda-elasticsearch-kibana/test/lambda/index.js).\n\n## Default settings\n\nOut of the box implementation of the Construct without any override will set the following defaults:\n\n### Amazon DynamoDB Table\n\n* Set the billing mode for DynamoDB Table to On-Demand (Pay per request)\n* Enable server-side encryption for DynamoDB Table using AWS managed KMS Key\n* Creates a partition key called 'id' for DynamoDB Table\n* Retain the Table when deleting the CloudFormation stack\n* Enable continuous backups and point-in-time recovery\n\n### AWS Lambda Function\n\n* Configure limited privilege access IAM role for Lambda function\n* Enable reusing connections with Keep-Alive for NodeJs Lambda function\n* Enable X-Ray Tracing\n* Enable Failure-Handling features like enable bisect on function Error, set defaults for Maximum Record Age (24 hours) & Maximum Retry Attempts (500) and deploy SQS dead-letter queue as destination on failure\n* Set Environment Variables\n\n  * AWS_NODEJS_CONNECTION_REUSE_ENABLED (for Node 10.x and higher functions)\n\n## Architecture\n\n![Architecture Diagram](architecture.png)\n\n---\n\n\n\u00a9 Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n\n\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "CDK Constructs for AWS DynamoDB Stream to AWS Lambda integration.",
    "version": "1.181.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "d5417c60f7dd0a49d94a7a331793d02a",
                "sha256": "79204aad19fc8fcef9ad9741bb8cd47fdcd9977333c56d3aeef056667003624b"
            },
            "downloads": -1,
            "filename": "aws_solutions_constructs.aws_dynamodb_stream_lambda-1.181.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d5417c60f7dd0a49d94a7a331793d02a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "~=3.7",
            "size": 106857,
            "upload_time": "2022-12-02T03:30:43",
            "upload_time_iso_8601": "2022-12-02T03:30:43.162465Z",
            "url": "https://files.pythonhosted.org/packages/ce/89/74b787a88023cc2d5f5cd28dd76cafc8bb301020015b4fecd095c0aead56/aws_solutions_constructs.aws_dynamodb_stream_lambda-1.181.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "16046cc6fedc6036902c307b98d7ff93",
                "sha256": "6fbce9107ad127836c17083e8e0d0e4570cb88b37c3b6668c40b7d887aad66f2"
            },
            "downloads": -1,
            "filename": "aws-solutions-constructs.aws-dynamodb-stream-lambda-1.181.1.tar.gz",
            "has_sig": false,
            "md5_digest": "16046cc6fedc6036902c307b98d7ff93",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.7",
            "size": 107709,
            "upload_time": "2022-12-02T03:33:13",
            "upload_time_iso_8601": "2022-12-02T03:33:13.624844Z",
            "url": "https://files.pythonhosted.org/packages/8b/cc/7571cafbed5eeb06d2fe8c89ddb84c6d89800cdb3f3d0225978c003ec2ec/aws-solutions-constructs.aws-dynamodb-stream-lambda-1.181.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-02 03:33:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "awslabs",
    "github_project": "aws-solutions-constructs.git",
    "lcname": "aws-solutions-constructs.aws-dynamodb-stream-lambda"
}
        
Elapsed time: 0.08112s