diff --git a/CHANGELOG.md b/CHANGELOG.md index 08be1d1d1..ddcb1e4d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.61.1] - 2020-09-01 + +### Changed +- Upgraded all patterns to CDK v1.61.1 +- aws-sns-sqs pattern added ([#24](https://github.com/awslabs/aws-solutions-constructs/issues/24)) +- [All *-sns-* Patterns] Allow for existingTopicObj and change default encryption ([#49](https://github.com/awslabs/aws-solutions-constructs/issues/49)) + ## [1.61.0] - 2020-08-27 ### Changed diff --git a/source/lerna.json b/source/lerna.json index b2b85f8ec..d914128bb 100644 --- a/source/lerna.json +++ b/source/lerna.json @@ -6,5 +6,5 @@ "./patterns/@aws-solutions-constructs/*" ], "rejectCycles": "true", - "version": "1.61.0" + "version": "1.61.1" } diff --git a/source/package.json b/source/package.json index 0afba23aa..af42d6359 100644 --- a/source/package.json +++ b/source/package.json @@ -1,6 +1,6 @@ { "name": "aws-solutions-constructs", - "version": "1.61.0", + "version": "1.61.1", "description": "AWS Solutions Constructs Library", "repository": { "type": "git", diff --git a/source/patterns/@aws-solutions-constructs/aws-apigateway-dynamodb/package.json b/source/patterns/@aws-solutions-constructs/aws-apigateway-dynamodb/package.json index d18546354..81bc9f2fa 100644 --- a/source/patterns/@aws-solutions-constructs/aws-apigateway-dynamodb/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-apigateway-dynamodb/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-apigateway-dynamodb", - "version": "1.61.0", + "version": "1.61.1", "description": "CDK Constructs for AWS API Gateway and Amazon DynamoDB integration.", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -53,16 +53,16 @@ } }, "dependencies": { - "@aws-cdk/core": "~1.61.0", - "@aws-cdk/aws-apigateway": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-cdk/aws-dynamodb": "~1.61.0", - "@aws-cdk/aws-logs": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/core": "~1.61.1", + "@aws-cdk/aws-apigateway": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-cdk/aws-dynamodb": "~1.61.1", + "@aws-cdk/aws-logs": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, @@ -72,12 +72,12 @@ ] }, "peerDependencies": { - "@aws-cdk/core": "~1.61.0", - "@aws-cdk/aws-apigateway": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-cdk/aws-dynamodb": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/core": "~1.61.1", + "@aws-cdk/aws-apigateway": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-cdk/aws-dynamodb": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4", - "@aws-cdk/aws-logs": "~1.61.0" + "@aws-cdk/aws-logs": "~1.61.1" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-apigateway-lambda/package.json b/source/patterns/@aws-solutions-constructs/aws-apigateway-lambda/package.json index 9a31ca051..2fd719969 100644 --- a/source/patterns/@aws-solutions-constructs/aws-apigateway-lambda/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-apigateway-lambda/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-apigateway-lambda", - "version": "1.61.0", + "version": "1.61.1", "description": "CDK constructs for defining an interaction between an API Gateway and a Lambda function.", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -53,16 +53,16 @@ } }, "dependencies": { - "@aws-cdk/aws-apigateway": "~1.61.0", - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-logs": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-apigateway": "~1.61.1", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-logs": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, @@ -72,12 +72,12 @@ ] }, "peerDependencies": { - "@aws-cdk/aws-apigateway": "~1.61.0", - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-logs": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-apigateway": "~1.61.1", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-logs": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4", - "@aws-cdk/aws-iam": "~1.61.0" + "@aws-cdk/aws-iam": "~1.61.1" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-apigateway-sqs/README.md b/source/patterns/@aws-solutions-constructs/aws-apigateway-sqs/README.md index ddb36efa9..7d3828de8 100644 --- a/source/patterns/@aws-solutions-constructs/aws-apigateway-sqs/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-apigateway-sqs/README.md @@ -26,12 +26,12 @@ This AWS Solutions Construct implements an Amazon API Gateway connected to an Amazon SQS queue pattern. -Here is a minimal deployable pattern definition: +Here is a minimal deployable pattern definition in Typescript: ``` javascript -const { ApiGatewayToSqs } = require('@aws-solutions-constructs/aws-apigateway-sqs'); +import { ApiGatewayToSqs, ApiGatewayToSqsProps } from "@aws-solutions-constructs/aws-apigateway-sqs"; -new ApiGatewayToSqs(stack, 'ApiGatewayToSqsPattern', { +new ApiGatewayToSqs(this, 'ApiGatewayToSqsPattern', { apiGatewayProps: {}, queueProps: {}, deployDeadLetterQueue?: true, diff --git a/source/patterns/@aws-solutions-constructs/aws-apigateway-sqs/lib/index.ts b/source/patterns/@aws-solutions-constructs/aws-apigateway-sqs/lib/index.ts index 158ac534f..cc36e381a 100644 --- a/source/patterns/@aws-solutions-constructs/aws-apigateway-sqs/lib/index.ts +++ b/source/patterns/@aws-solutions-constructs/aws-apigateway-sqs/lib/index.ts @@ -98,7 +98,7 @@ export class ApiGatewayToSqs extends Construct { // Setup the dead letter queue, if applicable if (!props.deployDeadLetterQueue || props.deployDeadLetterQueue === true) { - const dlq: sqs.Queue = defaults.buildQueue(this, 'deadLetterQueue', { + const [dlq] = defaults.buildQueue(this, 'deadLetterQueue', { queueProps: props.queueProps }); this.deadLetterQueue = defaults.buildDeadLetterQueue({ @@ -108,7 +108,7 @@ export class ApiGatewayToSqs extends Construct { } // Setup the queue - this.sqsQueue = defaults.buildQueue(this, 'queue', { + [this.sqsQueue] = defaults.buildQueue(this, 'queue', { queueProps: props.queueProps, deadLetterQueue: this.deadLetterQueue }); diff --git a/source/patterns/@aws-solutions-constructs/aws-apigateway-sqs/package.json b/source/patterns/@aws-solutions-constructs/aws-apigateway-sqs/package.json index 277463744..374b7eed0 100644 --- a/source/patterns/@aws-solutions-constructs/aws-apigateway-sqs/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-apigateway-sqs/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-apigateway-sqs", - "version": "1.61.0", + "version": "1.61.1", "description": "CDK constructs for defining an interaction between an AWS Lambda function and an Amazon S3 bucket.", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -53,17 +53,17 @@ } }, "dependencies": { - "@aws-cdk/aws-apigateway": "~1.61.0", - "@aws-cdk/aws-sqs": "~1.61.0", - "@aws-cdk/aws-kms": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-cdk/aws-logs": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-apigateway": "~1.61.1", + "@aws-cdk/aws-sqs": "~1.61.1", + "@aws-cdk/aws-kms": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-cdk/aws-logs": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, @@ -73,13 +73,13 @@ ] }, "peerDependencies": { - "@aws-cdk/aws-apigateway": "~1.61.0", - "@aws-cdk/aws-sqs": "~1.61.0", - "@aws-cdk/aws-kms": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-apigateway": "~1.61.1", + "@aws-cdk/aws-sqs": "~1.61.1", + "@aws-cdk/aws-kms": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4", - "@aws-cdk/aws-logs": "~1.61.0" + "@aws-cdk/aws-logs": "~1.61.1" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-cloudfront-apigateway-lambda/package.json b/source/patterns/@aws-solutions-constructs/aws-cloudfront-apigateway-lambda/package.json index 0cd9d5b73..e2bda454e 100644 --- a/source/patterns/@aws-solutions-constructs/aws-cloudfront-apigateway-lambda/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-cloudfront-apigateway-lambda/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-cloudfront-apigateway-lambda", - "version": "1.61.0", + "version": "1.61.1", "description": "CDK Constructs for AWS Cloudfront to AWS API Gateway to AWS Lambda integration.", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -53,19 +53,19 @@ } }, "dependencies": { - "@aws-cdk/core": "~1.61.0", - "@aws-cdk/aws-cloudfront": "~1.61.0", - "@aws-cdk/aws-apigateway": "~1.61.0", - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-logs": "~1.61.0", - "@aws-cdk/aws-s3": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-solutions-constructs/aws-cloudfront-apigateway": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/core": "~1.61.1", + "@aws-cdk/aws-cloudfront": "~1.61.1", + "@aws-cdk/aws-apigateway": "~1.61.1", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-logs": "~1.61.1", + "@aws-cdk/aws-s3": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-solutions-constructs/aws-cloudfront-apigateway": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, @@ -75,15 +75,15 @@ ] }, "peerDependencies": { - "@aws-cdk/core": "~1.61.0", - "@aws-cdk/aws-cloudfront": "~1.61.0", - "@aws-cdk/aws-apigateway": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-logs": "~1.61.0", - "@aws-solutions-constructs/aws-cloudfront-apigateway": "~1.61.0", + "@aws-cdk/core": "~1.61.1", + "@aws-cdk/aws-cloudfront": "~1.61.1", + "@aws-cdk/aws-apigateway": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-logs": "~1.61.1", + "@aws-solutions-constructs/aws-cloudfront-apigateway": "~1.61.1", "constructs": "^3.0.4", - "@aws-cdk/aws-s3": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0" + "@aws-cdk/aws-s3": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-cloudfront-apigateway/package.json b/source/patterns/@aws-solutions-constructs/aws-cloudfront-apigateway/package.json index 8b1356bad..99c3137ee 100644 --- a/source/patterns/@aws-solutions-constructs/aws-cloudfront-apigateway/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-cloudfront-apigateway/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-cloudfront-apigateway", - "version": "1.61.0", + "version": "1.61.1", "description": "CDK Constructs for AWS Cloudfront to AWS API Gateway integration.", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -53,17 +53,17 @@ } }, "dependencies": { - "@aws-cdk/core": "~1.61.0", - "@aws-cdk/aws-cloudfront": "~1.61.0", - "@aws-cdk/aws-apigateway": "~1.61.0", - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-logs": "~1.61.0", - "@aws-cdk/aws-s3": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/core": "~1.61.1", + "@aws-cdk/aws-cloudfront": "~1.61.1", + "@aws-cdk/aws-apigateway": "~1.61.1", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-logs": "~1.61.1", + "@aws-cdk/aws-s3": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, @@ -73,13 +73,13 @@ ] }, "peerDependencies": { - "@aws-cdk/core": "~1.61.0", - "@aws-cdk/aws-cloudfront": "~1.61.0", - "@aws-cdk/aws-apigateway": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-logs": "~1.61.0", + "@aws-cdk/core": "~1.61.1", + "@aws-cdk/aws-cloudfront": "~1.61.1", + "@aws-cdk/aws-apigateway": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-logs": "~1.61.1", "constructs": "^3.0.4", - "@aws-cdk/aws-s3": "~1.61.0" + "@aws-cdk/aws-s3": "~1.61.1" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-cloudfront-s3/package.json b/source/patterns/@aws-solutions-constructs/aws-cloudfront-s3/package.json index 548e489d8..d1683773a 100644 --- a/source/patterns/@aws-solutions-constructs/aws-cloudfront-s3/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-cloudfront-s3/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-cloudfront-s3", - "version": "1.61.0", + "version": "1.61.1", "description": "CDK Constructs for AWS Cloudfront to AWS S3 integration.", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -53,15 +53,15 @@ } }, "dependencies": { - "@aws-cdk/core": "~1.61.0", - "@aws-cdk/aws-cloudfront": "~1.61.0", - "@aws-cdk/aws-s3": "~1.61.0", - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/core": "~1.61.1", + "@aws-cdk/aws-cloudfront": "~1.61.1", + "@aws-cdk/aws-s3": "~1.61.1", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, @@ -71,11 +71,11 @@ ] }, "peerDependencies": { - "@aws-cdk/core": "~1.61.0", - "@aws-cdk/aws-cloudfront": "~1.61.0", - "@aws-cdk/aws-s3": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/core": "~1.61.1", + "@aws-cdk/aws-cloudfront": "~1.61.1", + "@aws-cdk/aws-s3": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4", - "@aws-cdk/aws-lambda": "~1.61.0" + "@aws-cdk/aws-lambda": "~1.61.1" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-cognito-apigateway-lambda/package.json b/source/patterns/@aws-solutions-constructs/aws-cognito-apigateway-lambda/package.json index 26962acc8..5d183fe79 100644 --- a/source/patterns/@aws-solutions-constructs/aws-cognito-apigateway-lambda/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-cognito-apigateway-lambda/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-cognito-apigateway-lambda", - "version": "1.61.0", + "version": "1.61.1", "description": "CDK Constructs for AWS Cognito to AWS API Gateway to AWS Lambda integration", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -53,17 +53,17 @@ } }, "dependencies": { - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-cdk/aws-cognito": "~1.61.0", - "@aws-cdk/aws-apigateway": "~1.61.0", - "@aws-cdk/aws-logs": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-cdk/aws-cognito": "~1.61.1", + "@aws-cdk/aws-apigateway": "~1.61.1", + "@aws-cdk/aws-logs": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, @@ -73,13 +73,13 @@ ] }, "peerDependencies": { - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-cdk/aws-cognito": "~1.61.0", - "@aws-cdk/aws-apigateway": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-cdk/aws-cognito": "~1.61.1", + "@aws-cdk/aws-apigateway": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4", - "@aws-cdk/aws-logs": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0" + "@aws-cdk/aws-logs": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodb-stream-lambda-elasticsearch-kibana/package.json b/source/patterns/@aws-solutions-constructs/aws-dynamodb-stream-lambda-elasticsearch-kibana/package.json index efff80ffc..ca99ee291 100644 --- a/source/patterns/@aws-solutions-constructs/aws-dynamodb-stream-lambda-elasticsearch-kibana/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodb-stream-lambda-elasticsearch-kibana/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-dynamodb-stream-lambda-elasticsearch-kibana", - "version": "1.61.0", + "version": "1.61.1", "description": "CDK Constructs for Amazon Dynamodb stream to AWS Lambda to AWS Elasticsearch with Kibana integration", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -53,21 +53,21 @@ } }, "dependencies": { - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-lambda-event-sources": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-cdk/aws-cognito": "~1.61.0", - "@aws-cdk/aws-elasticsearch": "~1.61.0", - "@aws-cdk/aws-dynamodb": "~1.61.0", - "@aws-cdk/aws-cloudwatch": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", - "@aws-solutions-constructs/aws-dynamodb-stream-lambda": "~1.61.0", - "@aws-solutions-constructs/aws-lambda-elasticsearch-kibana": "~1.61.0", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-lambda-event-sources": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-cdk/aws-cognito": "~1.61.1", + "@aws-cdk/aws-elasticsearch": "~1.61.1", + "@aws-cdk/aws-dynamodb": "~1.61.1", + "@aws-cdk/aws-cloudwatch": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", + "@aws-solutions-constructs/aws-dynamodb-stream-lambda": "~1.61.1", + "@aws-solutions-constructs/aws-lambda-elasticsearch-kibana": "~1.61.1", "constructs": "^3.0.4" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, @@ -77,17 +77,17 @@ ] }, "peerDependencies": { - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-cdk/aws-cognito": "~1.61.0", - "@aws-cdk/aws-elasticsearch": "~1.61.0", - "@aws-cdk/aws-dynamodb": "~1.61.0", - "@aws-cdk/aws-cloudwatch": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", - "@aws-solutions-constructs/aws-dynamodb-stream-lambda": "~1.61.0", - "@aws-solutions-constructs/aws-lambda-elasticsearch-kibana": "~1.61.0", - "@aws-cdk/aws-lambda-event-sources": "~1.61.0", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-cdk/aws-cognito": "~1.61.1", + "@aws-cdk/aws-elasticsearch": "~1.61.1", + "@aws-cdk/aws-dynamodb": "~1.61.1", + "@aws-cdk/aws-cloudwatch": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", + "@aws-solutions-constructs/aws-dynamodb-stream-lambda": "~1.61.1", + "@aws-solutions-constructs/aws-lambda-elasticsearch-kibana": "~1.61.1", + "@aws-cdk/aws-lambda-event-sources": "~1.61.1", "constructs": "^3.0.4", - "@aws-cdk/aws-iam": "~1.61.0" + "@aws-cdk/aws-iam": "~1.61.1" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodb-stream-lambda/package.json b/source/patterns/@aws-solutions-constructs/aws-dynamodb-stream-lambda/package.json index 0d89aeb19..f07c855e1 100644 --- a/source/patterns/@aws-solutions-constructs/aws-dynamodb-stream-lambda/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodb-stream-lambda/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-dynamodb-stream-lambda", - "version": "1.61.0", + "version": "1.61.1", "description": "CDK Constructs for AWS DynamoDB Stream to AWS Lambda integration.", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -53,16 +53,16 @@ } }, "dependencies": { - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-lambda-event-sources": "~1.61.0", - "@aws-cdk/aws-dynamodb": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-lambda-event-sources": "~1.61.1", + "@aws-cdk/aws-dynamodb": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, @@ -72,12 +72,12 @@ ] }, "peerDependencies": { - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-dynamodb": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", - "@aws-cdk/aws-lambda-event-sources": "~1.61.0", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-dynamodb": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", + "@aws-cdk/aws-lambda-event-sources": "~1.61.1", "constructs": "^3.0.4", - "@aws-cdk/aws-iam": "~1.61.0" + "@aws-cdk/aws-iam": "~1.61.1" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-events-rule-lambda/package.json b/source/patterns/@aws-solutions-constructs/aws-events-rule-lambda/package.json index 31f301c5b..a1afe8e0f 100644 --- a/source/patterns/@aws-solutions-constructs/aws-events-rule-lambda/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-events-rule-lambda/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-events-rule-lambda", - "version": "1.61.0", + "version": "1.61.1", "description": "CDK Constructs for deploying AWS Events Rule that inveokes AWS Lambda", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -53,15 +53,15 @@ } }, "dependencies": { - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-cdk/aws-events": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-cdk/aws-events": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, @@ -71,11 +71,11 @@ ] }, "peerDependencies": { - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-cdk/aws-events": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-cdk/aws-events": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-events-rule-step-function/package.json b/source/patterns/@aws-solutions-constructs/aws-events-rule-step-function/package.json index 27ef05810..740cb424a 100644 --- a/source/patterns/@aws-solutions-constructs/aws-events-rule-step-function/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-events-rule-step-function/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-events-rule-step-function", - "version": "1.61.0", + "version": "1.61.1", "description": "CDK Constructs for deploying AWS Events Rule that invokes AWS Step Function", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -53,19 +53,19 @@ } }, "dependencies": { - "@aws-cdk/aws-stepfunctions": "~1.61.0", - "@aws-cdk/aws-stepfunctions-tasks": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-cdk/aws-events": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-logs": "~1.61.0", - "@aws-cdk/aws-cloudwatch": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-stepfunctions": "~1.61.1", + "@aws-cdk/aws-stepfunctions-tasks": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-cdk/aws-events": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-logs": "~1.61.1", + "@aws-cdk/aws-cloudwatch": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, @@ -75,15 +75,15 @@ ] }, "peerDependencies": { - "@aws-cdk/aws-stepfunctions": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-cdk/aws-events": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-stepfunctions": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-cdk/aws-events": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4", - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-cloudwatch": "~1.61.0", - "@aws-cdk/aws-stepfunctions-tasks": "~1.61.0", - "@aws-cdk/aws-logs": "~1.61.0" + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-cloudwatch": "~1.61.1", + "@aws-cdk/aws-stepfunctions-tasks": "~1.61.1", + "@aws-cdk/aws-logs": "~1.61.1" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-iot-kinesisfirehose-s3/package.json b/source/patterns/@aws-solutions-constructs/aws-iot-kinesisfirehose-s3/package.json index 7f509a626..0df878dea 100644 --- a/source/patterns/@aws-solutions-constructs/aws-iot-kinesisfirehose-s3/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-iot-kinesisfirehose-s3/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-iot-kinesisfirehose-s3", - "version": "1.61.0", + "version": "1.61.1", "description": "CDK Constructs for AWS IoT to AWS Kinesis Firehose to AWS S3 integration.", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -53,18 +53,18 @@ } }, "dependencies": { - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-cdk/aws-kinesisfirehose": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-cdk/aws-iot": "~1.61.0", - "@aws-cdk/aws-s3": "~1.61.0", - "@aws-cdk/aws-logs": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", - "@aws-solutions-constructs/aws-kinesisfirehose-s3": "~1.61.0", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-cdk/aws-kinesisfirehose": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-cdk/aws-iot": "~1.61.1", + "@aws-cdk/aws-s3": "~1.61.1", + "@aws-cdk/aws-logs": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", + "@aws-solutions-constructs/aws-kinesisfirehose-s3": "~1.61.1", "constructs": "^3.0.4" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, @@ -74,14 +74,14 @@ ] }, "peerDependencies": { - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-cdk/aws-kinesisfirehose": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-cdk/aws-iot": "~1.61.0", - "@aws-cdk/aws-s3": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", - "@aws-solutions-constructs/aws-kinesisfirehose-s3": "~1.61.0", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-cdk/aws-kinesisfirehose": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-cdk/aws-iot": "~1.61.1", + "@aws-cdk/aws-s3": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", + "@aws-solutions-constructs/aws-kinesisfirehose-s3": "~1.61.1", "constructs": "^3.0.4", - "@aws-cdk/aws-logs": "~1.61.0" + "@aws-cdk/aws-logs": "~1.61.1" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-iot-lambda-dynamodb/package.json b/source/patterns/@aws-solutions-constructs/aws-iot-lambda-dynamodb/package.json index 580b9be8f..6ef8020e1 100644 --- a/source/patterns/@aws-solutions-constructs/aws-iot-lambda-dynamodb/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-iot-lambda-dynamodb/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-iot-lambda-dynamodb", - "version": "1.61.0", + "version": "1.61.1", "description": "CDK Constructs for AWS IoT to AWS Lambda to AWS DyanmoDB integration.", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -53,17 +53,17 @@ } }, "dependencies": { - "@aws-cdk/aws-dynamodb": "~1.61.0", - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-iot": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", - "@aws-solutions-constructs/aws-iot-lambda": "~1.61.0", - "@aws-solutions-constructs/aws-lambda-dynamodb": "~1.61.0", + "@aws-cdk/aws-dynamodb": "~1.61.1", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-iot": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", + "@aws-solutions-constructs/aws-iot-lambda": "~1.61.1", + "@aws-solutions-constructs/aws-lambda-dynamodb": "~1.61.1", "constructs": "^3.0.4" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, @@ -73,13 +73,13 @@ ] }, "peerDependencies": { - "@aws-cdk/aws-dynamodb": "~1.61.0", - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-iot": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", - "@aws-solutions-constructs/aws-iot-lambda": "~1.61.0", - "@aws-solutions-constructs/aws-lambda-dynamodb": "~1.61.0", + "@aws-cdk/aws-dynamodb": "~1.61.1", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-iot": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", + "@aws-solutions-constructs/aws-iot-lambda": "~1.61.1", + "@aws-solutions-constructs/aws-lambda-dynamodb": "~1.61.1", "constructs": "^3.0.4" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-iot-lambda/package.json b/source/patterns/@aws-solutions-constructs/aws-iot-lambda/package.json index b7b968e60..8da7ee32e 100644 --- a/source/patterns/@aws-solutions-constructs/aws-iot-lambda/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-iot-lambda/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-iot-lambda", - "version": "1.61.0", + "version": "1.61.1", "description": "CDK Constructs for AWS IoT to AWS Lambda integration", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -53,15 +53,15 @@ } }, "dependencies": { - "@aws-cdk/aws-iot": "~1.61.0", - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-iot": "~1.61.1", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, @@ -71,11 +71,11 @@ ] }, "peerDependencies": { - "@aws-cdk/aws-iot": "~1.61.0", - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0", + "@aws-cdk/aws-iot": "~1.61.1", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1", "constructs": "^3.0.4" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-kinesisfirehose-s3-and-kinesisanalytics/package.json b/source/patterns/@aws-solutions-constructs/aws-kinesisfirehose-s3-and-kinesisanalytics/package.json index a07b1c4ca..936afc51e 100644 --- a/source/patterns/@aws-solutions-constructs/aws-kinesisfirehose-s3-and-kinesisanalytics/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-kinesisfirehose-s3-and-kinesisanalytics/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-kinesisfirehose-s3-and-kinesisanalytics", - "version": "1.61.0", + "version": "1.61.1", "description": "CDK constructs for defining an interaction between an Amazon Kinesis Data Firehose delivery stream and (1) an Amazon S3 bucket, and (2) an Amazon Kinesis Data Analytics application.", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -53,19 +53,19 @@ } }, "dependencies": { - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-cdk/aws-kinesis": "~1.61.0", - "@aws-cdk/aws-kinesisanalytics": "~1.61.0", - "@aws-cdk/aws-kinesisfirehose": "~1.61.0", - "@aws-cdk/aws-s3": "~1.61.0", - "@aws-cdk/aws-logs": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", - "@aws-solutions-constructs/aws-kinesisfirehose-s3": "~1.61.0", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-cdk/aws-kinesis": "~1.61.1", + "@aws-cdk/aws-kinesisanalytics": "~1.61.1", + "@aws-cdk/aws-kinesisfirehose": "~1.61.1", + "@aws-cdk/aws-s3": "~1.61.1", + "@aws-cdk/aws-logs": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", + "@aws-solutions-constructs/aws-kinesisfirehose-s3": "~1.61.1", "constructs": "^3.0.4" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, @@ -75,15 +75,15 @@ ] }, "peerDependencies": { - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-cdk/aws-kinesis": "~1.61.0", - "@aws-cdk/aws-kinesisanalytics": "~1.61.0", - "@aws-cdk/aws-kinesisfirehose": "~1.61.0", - "@aws-cdk/aws-s3": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", - "@aws-solutions-constructs/aws-kinesisfirehose-s3": "~1.61.0", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-cdk/aws-kinesis": "~1.61.1", + "@aws-cdk/aws-kinesisanalytics": "~1.61.1", + "@aws-cdk/aws-kinesisfirehose": "~1.61.1", + "@aws-cdk/aws-s3": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", + "@aws-solutions-constructs/aws-kinesisfirehose-s3": "~1.61.1", "constructs": "^3.0.4", - "@aws-cdk/aws-logs": "~1.61.0" + "@aws-cdk/aws-logs": "~1.61.1" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-kinesisfirehose-s3/package.json b/source/patterns/@aws-solutions-constructs/aws-kinesisfirehose-s3/package.json index c71d94da8..7898a6ed3 100644 --- a/source/patterns/@aws-solutions-constructs/aws-kinesisfirehose-s3/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-kinesisfirehose-s3/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-kinesisfirehose-s3", - "version": "1.61.0", + "version": "1.61.1", "description": "CDK constructs for defining an interaction between an Amazon Kinesis Data Firehose delivery stream and an Amazon S3 bucket.", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -53,16 +53,16 @@ } }, "dependencies": { - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-cdk/aws-kinesisfirehose": "~1.61.0", - "@aws-cdk/aws-s3": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-cdk/aws-logs": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-cdk/aws-kinesisfirehose": "~1.61.1", + "@aws-cdk/aws-s3": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-cdk/aws-logs": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, @@ -72,12 +72,12 @@ ] }, "peerDependencies": { - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-cdk/aws-kinesisfirehose": "~1.61.0", - "@aws-cdk/aws-s3": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-cdk/aws-logs": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-cdk/aws-kinesisfirehose": "~1.61.1", + "@aws-cdk/aws-s3": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-cdk/aws-logs": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-kinesisstreams-lambda/package.json b/source/patterns/@aws-solutions-constructs/aws-kinesisstreams-lambda/package.json index d0bd793c4..d3b43d3cb 100644 --- a/source/patterns/@aws-solutions-constructs/aws-kinesisstreams-lambda/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-kinesisstreams-lambda/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-kinesisstreams-lambda", - "version": "1.61.0", + "version": "1.61.1", "description": "CDK constructs for defining an interaction between an Amazon Kinesis Data Stream and an AWS Lambda function.", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -53,16 +53,16 @@ } }, "dependencies": { - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-cdk/aws-kinesis": "~1.61.0", - "@aws-cdk/aws-kms": "~1.61.0", - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-cdk/aws-kinesis": "~1.61.1", + "@aws-cdk/aws-kms": "~1.61.1", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, @@ -72,12 +72,12 @@ ] }, "peerDependencies": { - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-cdk/aws-kinesis": "~1.61.0", - "@aws-cdk/aws-kms": "~1.61.0", - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-cdk/aws-kinesis": "~1.61.1", + "@aws-cdk/aws-kms": "~1.61.1", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-dynamodb/package.json b/source/patterns/@aws-solutions-constructs/aws-lambda-dynamodb/package.json index 9d5889a29..9fda01d75 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-dynamodb/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-dynamodb/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-lambda-dynamodb", - "version": "1.61.0", + "version": "1.61.1", "description": "CDK Constructs for AWS Lambda to AWS DynamoDB integration.", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -53,14 +53,14 @@ } }, "dependencies": { - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-dynamodb": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-dynamodb": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, @@ -70,10 +70,10 @@ ] }, "peerDependencies": { - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-dynamodb": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-dynamodb": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-elasticsearch-kibana/package.json b/source/patterns/@aws-solutions-constructs/aws-lambda-elasticsearch-kibana/package.json index bbbbb7fe6..c175c88e7 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-elasticsearch-kibana/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-elasticsearch-kibana/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-lambda-elasticsearch-kibana", - "version": "1.61.0", + "version": "1.61.1", "description": "CDK Constructs for AWS Lambda to AWS Elasticsearch with Kibana integration", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -53,17 +53,17 @@ } }, "dependencies": { - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-cdk/aws-cognito": "~1.61.0", - "@aws-cdk/aws-elasticsearch": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-cdk/aws-cloudwatch": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-cdk/aws-cognito": "~1.61.1", + "@aws-cdk/aws-elasticsearch": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-cdk/aws-cloudwatch": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, @@ -73,13 +73,13 @@ ] }, "peerDependencies": { - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-cdk/aws-cognito": "~1.61.0", - "@aws-cdk/aws-elasticsearch": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-cdk/aws-cloudwatch": "~1.61.0", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-cdk/aws-cognito": "~1.61.1", + "@aws-cdk/aws-elasticsearch": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-cdk/aws-cloudwatch": "~1.61.1", "constructs": "^3.0.4" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-s3/package.json b/source/patterns/@aws-solutions-constructs/aws-lambda-s3/package.json index 72bd88080..5988c363f 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-s3/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-s3/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-lambda-s3", - "version": "1.61.0", + "version": "1.61.1", "description": "CDK constructs for defining an interaction between an AWS Lambda function and an Amazon S3 bucket.", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -53,14 +53,14 @@ } }, "dependencies": { - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-s3": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-s3": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, @@ -70,10 +70,10 @@ ] }, "peerDependencies": { - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-s3": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-s3": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-sns/README.md b/source/patterns/@aws-solutions-constructs/aws-lambda-sns/README.md index 1c2bbb646..8f45bb4c7 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-sns/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-sns/README.md @@ -24,18 +24,20 @@ This AWS Solutions Construct implements an AWS Lambda function connected to an Amazon SNS topic. -Here is a minimal deployable pattern definition: +Here is a minimal deployable pattern definition in Typescript: ``` javascript -const { LambdaToSns } = require('@aws-solutions-constructs/aws-lambda-sns'); +import { LambdaToSns, LambdaToSnsProps } from "@aws-solutions-constructs/aws-lambda-sns"; -new LambdaToSns(stack, 'LambdaToSnsPattern', { +const props: LambdaToSnsProps = { lambdaFunctionProps: { - runtime: lambda.Runtime.NODEJS_10_X, + runtime: lambda.Runtime.NODEJS_12_X, handler: 'index.handler', code: lambda.Code.asset(`${__dirname}/lambda`) } -}); +}; + +new LambdaToSns(stack, 'test-lambda-sns', props); ``` @@ -57,9 +59,8 @@ _Parameters_ |:-------------|:----------------|-----------------| |existingLambdaObj?|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.Function.html)|Existing instance of Lambda Function object, if this is set then the lambdaFunctionProps is ignored.| |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.| +|existingTopicObj?|[`sns.Topic`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.Function.html)|Existing instance of SNS Topic object, if this is set then the topicProps is ignored.| |topicProps?|[`sns.TopicProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-sns.TopicProps.html)|Optional user provided properties to override the default properties for the SNS topic.| -|enableEncryption?|`boolean`|Use a KMS Key, either managed by this CDK app, or imported. If importing an encryption key, it must be specified in the encryptionKey property for this construct.| -|encryptionKey?|[`kms.Key`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-kms.Key.html)|An optional, imported encryption key to encrypt the SNS topic with.| ## Pattern Properties @@ -67,7 +68,6 @@ _Parameters_ |:-------------|:----------------|-----------------| |lambdaFunction|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.Function.html)|Returns an instance of the Lambda function created by the pattern.| |snsTopic|[`sns.Topic`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-sns.Topic.html)|Returns an instance of the SNS topic created by the pattern.| -|encryptionKey|[`kms.Key`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-kms.Key.html)|Returns an instance of kms.Key used for the SNS topic.| ## Default settings @@ -80,7 +80,7 @@ Out of the box implementation of the Construct without any override will set the ### Amazon SNS Topic * Configure least privilege access permissions for SNS Topic -* Enable server-side encryption forSNS Topic using Customer managed KMS Key +* Enable server-side encryption forSNS Topic using AWS managed KMS Key * Enforce encryption of data in transit ## Architecture diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-sns/lib/index.ts b/source/patterns/@aws-solutions-constructs/aws-lambda-sns/lib/index.ts index 02f3f7698..2b3faf162 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-sns/lib/index.ts +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-sns/lib/index.ts @@ -14,7 +14,6 @@ // Imports import * as lambda from '@aws-cdk/aws-lambda'; import * as sns from '@aws-cdk/aws-sns'; -import * as kms from '@aws-cdk/aws-kms'; import * as defaults from '@aws-solutions-constructs/core'; import { Construct } from '@aws-cdk/core'; @@ -35,24 +34,17 @@ export interface LambdaToSnsProps { */ readonly lambdaFunctionProps?: lambda.FunctionProps, /** - * Optional user provided properties to override the default properties for the SNS topic. + * Existing instance of SNS Topic object, if this is set then topicProps is ignored. * - * @default - Default properties are used. + * @default - Default props are used */ - readonly topicProps?: sns.TopicProps, + readonly existingTopicObj?: sns.Topic, /** - * Use a KMS Key, either managed by this CDK app, or imported. If importing an encryption key, it must be specified in - * the encryptionKey property for this construct. - * - * @default - true (encryption enabled, managed by this CDK app). - */ - readonly enableEncryption?: boolean - /** - * An optional, imported encryption key to encrypt the SNS topic with. + * Optional user provided properties to override the default properties for the SNS topic. * - * @default - not specified. + * @default - Default properties are used. */ - readonly encryptionKey?: kms.Key + readonly topicProps?: sns.TopicProps } /** @@ -61,7 +53,6 @@ export interface LambdaToSnsProps { export class LambdaToSns extends Construct { public readonly lambdaFunction: lambda.Function; public readonly snsTopic: sns.Topic; - public readonly encryptionKey: kms.Key; /** * @summary Constructs a new instance of the LambdaToSns class. @@ -81,9 +72,9 @@ export class LambdaToSns extends Construct { }); // Setup the SNS topic - [this.snsTopic, this.encryptionKey] = defaults.buildTopic(this, { - enableEncryption: props.enableEncryption, - encryptionKey: props.encryptionKey + [this.snsTopic] = defaults.buildTopic(this, { + existingTopicObj: props.existingTopicObj, + topicProps: props.topicProps }); // Configure environment variables diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-sns/package.json b/source/patterns/@aws-solutions-constructs/aws-lambda-sns/package.json index cae62442d..f9b5a5187 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-sns/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-sns/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-lambda-sns", - "version": "1.61.0", + "version": "1.61.1", "description": "CDK constructs for defining an interaction between an AWS Lambda function and an Amazon SNS topic.", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -53,15 +53,15 @@ } }, "dependencies": { - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-sns": "~1.61.0", - "@aws-cdk/aws-kms": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-sns": "~1.61.1", + "@aws-cdk/aws-kms": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, @@ -71,11 +71,11 @@ ] }, "peerDependencies": { - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-sns": "~1.61.0", - "@aws-cdk/aws-kms": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-sns": "~1.61.1", + "@aws-cdk/aws-kms": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-sns/test/__snapshots__/lambda-sns.test.js.snap b/source/patterns/@aws-solutions-constructs/aws-lambda-sns/test/__snapshots__/lambda-sns.test.js.snap index 27f5add90..6fa0e4d8d 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-sns/test/__snapshots__/lambda-sns.test.js.snap +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-sns/test/__snapshots__/lambda-sns.test.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Test deployment with existing Lambda function 1`] = ` +exports[`Test deployment with existing existingTopicObj 1`] = ` Object { "Parameters": Object { "AssetParameters8efd3dd9643a4d64a128ad582cab718a1e464bcc719bbbcf0e7b0481188a0420ArtifactHashA71E92AD": Object { @@ -17,396 +17,12 @@ Object { }, }, "Resources": Object { - "lambdatosnsstackEncryptionKeyF46E3814": Object { - "DeletionPolicy": "Retain", + "MyTopic86869434": Object { "Properties": Object { - "EnableKeyRotation": true, - "KeyPolicy": Object { - "Statement": Array [ - Object { - "Action": Array [ - "kms:Create*", - "kms:Describe*", - "kms:Enable*", - "kms:List*", - "kms:Put*", - "kms:Update*", - "kms:Revoke*", - "kms:Disable*", - "kms:Get*", - "kms:Delete*", - "kms:ScheduleKeyDeletion", - "kms:CancelKeyDeletion", - "kms:GenerateDataKey", - "kms:TagResource", - "kms:UntagResource", - ], - "Effect": "Allow", - "Principal": Object { - "AWS": Object { - "Fn::Join": Array [ - "", - Array [ - "arn:", - Object { - "Ref": "AWS::Partition", - }, - ":iam::", - Object { - "Ref": "AWS::AccountId", - }, - ":root", - ], - ], - }, - }, - "Resource": "*", - }, - ], - "Version": "2012-10-17", - }, - }, - "Type": "AWS::KMS::Key", - "UpdateReplacePolicy": "Retain", - }, - "lambdatosnsstackLambdaFunction84DDA23E": Object { - "DependsOn": Array [ - "lambdatosnsstackLambdaFunctionServiceRoleDefaultPolicy787D809F", - "lambdatosnsstackLambdaFunctionServiceRole55BFEAA9", - ], - "Metadata": Object { - "cfn_nag": Object { - "rules_to_suppress": Array [ - Object { - "id": "W58", - "reason": "Lambda functions has the required permission to write CloudWatch Logs. It uses custom policy instead of arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole with more tighter permissions.", - }, - ], - }, - }, - "Properties": Object { - "Code": Object { - "S3Bucket": Object { - "Ref": "AssetParameters8efd3dd9643a4d64a128ad582cab718a1e464bcc719bbbcf0e7b0481188a0420S3Bucket749AC458", - }, - "S3Key": Object { - "Fn::Join": Array [ - "", - Array [ - Object { - "Fn::Select": Array [ - 0, - Object { - "Fn::Split": Array [ - "||", - Object { - "Ref": "AssetParameters8efd3dd9643a4d64a128ad582cab718a1e464bcc719bbbcf0e7b0481188a0420S3VersionKeyFF5CC16D", - }, - ], - }, - ], - }, - Object { - "Fn::Select": Array [ - 1, - Object { - "Fn::Split": Array [ - "||", - Object { - "Ref": "AssetParameters8efd3dd9643a4d64a128ad582cab718a1e464bcc719bbbcf0e7b0481188a0420S3VersionKeyFF5CC16D", - }, - ], - }, - ], - }, - ], - ], - }, - }, - "Environment": Object { - "Variables": Object { - "AWS_NODEJS_CONNECTION_REUSE_ENABLED": "1", - "LAMBDA_NAME": "override-function", - "SNS_TOPIC_ARN": Object { - "Ref": "lambdatosnsstackSnsTopic6292A14A", - }, - "SNS_TOPIC_NAME": Object { - "Fn::GetAtt": Array [ - "lambdatosnsstackSnsTopic6292A14A", - "TopicName", - ], - }, - }, - }, - "Handler": "index.handler", - "Role": Object { - "Fn::GetAtt": Array [ - "lambdatosnsstackLambdaFunctionServiceRole55BFEAA9", - "Arn", - ], - }, - "Runtime": "nodejs10.x", - "TracingConfig": Object { - "Mode": "Active", - }, - }, - "Type": "AWS::Lambda::Function", - }, - "lambdatosnsstackLambdaFunctionServiceRole55BFEAA9": Object { - "Properties": Object { - "AssumeRolePolicyDocument": Object { - "Statement": Array [ - Object { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": Object { - "Service": "lambda.amazonaws.com", - }, - }, - ], - "Version": "2012-10-17", - }, - "Policies": Array [ - Object { - "PolicyDocument": Object { - "Statement": Array [ - Object { - "Action": Array [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents", - ], - "Effect": "Allow", - "Resource": Object { - "Fn::Join": Array [ - "", - Array [ - "arn:aws:logs:", - Object { - "Ref": "AWS::Region", - }, - ":", - Object { - "Ref": "AWS::AccountId", - }, - ":log-group:/aws/lambda/*", - ], - ], - }, - }, - ], - "Version": "2012-10-17", - }, - "PolicyName": "LambdaFunctionServiceRolePolicy", - }, - ], - }, - "Type": "AWS::IAM::Role", - }, - "lambdatosnsstackLambdaFunctionServiceRoleDefaultPolicy787D809F": Object { - "Metadata": Object { - "cfn_nag": Object { - "rules_to_suppress": Array [ - Object { - "id": "W12", - "reason": "Lambda needs the following minimum required permissions to send trace data to X-Ray.", - }, - ], - }, - }, - "Properties": Object { - "PolicyDocument": Object { - "Statement": Array [ - Object { - "Action": Array [ - "xray:PutTraceSegments", - "xray:PutTelemetryRecords", - ], - "Effect": "Allow", - "Resource": "*", - }, - Object { - "Action": "sns:Publish", - "Effect": "Allow", - "Resource": Object { - "Ref": "lambdatosnsstackSnsTopic6292A14A", - }, - }, - ], - "Version": "2012-10-17", - }, - "PolicyName": "lambdatosnsstackLambdaFunctionServiceRoleDefaultPolicy787D809F", - "Roles": Array [ - Object { - "Ref": "lambdatosnsstackLambdaFunctionServiceRole55BFEAA9", - }, - ], - }, - "Type": "AWS::IAM::Policy", - }, - "lambdatosnsstackSnsTopic6292A14A": Object { - "Properties": Object { - "KmsMasterKeyId": Object { - "Ref": "lambdatosnsstackEncryptionKeyF46E3814", - }, + "TopicName": "custom-topic", }, "Type": "AWS::SNS::Topic", }, - "lambdatosnsstackSnsTopicPolicy9C03E2DB": Object { - "Properties": Object { - "PolicyDocument": Object { - "Statement": Array [ - Object { - "Action": Array [ - "SNS:Publish", - "SNS:RemovePermission", - "SNS:SetTopicAttributes", - "SNS:DeleteTopic", - "SNS:ListSubscriptionsByTopic", - "SNS:GetTopicAttributes", - "SNS:Receive", - "SNS:AddPermission", - "SNS:Subscribe", - ], - "Condition": Object { - "StringEquals": Object { - "AWS:SourceOwner": Object { - "Ref": "AWS::AccountId", - }, - }, - }, - "Effect": "Allow", - "Principal": Object { - "AWS": Object { - "Fn::Join": Array [ - "", - Array [ - "arn:", - Object { - "Ref": "AWS::Partition", - }, - ":iam::", - Object { - "Ref": "AWS::AccountId", - }, - ":root", - ], - ], - }, - }, - "Resource": Object { - "Ref": "lambdatosnsstackSnsTopic6292A14A", - }, - "Sid": "TopicOwnerOnlyAccess", - }, - Object { - "Action": Array [ - "SNS:Publish", - "SNS:RemovePermission", - "SNS:SetTopicAttributes", - "SNS:DeleteTopic", - "SNS:ListSubscriptionsByTopic", - "SNS:GetTopicAttributes", - "SNS:Receive", - "SNS:AddPermission", - "SNS:Subscribe", - ], - "Condition": Object { - "Bool": Object { - "aws:SecureTransport": "false", - }, - }, - "Effect": "Deny", - "Principal": "*", - "Resource": Object { - "Ref": "lambdatosnsstackSnsTopic6292A14A", - }, - "Sid": "HttpsOnly", - }, - ], - "Version": "2012-10-17", - }, - "Topics": Array [ - Object { - "Ref": "lambdatosnsstackSnsTopic6292A14A", - }, - ], - }, - "Type": "AWS::SNS::TopicPolicy", - }, - }, -} -`; - -exports[`Test deployment with imported encryption key 1`] = ` -Object { - "Parameters": Object { - "AssetParameters8efd3dd9643a4d64a128ad582cab718a1e464bcc719bbbcf0e7b0481188a0420ArtifactHashA71E92AD": Object { - "Description": "Artifact hash for asset \\"8efd3dd9643a4d64a128ad582cab718a1e464bcc719bbbcf0e7b0481188a0420\\"", - "Type": "String", - }, - "AssetParameters8efd3dd9643a4d64a128ad582cab718a1e464bcc719bbbcf0e7b0481188a0420S3Bucket749AC458": Object { - "Description": "S3 bucket for asset \\"8efd3dd9643a4d64a128ad582cab718a1e464bcc719bbbcf0e7b0481188a0420\\"", - "Type": "String", - }, - "AssetParameters8efd3dd9643a4d64a128ad582cab718a1e464bcc719bbbcf0e7b0481188a0420S3VersionKeyFF5CC16D": Object { - "Description": "S3 key for asset version \\"8efd3dd9643a4d64a128ad582cab718a1e464bcc719bbbcf0e7b0481188a0420\\"", - "Type": "String", - }, - }, - "Resources": Object { - "importedkey38675D68": Object { - "DeletionPolicy": "Retain", - "Properties": Object { - "EnableKeyRotation": false, - "KeyPolicy": Object { - "Statement": Array [ - Object { - "Action": Array [ - "kms:Create*", - "kms:Describe*", - "kms:Enable*", - "kms:List*", - "kms:Put*", - "kms:Update*", - "kms:Revoke*", - "kms:Disable*", - "kms:Get*", - "kms:Delete*", - "kms:ScheduleKeyDeletion", - "kms:CancelKeyDeletion", - "kms:GenerateDataKey", - "kms:TagResource", - "kms:UntagResource", - ], - "Effect": "Allow", - "Principal": Object { - "AWS": Object { - "Fn::Join": Array [ - "", - Array [ - "arn:", - Object { - "Ref": "AWS::Partition", - }, - ":iam::", - Object { - "Ref": "AWS::AccountId", - }, - ":root", - ], - ], - }, - }, - "Resource": "*", - }, - ], - "Version": "2012-10-17", - }, - }, - "Type": "AWS::KMS::Key", - "UpdateReplacePolicy": "Retain", - }, "lambdatosnsstackLambdaFunction84DDA23E": Object { "DependsOn": Array [ "lambdatosnsstackLambdaFunctionServiceRoleDefaultPolicy787D809F", @@ -464,13 +80,13 @@ Object { "Environment": Object { "Variables": Object { "AWS_NODEJS_CONNECTION_REUSE_ENABLED": "1", - "LAMBDA_NAME": "deployed-function-no-enc", + "LAMBDA_NAME": "override-function", "SNS_TOPIC_ARN": Object { - "Ref": "lambdatosnsstackSnsTopic6292A14A", + "Ref": "MyTopic86869434", }, "SNS_TOPIC_NAME": Object { "Fn::GetAtt": Array [ - "lambdatosnsstackSnsTopic6292A14A", + "MyTopic86869434", "TopicName", ], }, @@ -567,7 +183,7 @@ Object { "Action": "sns:Publish", "Effect": "Allow", "Resource": Object { - "Ref": "lambdatosnsstackSnsTopic6292A14A", + "Ref": "MyTopic86869434", }, }, ], @@ -582,96 +198,6 @@ Object { }, "Type": "AWS::IAM::Policy", }, - "lambdatosnsstackSnsTopic6292A14A": Object { - "Properties": Object { - "KmsMasterKeyId": Object { - "Ref": "importedkey38675D68", - }, - }, - "Type": "AWS::SNS::Topic", - }, - "lambdatosnsstackSnsTopicPolicy9C03E2DB": Object { - "Properties": Object { - "PolicyDocument": Object { - "Statement": Array [ - Object { - "Action": Array [ - "SNS:Publish", - "SNS:RemovePermission", - "SNS:SetTopicAttributes", - "SNS:DeleteTopic", - "SNS:ListSubscriptionsByTopic", - "SNS:GetTopicAttributes", - "SNS:Receive", - "SNS:AddPermission", - "SNS:Subscribe", - ], - "Condition": Object { - "StringEquals": Object { - "AWS:SourceOwner": Object { - "Ref": "AWS::AccountId", - }, - }, - }, - "Effect": "Allow", - "Principal": Object { - "AWS": Object { - "Fn::Join": Array [ - "", - Array [ - "arn:", - Object { - "Ref": "AWS::Partition", - }, - ":iam::", - Object { - "Ref": "AWS::AccountId", - }, - ":root", - ], - ], - }, - }, - "Resource": Object { - "Ref": "lambdatosnsstackSnsTopic6292A14A", - }, - "Sid": "TopicOwnerOnlyAccess", - }, - Object { - "Action": Array [ - "SNS:Publish", - "SNS:RemovePermission", - "SNS:SetTopicAttributes", - "SNS:DeleteTopic", - "SNS:ListSubscriptionsByTopic", - "SNS:GetTopicAttributes", - "SNS:Receive", - "SNS:AddPermission", - "SNS:Subscribe", - ], - "Condition": Object { - "Bool": Object { - "aws:SecureTransport": "false", - }, - }, - "Effect": "Deny", - "Principal": "*", - "Resource": Object { - "Ref": "lambdatosnsstackSnsTopic6292A14A", - }, - "Sid": "HttpsOnly", - }, - ], - "Version": "2012-10-17", - }, - "Topics": Array [ - Object { - "Ref": "lambdatosnsstackSnsTopic6292A14A", - }, - ], - }, - "Type": "AWS::SNS::TopicPolicy", - }, }, } `; @@ -693,58 +219,6 @@ Object { }, }, "Resources": Object { - "lambdatosnsstackEncryptionKeyF46E3814": Object { - "DeletionPolicy": "Retain", - "Properties": Object { - "EnableKeyRotation": true, - "KeyPolicy": Object { - "Statement": Array [ - Object { - "Action": Array [ - "kms:Create*", - "kms:Describe*", - "kms:Enable*", - "kms:List*", - "kms:Put*", - "kms:Update*", - "kms:Revoke*", - "kms:Disable*", - "kms:Get*", - "kms:Delete*", - "kms:ScheduleKeyDeletion", - "kms:CancelKeyDeletion", - "kms:GenerateDataKey", - "kms:TagResource", - "kms:UntagResource", - ], - "Effect": "Allow", - "Principal": Object { - "AWS": Object { - "Fn::Join": Array [ - "", - Array [ - "arn:", - Object { - "Ref": "AWS::Partition", - }, - ":iam::", - Object { - "Ref": "AWS::AccountId", - }, - ":root", - ], - ], - }, - }, - "Resource": "*", - }, - ], - "Version": "2012-10-17", - }, - }, - "Type": "AWS::KMS::Key", - "UpdateReplacePolicy": "Retain", - }, "lambdatosnsstackLambdaFunction84DDA23E": Object { "DependsOn": Array [ "lambdatosnsstackLambdaFunctionServiceRoleDefaultPolicy787D809F", @@ -922,9 +396,7 @@ Object { }, "lambdatosnsstackSnsTopic6292A14A": Object { "Properties": Object { - "KmsMasterKeyId": Object { - "Ref": "lambdatosnsstackEncryptionKeyF46E3814", - }, + "KmsMasterKeyId": "alias/aws/sns", }, "Type": "AWS::SNS::Topic", }, diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-sns/test/integ.deployFunction.expected.json b/source/patterns/@aws-solutions-constructs/aws-lambda-sns/test/integ.deployFunction.expected.json index 6394ef3b2..1a43f5b27 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-sns/test/integ.deployFunction.expected.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-sns/test/integ.deployFunction.expected.json @@ -175,64 +175,10 @@ } } }, - "testlambdasnsEncryptionKey57F4E220": { - "Type": "AWS::KMS::Key", - "Properties": { - "KeyPolicy": { - "Statement": [ - { - "Action": [ - "kms:Create*", - "kms:Describe*", - "kms:Enable*", - "kms:List*", - "kms:Put*", - "kms:Update*", - "kms:Revoke*", - "kms:Disable*", - "kms:Get*", - "kms:Delete*", - "kms:ScheduleKeyDeletion", - "kms:CancelKeyDeletion", - "kms:GenerateDataKey", - "kms:TagResource", - "kms:UntagResource" - ], - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - }, - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "EnableKeyRotation": true - }, - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, "testlambdasnsSnsTopic57DFED98": { "Type": "AWS::SNS::Topic", "Properties": { - "KmsMasterKeyId": { - "Ref": "testlambdasnsEncryptionKey57F4E220" - } + "KmsMasterKeyId": "alias/aws/sns" } }, "testlambdasnsSnsTopicPolicy4481ABC3": { diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-sns/test/integ.existingFunction.expected.json b/source/patterns/@aws-solutions-constructs/aws-lambda-sns/test/integ.existingFunction.expected.json index 28146c3f3..8e79d3402 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-sns/test/integ.existingFunction.expected.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-sns/test/integ.existingFunction.expected.json @@ -175,64 +175,10 @@ } } }, - "testlambdasnsEncryptionKey57F4E220": { - "Type": "AWS::KMS::Key", - "Properties": { - "KeyPolicy": { - "Statement": [ - { - "Action": [ - "kms:Create*", - "kms:Describe*", - "kms:Enable*", - "kms:List*", - "kms:Put*", - "kms:Update*", - "kms:Revoke*", - "kms:Disable*", - "kms:Get*", - "kms:Delete*", - "kms:ScheduleKeyDeletion", - "kms:CancelKeyDeletion", - "kms:GenerateDataKey", - "kms:TagResource", - "kms:UntagResource" - ], - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - }, - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "EnableKeyRotation": true - }, - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, "testlambdasnsSnsTopic57DFED98": { "Type": "AWS::SNS::Topic", "Properties": { - "KmsMasterKeyId": { - "Ref": "testlambdasnsEncryptionKey57F4E220" - } + "KmsMasterKeyId": "alias/aws/sns" } }, "testlambdasnsSnsTopicPolicy4481ABC3": { diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-sns/test/lambda-sns.test.ts b/source/patterns/@aws-solutions-constructs/aws-lambda-sns/test/lambda-sns.test.ts index 1ffd2b6c3..601abc04a 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-sns/test/lambda-sns.test.ts +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-sns/test/lambda-sns.test.ts @@ -13,10 +13,10 @@ // Imports import { Stack } from "@aws-cdk/core"; -import * as kms from "@aws-cdk/aws-kms"; import * as lambda from "@aws-cdk/aws-lambda"; -import { LambdaToSns } from '../lib'; -import { SynthUtils } from '@aws-cdk/assert'; +import * as sns from "@aws-cdk/aws-sns"; +import { LambdaToSns, LambdaToSnsProps } from '../lib'; +import { SynthUtils, expect as expectCDK, haveResource } from '@aws-cdk/assert'; import '@aws-cdk/assert/jest'; // -------------------------------------------------------------- @@ -46,18 +46,22 @@ test('Test deployment with new Lambda function', () => { } } }); - // Assertion 3 - expect(stack).toHaveResource("AWS::KMS::Key", { - EnableKeyRotation: true + expect(stack).toHaveResource("AWS::SNS::Topic", { + KmsMasterKeyId: "alias/aws/sns" }); }); // -------------------------------------------------------------- -// Test deployment with existing Lambda function +// Test deployment with existing existingTopicObj // -------------------------------------------------------------- -test('Test deployment with existing Lambda function', () => { +test('Test deployment with existing existingTopicObj', () => { // Stack const stack = new Stack(); + + const topic = new sns.Topic(stack, 'MyTopic', { + topicName: "custom-topic" + }); + // Helper declaration new LambdaToSns(stack, 'lambda-to-sns-stack', { lambdaFunctionProps: { @@ -67,61 +71,39 @@ test('Test deployment with existing Lambda function', () => { environment: { LAMBDA_NAME: 'override-function' } - } + }, + existingTopicObj: topic }); // Assertion 1 expect(SynthUtils.toCloudFormation(stack)).toMatchSnapshot(); // Assertion 2 - expect(stack).toHaveResourceLike("AWS::Lambda::Function", { - Environment: { - Variables: { - LAMBDA_NAME: 'override-function' - } - } - }); - // Assertion 3 - expect(stack).toHaveResource("AWS::KMS::Key", { - EnableKeyRotation: true - }); + expectCDK(stack).to(haveResource("AWS::SNS::Topic", { + TopicName: "custom-topic" + })); }); // -------------------------------------------------------------- // Test deployment with imported encryption key // -------------------------------------------------------------- -test('Test deployment with imported encryption key', () => { - // Stack +test('override topicProps', () => { const stack = new Stack(); - // Setup - const kmsKey = new kms.Key(stack, 'imported-key', { - enableKeyRotation: false - }); - // Helper declaration - new LambdaToSns(stack, 'lambda-to-sns-stack', { + + const props: LambdaToSnsProps = { lambdaFunctionProps: { - runtime: lambda.Runtime.NODEJS_10_X, - handler: 'index.handler', - code: lambda.Code.asset(`${__dirname}/lambda`), - environment: { - LAMBDA_NAME: 'deployed-function-no-enc' - } + code: lambda.Code.asset(`${__dirname}/lambda`), + runtime: lambda.Runtime.NODEJS_12_X, + handler: 'index.handler' }, - enableEncryption: true, - encryptionKey: kmsKey - }); - // Assertion 1 - expect(SynthUtils.toCloudFormation(stack)).toMatchSnapshot(); - // Assertion 2 - expect(stack).toHaveResourceLike("AWS::Lambda::Function", { - Environment: { - Variables: { - LAMBDA_NAME: 'deployed-function-no-enc' - } + topicProps: { + topicName: "custom-topic" } - }); - // Assertion 3 - expect(stack).toHaveResource("AWS::KMS::Key", { - EnableKeyRotation: false - }); + }; + + new LambdaToSns(stack, 'test-sns-lambda', props); + + expectCDK(stack).to(haveResource("AWS::SNS::Topic", { + TopicName: "custom-topic" + })); }); // -------------------------------------------------------------- @@ -144,5 +126,4 @@ test('Test the properties', () => { // Assertion 2 const topic = pattern.snsTopic; expect(topic !== null); - expect(pattern.encryptionKey != null); }); \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-sqs-lambda/README.md b/source/patterns/@aws-solutions-constructs/aws-lambda-sqs-lambda/README.md index f327d012b..f8a331845 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-sqs-lambda/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-sqs-lambda/README.md @@ -24,12 +24,12 @@ This AWS Solutions Construct implements (1) an AWS Lambda function that is configured to send messages to a queue; (2) an Amazon SQS queue; and (3) an AWS Lambda function configured to consume messages from the queue. -Here is a minimal deployable pattern definition: +Here is a minimal deployable pattern definition in Typescript: ``` javascript -const { LambdaToSqsToLambda } = require('@aws-solutions-constructs/aws-lambda-sqs-lambda'); +import { LambdaToSqsToLambda, LambdaToSqsToLambdaProps } from "@aws-solutions-constructs/aws-lambda-sqs-lambda"; -new LambdaToSqsToLambda(stack, 'LambdaToSqsToLambdaPattern', { +new LambdaToSqsToLambda(this, 'LambdaToSqsToLambdaPattern', { producerLambdaFunctionProps: { runtime: lambda.Runtime.NODEJS_12_X, handler: 'index.handler', diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-sqs-lambda/package.json b/source/patterns/@aws-solutions-constructs/aws-lambda-sqs-lambda/package.json index c76603ac2..19125510f 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-sqs-lambda/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-sqs-lambda/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-lambda-sqs-lambda", - "version": "1.61.0", + "version": "1.61.1", "description": "CDK construct that provisions (1) an AWS Lambda function that is configured to send messages to a queue; (2) an Amazon SQS queue; and (3) an AWS Lambda function configured to consume messages from the queue.", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -53,16 +53,16 @@ } }, "dependencies": { - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-sqs": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", - "@aws-solutions-constructs/aws-lambda-sqs": "~1.61.0", - "@aws-solutions-constructs/aws-sqs-lambda": "~1.61.0", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-sqs": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", + "@aws-solutions-constructs/aws-lambda-sqs": "~1.61.1", + "@aws-solutions-constructs/aws-sqs-lambda": "~1.61.1", "constructs": "^3.0.4" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, @@ -72,12 +72,12 @@ ] }, "peerDependencies": { - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-sqs": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", - "@aws-solutions-constructs/aws-lambda-sqs": "~1.61.0", - "@aws-solutions-constructs/aws-sqs-lambda": "~1.61.0", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-sqs": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", + "@aws-solutions-constructs/aws-lambda-sqs": "~1.61.1", + "@aws-solutions-constructs/aws-sqs-lambda": "~1.61.1", "constructs": "^3.0.4" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-sqs-lambda/test/integ.existingQueue.ts b/source/patterns/@aws-solutions-constructs/aws-lambda-sqs-lambda/test/integ.existingQueue.ts index 7ffabd569..f7c471694 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-sqs-lambda/test/integ.existingQueue.ts +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-sqs-lambda/test/integ.existingQueue.ts @@ -23,7 +23,7 @@ const stack = new Stack(app, 'test-lambda-sqs-lambda'); stack.templateOptions.description = 'Integration Test for aws-lambda-sqs-lambda'; // Definitions -const existingQueue = defaults.buildQueue(stack, 'existing-sqs-queue'); +const [existingQueue] = defaults.buildQueue(stack, 'existing-sqs-queue', {}); const props: LambdaToSqsToLambdaProps = { producerLambdaFunctionProps: { diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-sqs-lambda/test/lambda-sqs-lambda.test.ts b/source/patterns/@aws-solutions-constructs/aws-lambda-sqs-lambda/test/lambda-sqs-lambda.test.ts index 0c2cb8bca..7df3207f2 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-sqs-lambda/test/lambda-sqs-lambda.test.ts +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-sqs-lambda/test/lambda-sqs-lambda.test.ts @@ -200,7 +200,7 @@ test('Test deployment w/ existing queue', () => { // Stack const stack = new Stack(); // Define existing resources - const existingQueue = defaults.buildQueue(stack, 'existing-queue', { + const [existingQueue] = defaults.buildQueue(stack, 'existing-queue', { queueProps: { queueName: 'existing-queue' } diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-sqs/README.md b/source/patterns/@aws-solutions-constructs/aws-lambda-sqs/README.md index 8f65ecb95..f00819d91 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-sqs/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-sqs/README.md @@ -24,14 +24,14 @@ This AWS Solutions Construct implements an AWS Lambda function connected to an Amazon SQS queue. -Here is a minimal deployable pattern definition: +Here is a minimal deployable pattern definition in Typescript: ``` javascript -const { LambdaToSqs } = require('@aws-solutions-constructs/aws-lambda-sqs'); +import { LambdaToSqs, LambdaToSqsProps } from "@aws-solutions-constructs/aws-lambda-sqs"; -new LambdaToSqs(stack, 'LambdaToSqsPattern', { +new LambdaToSqs(this, 'LambdaToSqsPattern', { lambdaFunctionProps: { - runtime: lambda.Runtime.NODEJS_10_X, + runtime: lambda.Runtime.NODEJS_12_X, handler: 'index.handler', code: lambda.Code.asset(`${__dirname}/lambda`) } diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-sqs/lib/index.ts b/source/patterns/@aws-solutions-constructs/aws-lambda-sqs/lib/index.ts index f7f2ecb7b..1aa582b61 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-sqs/lib/index.ts +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-sqs/lib/index.ts @@ -98,7 +98,7 @@ export class LambdaToSqs extends Construct { // Setup a dead letter queue, if applicable if (props.deployDeadLetterQueue || props.deployDeadLetterQueue === undefined) { - const dlq: sqs.Queue = defaults.buildQueue(this, 'deadLetterQueue', { + const [dlq] = defaults.buildQueue(this, 'deadLetterQueue', { queueProps: props.deadLetterQueueProps }); this.deadLetterQueue = defaults.buildDeadLetterQueue({ @@ -108,7 +108,7 @@ export class LambdaToSqs extends Construct { } // Setup the queue - this.sqsQueue = defaults.buildQueue(this, 'queue', { + [this.sqsQueue] = defaults.buildQueue(this, 'queue', { existingQueueObj: props.existingQueueObj, queueProps: props.queueProps, deadLetterQueue: this.deadLetterQueue diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-sqs/package.json b/source/patterns/@aws-solutions-constructs/aws-lambda-sqs/package.json index 2942ca5c0..e5fe89f1c 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-sqs/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-sqs/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-lambda-sqs", - "version": "1.61.0", + "version": "1.61.1", "description": "CDK constructs for defining an interaction between an AWS Lambda function and an Amazon SQS queue.", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -53,14 +53,14 @@ } }, "dependencies": { - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-sqs": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-sqs": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, @@ -70,10 +70,10 @@ ] }, "peerDependencies": { - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-sqs": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-sqs": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-step-function/package.json b/source/patterns/@aws-solutions-constructs/aws-lambda-step-function/package.json index bc542d00d..3cfb454ac 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-step-function/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-step-function/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-lambda-step-function", - "version": "1.61.0", + "version": "1.61.1", "description": "CDK constructs for defining an interaction between an AWS Lambda function and an AWS Step Function.", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -53,16 +53,16 @@ } }, "dependencies": { - "@aws-cdk/aws-cloudwatch": "~1.61.0", - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-stepfunctions": "~1.61.0", - "@aws-cdk/aws-logs": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-cloudwatch": "~1.61.1", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-stepfunctions": "~1.61.1", + "@aws-cdk/aws-logs": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0", "eslint-plugin-import": "^2.22.0" @@ -73,12 +73,12 @@ ] }, "peerDependencies": { - "@aws-cdk/aws-cloudwatch": "~1.61.0", - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-stepfunctions": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-cloudwatch": "~1.61.1", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-stepfunctions": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4", - "@aws-cdk/aws-logs": "~1.61.0" + "@aws-cdk/aws-logs": "~1.61.1" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/package.json b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/package.json index 77a680246..91f152cba 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-s3-lambda", - "version": "1.61.0", + "version": "1.61.1", "description": "CDK Constructs for AWS S3 to AWS Lambda integration", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -53,17 +53,17 @@ } }, "dependencies": { - "@aws-cdk/aws-s3": "~1.61.0", - "@aws-cdk/aws-s3-notifications": "~1.61.0", - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-lambda-event-sources": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-s3": "~1.61.1", + "@aws-cdk/aws-s3-notifications": "~1.61.1", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-lambda-event-sources": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, @@ -73,13 +73,13 @@ ] }, "peerDependencies": { - "@aws-cdk/aws-s3": "~1.61.0", - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", - "@aws-cdk/aws-lambda-event-sources": "~1.61.0", - "@aws-cdk/aws-s3-notifications": "~1.61.0", + "@aws-cdk/aws-s3": "~1.61.1", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", + "@aws-cdk/aws-lambda-event-sources": "~1.61.1", + "@aws-cdk/aws-s3-notifications": "~1.61.1", "constructs": "^3.0.4" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-step-function/package.json b/source/patterns/@aws-solutions-constructs/aws-s3-step-function/package.json index ffa8586eb..eaace7b04 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-step-function/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-step-function/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-s3-step-function", - "version": "1.61.0", + "version": "1.61.1", "description": "CDK Constructs for AWS S3 to AWS Step Function integration", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -53,22 +53,22 @@ } }, "dependencies": { - "@aws-cdk/aws-stepfunctions": "~1.61.0", - "@aws-cdk/aws-stepfunctions-tasks": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-cdk/aws-s3": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-cloudwatch": "~1.61.0", - "@aws-cdk/aws-cloudtrail": "~1.61.0", - "@aws-cdk/aws-events": "~1.61.0", - "@aws-cdk/aws-logs": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", - "@aws-solutions-constructs/aws-events-rule-step-function": "~1.61.0", + "@aws-cdk/aws-stepfunctions": "~1.61.1", + "@aws-cdk/aws-stepfunctions-tasks": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-cdk/aws-s3": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-cloudwatch": "~1.61.1", + "@aws-cdk/aws-cloudtrail": "~1.61.1", + "@aws-cdk/aws-events": "~1.61.1", + "@aws-cdk/aws-logs": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", + "@aws-solutions-constructs/aws-events-rule-step-function": "~1.61.1", "constructs": "^3.0.4" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, @@ -78,18 +78,18 @@ ] }, "peerDependencies": { - "@aws-cdk/aws-stepfunctions": "~1.61.0", - "@aws-cdk/aws-stepfunctions-tasks": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-cdk/aws-s3": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-cloudwatch": "~1.61.0", - "@aws-cdk/aws-cloudtrail": "~1.61.0", - "@aws-cdk/aws-events": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", - "@aws-solutions-constructs/aws-events-rule-step-function": "~1.61.0", + "@aws-cdk/aws-stepfunctions": "~1.61.1", + "@aws-cdk/aws-stepfunctions-tasks": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-cdk/aws-s3": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-cloudwatch": "~1.61.1", + "@aws-cdk/aws-cloudtrail": "~1.61.1", + "@aws-cdk/aws-events": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", + "@aws-solutions-constructs/aws-events-rule-step-function": "~1.61.1", "constructs": "^3.0.4", - "@aws-cdk/aws-logs": "~1.61.0" + "@aws-cdk/aws-logs": "~1.61.1" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-sns-lambda/README.md b/source/patterns/@aws-solutions-constructs/aws-sns-lambda/README.md index c92b5764d..70139468a 100644 --- a/source/patterns/@aws-solutions-constructs/aws-sns-lambda/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-sns-lambda/README.md @@ -24,14 +24,11 @@ This AWS Solutions Construct implements an Amazon SNS connected to an AWS Lambda function. -Here is a minimal deployable pattern definition: +Here is a minimal deployable pattern definition in Typescript: ``` javascript -const { SnsToLambdaProps, SnsToLambda } = require('@aws-solutions-constructs/aws-sns-lambda'); +import { SnsToLambda, SnsToLambdaProps } from "@aws-solutions-constructs/aws-sns-lambda"; -const stack = new Stack(app, 'test-sns-lambda'); - -// Definitions const props: SnsToLambdaProps = { lambdaFunctionProps: { runtime: lambda.Runtime.NODEJS_12_X, @@ -40,7 +37,7 @@ const props: SnsToLambdaProps = { } }; -new SnsToLambda(stack, 'test-sns-lambda', props); +new SnsToLambda(this, 'test-sns-lambda', props); ``` @@ -62,9 +59,8 @@ _Parameters_ |:-------------|:----------------|-----------------| |existingLambdaObj?|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.Function.html)|Existing instance of Lambda Function object, if this is set then the lambdaFunctionProps is ignored.| |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.| +|existingTopicObj?|[`sns.Topic`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.Function.html)|Existing instance of SNS Topic object, if this is set then the topicProps is ignored.| |topicProps?|[`sns.TopicProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-sns.TopicProps.html)|Optional user provided properties to override the default properties for the SNS topic.| -|enableEncryption?|`boolean`|Use a KMS Key, either managed by this CDK app, or imported. If importing an encryption key, it must be specified in the encryptionKey property for this construct.| -|encryptionKey?|[`kms.Key`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-kms.Key.html)|An optional, imported encryption key to encrypt the SNS topic with.| ## Pattern Properties @@ -72,7 +68,6 @@ _Parameters_ |:-------------|:----------------|-----------------| |lambdaFunction|[`lambda.Function`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.Function.html)|Returns an instance of the Lambda function created by the pattern.| |snsTopic|[`sns.Topic`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-sns.Topic.html)|Returns an instance of the SNS topic created by the pattern.| -|encryptionKey|[`kms.Key`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-kms.Key.html)|Returns an instance of kms.Key used for the SNS topic.| ## Default settings @@ -80,7 +75,7 @@ Out of the box implementation of the Construct without any override will set the ### Amazon SNS Topic * Configure least privilege access permissions for SNS Topic -* Enable server-side encryption forSNS Topic using Customer managed KMS Key +* Enable server-side encryption for SNS Topic using AWS managed KMS Key * Enforce encryption of data in transit ### AWS Lambda Function diff --git a/source/patterns/@aws-solutions-constructs/aws-sns-lambda/lib/index.ts b/source/patterns/@aws-solutions-constructs/aws-sns-lambda/lib/index.ts index d18c0342c..1e18b8be4 100644 --- a/source/patterns/@aws-solutions-constructs/aws-sns-lambda/lib/index.ts +++ b/source/patterns/@aws-solutions-constructs/aws-sns-lambda/lib/index.ts @@ -13,7 +13,6 @@ import * as lambda from '@aws-cdk/aws-lambda'; import * as sns from '@aws-cdk/aws-sns'; -import * as kms from '@aws-cdk/aws-kms'; import * as defaults from '@aws-solutions-constructs/core'; import { Construct } from '@aws-cdk/core'; import { SnsEventSource } from '@aws-cdk/aws-lambda-event-sources'; @@ -35,24 +34,17 @@ export interface SnsToLambdaProps { */ readonly lambdaFunctionProps?: lambda.FunctionProps, /** - * Optional user provided properties to override the default properties for the SNS topic. + * Existing instance of SNS Topic object, if this is set then topicProps is ignored. * - * @default - Default properties are used. + * @default - Default props are used */ - readonly topicProps?: sns.TopicProps, + readonly existingTopicObj?: sns.Topic, /** - * Use a KMS Key, either managed by this CDK app, or imported. If importing an encryption key, it must be specified in - * the encryptionKey property for this construct. - * - * @default - true (encryption enabled, managed by this CDK app). - */ - readonly enableEncryption?: boolean - /** - * An optional, imported encryption key to encrypt the SNS topic with. + * Optional user provided properties to override the default properties for the SNS topic. * - * @default - not specified. + * @default - Default properties are used. */ - readonly encryptionKey?: kms.Key + readonly topicProps?: sns.TopicProps } /** @@ -61,7 +53,6 @@ export interface SnsToLambdaProps { export class SnsToLambda extends Construct { public readonly lambdaFunction: lambda.Function; public readonly snsTopic: sns.Topic; - public readonly encryptionKey: kms.Key; /** * @summary Constructs a new instance of the LambdaToSns class. @@ -81,9 +72,9 @@ export class SnsToLambda extends Construct { }); // Setup the SNS topic - [this.snsTopic, this.encryptionKey] = defaults.buildTopic(this, { - enableEncryption: props.enableEncryption, - encryptionKey: props.encryptionKey + [this.snsTopic] = defaults.buildTopic(this, { + existingTopicObj: props.existingTopicObj, + topicProps: props.topicProps }); this.lambdaFunction.addEventSource(new SnsEventSource(this.snsTopic)); diff --git a/source/patterns/@aws-solutions-constructs/aws-sns-lambda/package.json b/source/patterns/@aws-solutions-constructs/aws-sns-lambda/package.json index 130efc4bd..41e2662bb 100644 --- a/source/patterns/@aws-solutions-constructs/aws-sns-lambda/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-sns-lambda/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-sns-lambda", - "version": "1.61.0", + "version": "1.61.1", "description": "CDK Constructs for AWS SNS to AWS Lambda integration", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -53,17 +53,17 @@ } }, "dependencies": { - "@aws-cdk/aws-sns": "~1.61.0", - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-lambda-event-sources": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-cdk/aws-kms": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-sns": "~1.61.1", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-lambda-event-sources": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-cdk/aws-kms": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, @@ -73,13 +73,13 @@ ] }, "peerDependencies": { - "@aws-cdk/aws-sns": "~1.61.0", - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-lambda-event-sources": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", - "@aws-cdk/aws-kms": "~1.61.0", + "@aws-cdk/aws-sns": "~1.61.1", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-lambda-event-sources": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", + "@aws-cdk/aws-kms": "~1.61.1", "constructs": "^3.0.4" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-sns-lambda/test/__snapshots__/sns-lambda.test.js.snap b/source/patterns/@aws-solutions-constructs/aws-sns-lambda/test/__snapshots__/sns-lambda.test.js.snap index 9f38e5f00..e367fabba 100644 --- a/source/patterns/@aws-solutions-constructs/aws-sns-lambda/test/__snapshots__/sns-lambda.test.js.snap +++ b/source/patterns/@aws-solutions-constructs/aws-sns-lambda/test/__snapshots__/sns-lambda.test.js.snap @@ -17,58 +17,6 @@ Object { }, }, "Resources": Object { - "testsnslambdaEncryptionKeyDDDF040B": Object { - "DeletionPolicy": "Retain", - "Properties": Object { - "EnableKeyRotation": true, - "KeyPolicy": Object { - "Statement": Array [ - Object { - "Action": Array [ - "kms:Create*", - "kms:Describe*", - "kms:Enable*", - "kms:List*", - "kms:Put*", - "kms:Update*", - "kms:Revoke*", - "kms:Disable*", - "kms:Get*", - "kms:Delete*", - "kms:ScheduleKeyDeletion", - "kms:CancelKeyDeletion", - "kms:GenerateDataKey", - "kms:TagResource", - "kms:UntagResource", - ], - "Effect": "Allow", - "Principal": Object { - "AWS": Object { - "Fn::Join": Array [ - "", - Array [ - "arn:", - Object { - "Ref": "AWS::Partition", - }, - ":iam::", - Object { - "Ref": "AWS::AccountId", - }, - ":root", - ], - ], - }, - }, - "Resource": "*", - }, - ], - "Version": "2012-10-17", - }, - }, - "Type": "AWS::KMS::Key", - "UpdateReplacePolicy": "Retain", - }, "testsnslambdaLambdaFunctionAllowInvoketestsnslambdaSnsTopicEB0543A09281910D": Object { "Properties": Object { "Action": "lambda:InvokeFunction", @@ -260,9 +208,7 @@ Object { }, "testsnslambdaSnsTopic52CA159E": Object { "Properties": Object { - "KmsMasterKeyId": Object { - "Ref": "testsnslambdaEncryptionKeyDDDF040B", - }, + "KmsMasterKeyId": "alias/aws/sns", }, "Type": "AWS::SNS::Topic", }, diff --git a/source/patterns/@aws-solutions-constructs/aws-sns-lambda/test/integ.no-arguments.expected.json b/source/patterns/@aws-solutions-constructs/aws-sns-lambda/test/integ.no-arguments.expected.json index cb54c2575..b284885b6 100644 --- a/source/patterns/@aws-solutions-constructs/aws-sns-lambda/test/integ.no-arguments.expected.json +++ b/source/patterns/@aws-solutions-constructs/aws-sns-lambda/test/integ.no-arguments.expected.json @@ -190,64 +190,10 @@ } } }, - "testsnslambdaEncryptionKeyDDDF040B": { - "Type": "AWS::KMS::Key", - "Properties": { - "KeyPolicy": { - "Statement": [ - { - "Action": [ - "kms:Create*", - "kms:Describe*", - "kms:Enable*", - "kms:List*", - "kms:Put*", - "kms:Update*", - "kms:Revoke*", - "kms:Disable*", - "kms:Get*", - "kms:Delete*", - "kms:ScheduleKeyDeletion", - "kms:CancelKeyDeletion", - "kms:GenerateDataKey", - "kms:TagResource", - "kms:UntagResource" - ], - "Effect": "Allow", - "Principal": { - "AWS": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::", - { - "Ref": "AWS::AccountId" - }, - ":root" - ] - ] - } - }, - "Resource": "*" - } - ], - "Version": "2012-10-17" - }, - "EnableKeyRotation": true - }, - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, "testsnslambdaSnsTopic52CA159E": { "Type": "AWS::SNS::Topic", "Properties": { - "KmsMasterKeyId": { - "Ref": "testsnslambdaEncryptionKeyDDDF040B" - } + "KmsMasterKeyId": "alias/aws/sns" } }, "testsnslambdaSnsTopicPolicyDA4647EB": { diff --git a/source/patterns/@aws-solutions-constructs/aws-sns-lambda/test/sns-lambda.test.ts b/source/patterns/@aws-solutions-constructs/aws-sns-lambda/test/sns-lambda.test.ts index 63d17b01e..1d87129fa 100644 --- a/source/patterns/@aws-solutions-constructs/aws-sns-lambda/test/sns-lambda.test.ts +++ b/source/patterns/@aws-solutions-constructs/aws-sns-lambda/test/sns-lambda.test.ts @@ -11,9 +11,10 @@ * and limitations under the License. */ -import { SynthUtils } from '@aws-cdk/assert'; +import { SynthUtils, expect as expectCDK, haveResource } from '@aws-cdk/assert'; import { SnsToLambda, SnsToLambdaProps } from "../lib"; import * as lambda from '@aws-cdk/aws-lambda'; +import * as sns from '@aws-cdk/aws-sns'; import * as cdk from "@aws-cdk/core"; import '@aws-cdk/assert/jest'; @@ -42,5 +43,48 @@ test('check properties', () => { expect(construct.lambdaFunction !== null); expect(construct.snsTopic !== null); - expect(construct.encryptionKey !== null); +}); + +test('override topicProps', () => { + const stack = new cdk.Stack(); + + const props: SnsToLambdaProps = { + lambdaFunctionProps: { + code: lambda.Code.asset(`${__dirname}/lambda`), + runtime: lambda.Runtime.NODEJS_12_X, + handler: 'index.handler' + }, + topicProps: { + topicName: "custom-topic" + } + }; + + new SnsToLambda(stack, 'test-sns-lambda', props); + + expectCDK(stack).to(haveResource("AWS::SNS::Topic", { + TopicName: "custom-topic" + })); +}); + +test('provide existingTopicObj', () => { + const stack = new cdk.Stack(); + + const topic = new sns.Topic(stack, 'MyTopic', { + topicName: "custom-topic" + }); + + const props: SnsToLambdaProps = { + lambdaFunctionProps: { + code: lambda.Code.asset(`${__dirname}/lambda`), + runtime: lambda.Runtime.NODEJS_12_X, + handler: 'index.handler' + }, + existingTopicObj: topic + }; + + new SnsToLambda(stack, 'test-sns-lambda', props); + + expectCDK(stack).to(haveResource("AWS::SNS::Topic", { + TopicName: "custom-topic" + })); }); \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-sns-sqs/README.md b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/README.md index 41b48c6a2..14086f1b2 100644 --- a/source/patterns/@aws-solutions-constructs/aws-sns-sqs/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/README.md @@ -24,14 +24,25 @@ This AWS Solutions Construct implements an Amazon SNS topic connected to an Amazon SQS queue. -Here is a minimal deployable pattern definition: +Here is a minimal deployable pattern definition in Typescript: ``` javascript -const { SnsToSqs } = require('@aws-solutions-constructs/aws-sns-sqs'); +import { SnsToSqs, SnsToSqsProps } from "@aws-solutions-constructs/aws-sns-sqs"; +import * as iam from '@aws-cdk/aws-iam'; const props: SnsToSqsProps = {}; -new SnsToSqs(stack, 'SnsToSqsPattern', props); +const snsToSqsStack = new SnsToSqs(this, 'SnsToSqsPattern', props); + +// Grant yourself permissions to use the Customer Managed KMS Key +const policyStatement = new iam.PolicyStatement({ + actions: ["kms:Encrypt", "kms:Decrypt"], + effect: iam.Effect.ALLOW, + principals: [ new iam.AccountRootPrincipal() ], + resources: [ "*" ] +}); + +snsToSqsStack.encryptionKey?.addToResourcePolicy(policyStatement); ``` diff --git a/source/patterns/@aws-solutions-constructs/aws-sns-sqs/lib/index.ts b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/lib/index.ts index af39074ce..8eeaf8db5 100644 --- a/source/patterns/@aws-solutions-constructs/aws-sns-sqs/lib/index.ts +++ b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/lib/index.ts @@ -102,7 +102,7 @@ export class SnsToSqs extends Construct { * @param {cdk.App} scope - represents the scope for all the resources. * @param {string} id - this is a a scope-unique id. * @param {SnsToSqsProps} props - user provided props for the construct. - * @since 1.61.0 + * @since 1.62.0 * @access public */ constructor(scope: Construct, id: string, props: SnsToSqsProps) { @@ -110,7 +110,7 @@ export class SnsToSqs extends Construct { // Setup the dead letter queue, if applicable if (props.deployDeadLetterQueue || props.deployDeadLetterQueue === undefined) { - const dlq: sqs.Queue = defaults.buildQueue(this, 'deadLetterQueue', { + const [dlq] = defaults.buildQueue(this, 'deadLetterQueue', { queueProps: props.deadLetterQueueProps }); this.deadLetterQueue = defaults.buildDeadLetterQueue({ @@ -119,17 +119,15 @@ export class SnsToSqs extends Construct { }); } - let enableEncryptionParam:boolean | undefined = props.enableEncryptionWithCustomerManagedKey; - let encryptionKeyParam:kms.Key | undefined = props.encryptionKey; + let enableEncryptionParam = props.enableEncryptionWithCustomerManagedKey; + let encryptionKeyParam = props.encryptionKey; if (props.enableEncryptionWithCustomerManagedKey === undefined || props.enableEncryptionWithCustomerManagedKey === true) { enableEncryptionParam = true; // Create the encryptionKey if none was provided if (!props.encryptionKey) { - encryptionKeyParam = buildEncryptionKey(scope, { - encryptionKeyProps: props.encryptionKeyProps - }); + encryptionKeyParam = buildEncryptionKey(scope, props.encryptionKeyProps); } } // Setup the SNS topic @@ -137,7 +135,7 @@ export class SnsToSqs extends Construct { // If an existingTopicObj was not specified create new topic [this.snsTopic, this.encryptionKey] = defaults.buildTopic(this, { topicProps: props.topicProps, - enableEncryption: enableEncryptionParam, + enableEncryptionWithCustomerManagedKey: enableEncryptionParam, encryptionKey: encryptionKeyParam }); } else { @@ -146,11 +144,11 @@ export class SnsToSqs extends Construct { } // Setup the queue - this.sqsQueue = defaults.buildQueue(this, 'queue', { + [this.sqsQueue] = defaults.buildQueue(this, 'queue', { existingQueueObj: props.existingQueueObj, queueProps: props.queueProps, deadLetterQueue: this.deadLetterQueue, - enableEncryption: enableEncryptionParam, + enableEncryptionWithCustomerManagedKey: enableEncryptionParam, encryptionKey: encryptionKeyParam }); diff --git a/source/patterns/@aws-solutions-constructs/aws-sns-sqs/package.json b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/package.json index f79f4484d..db5febbe1 100644 --- a/source/patterns/@aws-solutions-constructs/aws-sns-sqs/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-sns-sqs", - "version": "1.61.0", + "version": "1.61.1", "description": "CDK constructs for defining an interaction between an Amazon SNS topic and an Amazon SQS queue.", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -53,17 +53,17 @@ } }, "dependencies": { - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-cdk/aws-sns": "~1.61.0", - "@aws-cdk/aws-sqs": "~1.61.0", - "@aws-cdk/aws-sns-subscriptions": "~1.61.0", - "@aws-cdk/aws-kms": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-cdk/aws-sns": "~1.61.1", + "@aws-cdk/aws-sqs": "~1.61.1", + "@aws-cdk/aws-sns-subscriptions": "~1.61.1", + "@aws-cdk/aws-kms": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, @@ -73,13 +73,13 @@ ] }, "peerDependencies": { - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-cdk/aws-sns": "~1.61.0", - "@aws-cdk/aws-sqs": "~1.61.0", - "@aws-cdk/aws-sns-subscriptions": "~1.61.0", - "@aws-cdk/aws-kms": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-cdk/aws-sns": "~1.61.1", + "@aws-cdk/aws-sqs": "~1.61.1", + "@aws-cdk/aws-sns-subscriptions": "~1.61.1", + "@aws-cdk/aws-kms": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.existing-kms-key.ts b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.existing-kms-key.ts index 5ecdb5db0..8b95776e1 100644 --- a/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.existing-kms-key.ts +++ b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.existing-kms-key.ts @@ -26,7 +26,7 @@ stack.templateOptions.description = 'Integration Test for aws-sns-sqs with exist const encryptionKeyProps: KeyProps = { enableKeyRotation: true }; -let key = new kms.Key(stack, 'ImportedEncryptionKey', encryptionKeyProps); +const key = new kms.Key(stack, 'ImportedEncryptionKey', encryptionKeyProps); const props: SnsToSqsProps = { enableEncryptionWithCustomerManagedKey: true, encryptionKey: key diff --git a/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.no-arguments.expected.json b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.no-arguments.expected.json index 72400a6d2..e57c7067a 100644 --- a/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.no-arguments.expected.json +++ b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.no-arguments.expected.json @@ -1,13 +1,13 @@ { "Description": "Integration Test for aws-sns-sqs", "Resources": { - "testsnssqsdeadLetterQueue8DACC0A1": { + "testsnssqsstackdeadLetterQueue83D183F2": { "Type": "AWS::SQS::Queue", "Properties": { "KmsMasterKeyId": "alias/aws/sqs" } }, - "testsnssqsdeadLetterQueuePolicyAB8A9883": { + "testsnssqsstackdeadLetterQueuePolicy388F06A8": { "Type": "AWS::SQS::QueuePolicy", "Properties": { "PolicyDocument": { @@ -43,7 +43,7 @@ }, "Resource": { "Fn::GetAtt": [ - "testsnssqsdeadLetterQueue8DACC0A1", + "testsnssqsstackdeadLetterQueue83D183F2", "Arn" ] }, @@ -60,7 +60,7 @@ "Principal": "*", "Resource": { "Fn::GetAtt": [ - "testsnssqsdeadLetterQueue8DACC0A1", + "testsnssqsstackdeadLetterQueue83D183F2", "Arn" ] }, @@ -71,12 +71,12 @@ }, "Queues": [ { - "Ref": "testsnssqsdeadLetterQueue8DACC0A1" + "Ref": "testsnssqsstackdeadLetterQueue83D183F2" } ] } }, - "testsnssqsSnsTopic2CD0065B": { + "testsnssqsstackSnsTopic92693DD8": { "Type": "AWS::SNS::Topic", "Properties": { "KmsMasterKeyId": { @@ -84,7 +84,7 @@ } } }, - "testsnssqsSnsTopicPolicy604079F2": { + "testsnssqsstackSnsTopicPolicyBD0740CC": { "Type": "AWS::SNS::TopicPolicy", "Properties": { "PolicyDocument": { @@ -128,7 +128,7 @@ } }, "Resource": { - "Ref": "testsnssqsSnsTopic2CD0065B" + "Ref": "testsnssqsstackSnsTopic92693DD8" }, "Sid": "TopicOwnerOnlyAccess" }, @@ -152,7 +152,7 @@ "Effect": "Deny", "Principal": "*", "Resource": { - "Ref": "testsnssqsSnsTopic2CD0065B" + "Ref": "testsnssqsstackSnsTopic92693DD8" }, "Sid": "HttpsOnly" } @@ -161,12 +161,12 @@ }, "Topics": [ { - "Ref": "testsnssqsSnsTopic2CD0065B" + "Ref": "testsnssqsstackSnsTopic92693DD8" } ] } }, - "testsnssqsqueueB02504BF": { + "testsnssqsstackqueue908D8D48": { "Type": "AWS::SQS::Queue", "Properties": { "KmsMasterKeyId": { @@ -178,7 +178,7 @@ "RedrivePolicy": { "deadLetterTargetArn": { "Fn::GetAtt": [ - "testsnssqsdeadLetterQueue8DACC0A1", + "testsnssqsstackdeadLetterQueue83D183F2", "Arn" ] }, @@ -186,7 +186,7 @@ } } }, - "testsnssqsqueuePolicyE64464B6": { + "testsnssqsstackqueuePolicyFD3F4725": { "Type": "AWS::SQS::QueuePolicy", "Properties": { "PolicyDocument": { @@ -222,7 +222,7 @@ }, "Resource": { "Fn::GetAtt": [ - "testsnssqsqueueB02504BF", + "testsnssqsstackqueue908D8D48", "Arn" ] }, @@ -239,7 +239,7 @@ "Principal": "*", "Resource": { "Fn::GetAtt": [ - "testsnssqsqueueB02504BF", + "testsnssqsstackqueue908D8D48", "Arn" ] }, @@ -250,7 +250,7 @@ "Condition": { "ArnEquals": { "aws:SourceArn": { - "Ref": "testsnssqsSnsTopic2CD0065B" + "Ref": "testsnssqsstackSnsTopic92693DD8" } } }, @@ -260,7 +260,7 @@ }, "Resource": { "Fn::GetAtt": [ - "testsnssqsqueueB02504BF", + "testsnssqsstackqueue908D8D48", "Arn" ] } @@ -270,21 +270,21 @@ }, "Queues": [ { - "Ref": "testsnssqsqueueB02504BF" + "Ref": "testsnssqsstackqueue908D8D48" } ] } }, - "testsnssqsqueuetestsnssqsSnsTopic752C989B046CB7AE": { + "testsnssqsstackqueuetestsnssqsstackSnsTopic3C855EBB5D6E630A": { "Type": "AWS::SNS::Subscription", "Properties": { "Protocol": "sqs", "TopicArn": { - "Ref": "testsnssqsSnsTopic2CD0065B" + "Ref": "testsnssqsstackSnsTopic92693DD8" }, "Endpoint": { "Fn::GetAtt": [ - "testsnssqsqueueB02504BF", + "testsnssqsstackqueue908D8D48", "Arn" ] } @@ -344,6 +344,32 @@ "Service": "sns.amazonaws.com" }, "Resource": "*" + }, + { + "Action": [ + "kms:Encrypt", + "kms:Decrypt" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": "*" } ], "Version": "2012-10-17" diff --git a/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.no-arguments.ts b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.no-arguments.ts index b34018dfa..5920af7db 100644 --- a/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.no-arguments.ts +++ b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.no-arguments.ts @@ -14,16 +14,27 @@ // Imports import { App, Stack } from "@aws-cdk/core"; import { SnsToSqs, SnsToSqsProps } from "../lib"; +import * as iam from '@aws-cdk/aws-iam'; // Setup const app = new App(); -const stack = new Stack(app, 'test-sns-sqs'); +const stack = new Stack(app, 'test-sns-sqs-stack'); stack.templateOptions.description = 'Integration Test for aws-sns-sqs'; // Definitions const props: SnsToSqsProps = {}; -new SnsToSqs(stack, 'test-sns-sqs', props); +const snsToSqsStack = new SnsToSqs(stack, 'test-sns-sqs-stack', props); + +// Grant yourself permissions to use the Customer Managed KMS Key +const policyStatement = new iam.PolicyStatement({ + actions: ["kms:Encrypt", "kms:Decrypt"], + effect: iam.Effect.ALLOW, + principals: [ new iam.AccountRootPrincipal() ], + resources: [ "*" ] +}); + +snsToSqsStack.encryptionKey?.addToResourcePolicy(policyStatement); // Synth app.synth(); diff --git a/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.sns-managed-kms-key.ts b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.sns-managed-kms-key.ts index 32b2914f6..c76cc7385 100644 --- a/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.sns-managed-kms-key.ts +++ b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.sns-managed-kms-key.ts @@ -31,7 +31,7 @@ const snsManagedKey = kms.Alias.fromAliasName(stack, 'sns-managed-key', 'alias/a const sqsEncryptionKeyProps: KeyProps = { enableKeyRotation: true }; -let sqsEncryptionKey = new kms.Key(stack, 'ImportedSQSEncryptionKey', sqsEncryptionKeyProps); +const sqsEncryptionKey = new kms.Key(stack, 'ImportedSQSEncryptionKey', sqsEncryptionKeyProps); // Create the SNS to SQS construct const props: SnsToSqsProps = { diff --git a/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/sns-sqs.test.ts b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/sns-sqs.test.ts index 18a67813a..5d22ec44e 100644 --- a/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/sns-sqs.test.ts +++ b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/sns-sqs.test.ts @@ -34,7 +34,7 @@ test('Pattern deployment w/ new Topic, new Queue and default props', () => { // Assertion 2 expect(stack).toHaveResource("AWS::SNS::Topic", { KmsMasterKeyId: { - "Ref": "EncryptionKey1B843E66" + Ref: "EncryptionKey1B843E66" } }); // Assertion 3 @@ -50,7 +50,7 @@ test('Pattern deployment w/ new Topic, new Queue and default props', () => { expect(stack).toHaveResource("AWS::SNS::Subscription", { Protocol: "sqs", TopicArn: { - "Ref": "testsnssqsSnsTopic2CD0065B" + Ref: "testsnssqsSnsTopic2CD0065B" }, Endpoint: { "Fn::GetAtt": [ @@ -88,7 +88,7 @@ test('Pattern deployment w/ new topic, new queue, and overridden props', () => { expect(stack).toHaveResource("AWS::SNS::Topic", { TopicName: "new-topic", KmsMasterKeyId: { - "Ref": "EncryptionKey1B843E66" + Ref: "EncryptionKey1B843E66" } }); // Assertion 2 @@ -179,7 +179,7 @@ test('Test deployment with imported encryption key', () => { // Assertion 3 expect(stack).toHaveResource("AWS::SNS::Topic", { KmsMasterKeyId: { - "Ref": "importedkey38675D68" + Ref: "importedkey38675D68" } }); }); diff --git a/source/patterns/@aws-solutions-constructs/aws-sqs-lambda/README.md b/source/patterns/@aws-solutions-constructs/aws-sqs-lambda/README.md index fcf11e137..e45b2fc2e 100644 --- a/source/patterns/@aws-solutions-constructs/aws-sqs-lambda/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-sqs-lambda/README.md @@ -24,12 +24,12 @@ This AWS Solutions Construct implements an Amazon SQS queue connected to an AWS Lambda function. -Here is a minimal deployable pattern definition: +Here is a minimal deployable pattern definition in Typescipr: ``` javascript -const { SqsToLambda } = require('@aws-solutions-constructs/aws-sqs-lambda'); +import { SqsToLambda, SqsToLambdaProps } from "@aws-solutions-constructs/aws-sqs-lambda"; -new SqsToLambda(stack, 'SqsToLambdaPattern', { +new SqsToLambda(this, 'SqsToLambdaPattern', { lambdaFunctionProps: { runtime: lambda.Runtime.NODEJS_10_X, handler: 'index.handler', diff --git a/source/patterns/@aws-solutions-constructs/aws-sqs-lambda/lib/index.ts b/source/patterns/@aws-solutions-constructs/aws-sqs-lambda/lib/index.ts index aa5953871..a44316a0b 100644 --- a/source/patterns/@aws-solutions-constructs/aws-sqs-lambda/lib/index.ts +++ b/source/patterns/@aws-solutions-constructs/aws-sqs-lambda/lib/index.ts @@ -93,7 +93,7 @@ export class SqsToLambda extends Construct { // Setup the dead letter queue, if applicable if (props.deployDeadLetterQueue || props.deployDeadLetterQueue === undefined) { - const dlq: sqs.Queue = defaults.buildQueue(this, 'deadLetterQueue', { + const [dlq] = defaults.buildQueue(this, 'deadLetterQueue', { queueProps: props.deadLetterQueueProps }); this.deadLetterQueue = defaults.buildDeadLetterQueue({ @@ -103,7 +103,7 @@ export class SqsToLambda extends Construct { } // Setup the queue - this.sqsQueue = defaults.buildQueue(this, 'queue', { + [this.sqsQueue] = defaults.buildQueue(this, 'queue', { existingQueueObj: props.existingQueueObj, queueProps: props.queueProps, deadLetterQueue: this.deadLetterQueue diff --git a/source/patterns/@aws-solutions-constructs/aws-sqs-lambda/package.json b/source/patterns/@aws-solutions-constructs/aws-sqs-lambda/package.json index aa896d35d..d50eb52cb 100644 --- a/source/patterns/@aws-solutions-constructs/aws-sqs-lambda/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-sqs-lambda/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-sqs-lambda", - "version": "1.61.0", + "version": "1.61.1", "description": "CDK constructs for defining an interaction between an Amazon SQS queue and an AWS Lambda function.", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -53,16 +53,16 @@ } }, "dependencies": { - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-lambda-event-sources": "~1.61.0", - "@aws-cdk/aws-sqs": "~1.61.0", - "@aws-cdk/aws-kms": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-lambda-event-sources": "~1.61.1", + "@aws-cdk/aws-sqs": "~1.61.1", + "@aws-cdk/aws-kms": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, @@ -72,12 +72,12 @@ ] }, "peerDependencies": { - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-lambda-event-sources": "~1.61.0", - "@aws-cdk/aws-sqs": "~1.61.0", - "@aws-cdk/aws-kms": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-lambda-event-sources": "~1.61.1", + "@aws-cdk/aws-sqs": "~1.61.1", + "@aws-cdk/aws-kms": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "constructs": "^3.0.4" } } diff --git a/source/patterns/@aws-solutions-constructs/core/lib/kms-helper.ts b/source/patterns/@aws-solutions-constructs/core/lib/kms-helper.ts index 447e23d85..0f5a4b858 100644 --- a/source/patterns/@aws-solutions-constructs/core/lib/kms-helper.ts +++ b/source/patterns/@aws-solutions-constructs/core/lib/kms-helper.ts @@ -11,29 +11,17 @@ * and limitations under the License. */ -// Imports import * as kms from '@aws-cdk/aws-kms'; import { DefaultEncryptionProps } from './kms-defaults'; import * as cdk from '@aws-cdk/core'; import { overrideProps } from './utils'; -export interface BuildEncryptionKeyProps { - /** - * Optional user-provided props to override the default props for the encryption key. - * - * @default - Default props are used. - */ - readonly encryptionKeyProps?: kms.KeyProps -} - -export function buildEncryptionKey(scope: cdk.Construct, props?: BuildEncryptionKeyProps): kms.Key { - // If props is undefined, define it - props = (props === undefined) ? {} : props; +export function buildEncryptionKey(scope: cdk.Construct, keyProps?: kms.KeyProps): kms.Key { // Setup the key properties let encryptionKeyProps; - if (props.encryptionKeyProps) { + if (keyProps) { // If property overrides have been provided, incorporate them and deploy - encryptionKeyProps = overrideProps(DefaultEncryptionProps, props.encryptionKeyProps); + encryptionKeyProps = overrideProps(DefaultEncryptionProps, keyProps); } else { // If no property overrides, deploy using the default configuration encryptionKeyProps = DefaultEncryptionProps; diff --git a/source/patterns/@aws-solutions-constructs/core/lib/sns-helper.ts b/source/patterns/@aws-solutions-constructs/core/lib/sns-helper.ts index e18598b37..6d03c8343 100644 --- a/source/patterns/@aws-solutions-constructs/core/lib/sns-helper.ts +++ b/source/patterns/@aws-solutions-constructs/core/lib/sns-helper.ts @@ -22,6 +22,12 @@ import { PolicyStatement, AnyPrincipal, Effect, AccountPrincipal } from '@aws-cd import { Stack } from '@aws-cdk/core'; export interface BuildTopicProps { + /** + * Existing instance of SNS Topic object, if this is set then the TopicProps is ignored. + * + * @default - None. + */ + readonly existingTopicObj?: sns.Topic, /** * Optional user provided props to override the default props for the SNS topic. * @@ -29,18 +35,24 @@ export interface BuildTopicProps { */ readonly topicProps?: sns.TopicProps /** - * Use a KMS Key, either managed by this CDK app, or imported. If importing an encryption key, it must be specified in + * Use a Customer Managed KMS Key, either managed by this CDK app, or imported. If importing an encryption key, it must be specified in * the encryptionKey property for this construct. * - * @default - true (encryption enabled, managed by this CDK app). + * @default - false (encryption enabled with AWS Managed KMS Key). */ - readonly enableEncryption?: boolean + readonly enableEncryptionWithCustomerManagedKey?: boolean /** * An optional, imported encryption key to encrypt the SNS topic with. * * @default - not specified. */ - readonly encryptionKey?: kms.Key + readonly encryptionKey?: kms.Key, + /** + * Optional user-provided props to override the default props for the encryption key. + * + * @default - Ignored if encryptionKey is provided + */ + readonly encryptionKeyProps?: kms.KeyProps } function applySecureTopicPolicy(topic: sns.Topic): void { @@ -104,32 +116,38 @@ function applySecureTopicPolicy(topic: sns.Topic): void { ); } -export function buildTopic(scope: cdk.Construct, props?: BuildTopicProps): [sns.Topic, kms.Key] { - // If props is undefined, define it - props = (props === undefined) ? {} : props; - // Setup the topic properties - let snsTopicProps; - if (props.topicProps) { - // If property overrides have been provided, incorporate them and deploy - snsTopicProps = overrideProps(DefaultSnsTopicProps, props.topicProps); - } else { - // If no property overrides, deploy using the default configuration - snsTopicProps = DefaultSnsTopicProps; - } - // Set encryption properties - // TODO: Look into using the AWS managed CMK by using 'alias/aws/sns' - if (props.enableEncryption === undefined || props.enableEncryption === true) { - if (props.encryptionKey) { - snsTopicProps.masterKey = props.encryptionKey; +export function buildTopic(scope: cdk.Construct, props: BuildTopicProps): [sns.Topic, kms.Key?] { + if (!props.existingTopicObj) { + // Setup the topic properties + let snsTopicProps; + if (props.topicProps) { + // If property overrides have been provided, incorporate them and deploy + snsTopicProps = overrideProps(DefaultSnsTopicProps, props.topicProps); } else { - snsTopicProps.masterKey = buildEncryptionKey(scope); + // If no property overrides, deploy using the default configuration + snsTopicProps = DefaultSnsTopicProps; } - } - // Create the SNS Topic - - const topic: sns.Topic = new sns.Topic(scope, 'SnsTopic', snsTopicProps); + // Set encryption properties + if (props.enableEncryptionWithCustomerManagedKey === undefined || props.enableEncryptionWithCustomerManagedKey === false) { + // Retrieve SNS managed key to encrypt the SNS Topic + const awsManagedKey = kms.Alias.fromAliasName(scope, 'aws-managed-key', 'alias/aws/sns'); + snsTopicProps.masterKey = awsManagedKey; + } else { + // Use the imported Customer Managed KMS key + if (props.encryptionKey) { + snsTopicProps.masterKey = props.encryptionKey; + } else { + // Create a new Customer Managed KMS key + snsTopicProps.masterKey = buildEncryptionKey(scope, props.encryptionKeyProps); + } + } + // Create the SNS Topic + const topic: sns.Topic = new sns.Topic(scope, 'SnsTopic', snsTopicProps); - applySecureTopicPolicy(topic); + applySecureTopicPolicy(topic); - return [topic, snsTopicProps.masterKey]; + return [topic, snsTopicProps.masterKey]; + } else { + return [props.existingTopicObj]; + } } diff --git a/source/patterns/@aws-solutions-constructs/core/lib/sqs-helper.ts b/source/patterns/@aws-solutions-constructs/core/lib/sqs-helper.ts index f758aacb7..73f4cea8b 100644 --- a/source/patterns/@aws-solutions-constructs/core/lib/sqs-helper.ts +++ b/source/patterns/@aws-solutions-constructs/core/lib/sqs-helper.ts @@ -44,65 +44,60 @@ export interface BuildQueueProps { * Use a KMS Key, either managed by this CDK app, or imported. If importing an encryption key, it must be specified in * the encryptionKey property for this construct. * - * @default - false (encryption enabled with a KMS key managed by SQS). + * @default - false (encryption enabled with AWS Managed KMS Key). */ - readonly enableEncryption?: boolean + readonly enableEncryptionWithCustomerManagedKey?: boolean /** * An optional, imported encryption key to encrypt the SQS queue with. * * @default - not specified. */ - readonly encryptionKey?: kms.Key + readonly encryptionKey?: kms.Key, + /** + * Optional user-provided props to override the default props for the encryption key. + * + * @default - Ignored if encryptionKey is provided + */ + readonly encryptionKeyProps?: kms.KeyProps } -export function buildQueue(scope: cdk.Construct, id: string, props?: BuildQueueProps): sqs.Queue { - // If props is undefined, define it - props = (props === undefined) ? {} : props; - // Conditional queue creation +export function buildQueue(scope: cdk.Construct, id: string, props: BuildQueueProps): [sqs.Queue, kms.IKey?] { // If an existingQueueObj is not specified if (!props.existingQueueObj) { - // Deploy the queue - return deployQueue(scope, id, props.queueProps, props.deadLetterQueue, props.enableEncryption, props.encryptionKey); - // If an existingQueueObj is specified, return that object as the queue to be used - } else { - return props.existingQueueObj - } -} + // Setup the queue + let queueProps; + if (props.queueProps) { + // If property overrides have been provided, incorporate them and deploy + queueProps = overrideProps(defaults.DefaultQueueProps(), props.queueProps); + } else { + // If no property overrides, deploy using the default configuration + queueProps = defaults.DefaultQueueProps(); + } -function deployQueue(scope: cdk.Construct, - id: string, - queuePropsParam?: sqs.QueueProps, - deadLetterQueueParam?: sqs.DeadLetterQueue, - enableEncryptionParam?: boolean, - encryptionKeyParam?: kms.Key): sqs.Queue { + // Determine whether a DLQ property should be added + if (props.deadLetterQueue) { + queueProps.deadLetterQueue = props.deadLetterQueue; + } - // Setup the queue - let queueProps; - if (queuePropsParam) { - // If property overrides have been provided, incorporate them and deploy - queueProps = overrideProps(defaults.DefaultQueueProps(), queuePropsParam); - } else { - // If no property overrides, deploy using the default configuration - queueProps = defaults.DefaultQueueProps(); - } - // Determine whether a DLQ property should be added - if (deadLetterQueueParam) { - queueProps.deadLetterQueue = deadLetterQueueParam; - } - // Set encryption properties - if (enableEncryptionParam === true) { - if (encryptionKeyParam) { - queueProps.encryptionMasterKey = encryptionKeyParam; - } else { - queueProps.encryptionMasterKey = buildEncryptionKey(scope); + // Set encryption properties + if (props.enableEncryptionWithCustomerManagedKey) { + // Use the imported Customer Managed KMS key + if (props.encryptionKey) { + queueProps.encryptionMasterKey = props.encryptionKey; + } else { + queueProps.encryptionMasterKey = buildEncryptionKey(scope, props.encryptionKeyProps); + } } - } - const queue = new sqs.Queue(scope, id, queueProps); + const queue = new sqs.Queue(scope, id, queueProps); - applySecureQueuePolicy(queue); + applySecureQueuePolicy(queue); - // Return the queue - return queue; + // Return the queue + return [queue, queue.encryptionMasterKey]; + } else { + // If an existingQueueObj is specified, return that object as the queue to be used + return [props.existingQueueObj]; + } } export interface BuildDeadLetterQueueProps { diff --git a/source/patterns/@aws-solutions-constructs/core/package.json b/source/patterns/@aws-solutions-constructs/core/package.json index c5a1e68db..89ea2da67 100644 --- a/source/patterns/@aws-solutions-constructs/core/package.json +++ b/source/patterns/@aws-solutions-constructs/core/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/core", - "version": "1.61.0", + "version": "1.61.1", "description": "Core CDK Construct for patterns library", "main": "index.js", "types": "index.ts", @@ -52,28 +52,28 @@ } }, "dependencies": { - "@aws-cdk/aws-cloudfront": "~1.61.0", - "@aws-cdk/aws-cloudfront-origins": "~1.61.0", - "@aws-cdk/aws-dynamodb": "~1.61.0", - "@aws-cdk/aws-iot": "~1.61.0", - "@aws-cdk/aws-kinesis": "~1.61.0", - "@aws-cdk/aws-kinesisanalytics": "~1.61.0", - "@aws-cdk/aws-kinesisfirehose": "~1.61.0", - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-lambda-event-sources": "~1.61.0", - "@aws-cdk/aws-logs": "~1.61.0", - "@aws-cdk/aws-s3": "~1.61.0", - "@aws-cdk/aws-sns": "~1.61.0", - "@aws-cdk/aws-sqs": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-cdk/aws-apigateway": "~1.61.0", - "@aws-cdk/aws-kms": "~1.61.0", - "@aws-cdk/aws-events": "~1.61.0", - "@aws-cdk/aws-cognito": "~1.61.0", - "@aws-cdk/aws-elasticsearch": "~1.61.0", - "@aws-cdk/aws-cloudwatch": "~1.61.0", - "@aws-cdk/aws-stepfunctions": "~1.61.0", + "@aws-cdk/aws-cloudfront": "~1.61.1", + "@aws-cdk/aws-cloudfront-origins": "~1.61.1", + "@aws-cdk/aws-dynamodb": "~1.61.1", + "@aws-cdk/aws-iot": "~1.61.1", + "@aws-cdk/aws-kinesis": "~1.61.1", + "@aws-cdk/aws-kinesisanalytics": "~1.61.1", + "@aws-cdk/aws-kinesisfirehose": "~1.61.1", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-lambda-event-sources": "~1.61.1", + "@aws-cdk/aws-logs": "~1.61.1", + "@aws-cdk/aws-s3": "~1.61.1", + "@aws-cdk/aws-sns": "~1.61.1", + "@aws-cdk/aws-sqs": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-cdk/aws-apigateway": "~1.61.1", + "@aws-cdk/aws-kms": "~1.61.1", + "@aws-cdk/aws-events": "~1.61.1", + "@aws-cdk/aws-cognito": "~1.61.1", + "@aws-cdk/aws-elasticsearch": "~1.61.1", + "@aws-cdk/aws-cloudwatch": "~1.61.1", + "@aws-cdk/aws-stepfunctions": "~1.61.1", "@types/deep-diff": "^1.0.0", "@types/npmlog": "^4.1.2", "deep-diff": "^1.0.2", @@ -81,7 +81,7 @@ "npmlog": "^4.1.2" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, @@ -98,27 +98,27 @@ "@types/deep-diff" ], "peerDependencies": { - "@aws-cdk/aws-cloudfront": "~1.61.0", - "@aws-cdk/aws-dynamodb": "~1.61.0", - "@aws-cdk/aws-iot": "~1.61.0", - "@aws-cdk/aws-kinesis": "~1.61.0", - "@aws-cdk/aws-kinesisanalytics": "~1.61.0", - "@aws-cdk/aws-kinesisfirehose": "~1.61.0", - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-lambda-event-sources": "~1.61.0", - "@aws-cdk/aws-logs": "~1.61.0", - "@aws-cdk/aws-s3": "~1.61.0", - "@aws-cdk/aws-sns": "~1.61.0", - "@aws-cdk/aws-sqs": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-cdk/aws-apigateway": "~1.61.0", - "@aws-cdk/aws-kms": "~1.61.0", - "@aws-cdk/aws-events": "~1.61.0", - "@aws-cdk/aws-cognito": "~1.61.0", - "@aws-cdk/aws-elasticsearch": "~1.61.0", - "@aws-cdk/aws-cloudwatch": "~1.61.0", - "@aws-cdk/aws-stepfunctions": "~1.61.0", - "@aws-cdk/aws-cloudfront-origins": "~1.61.0" + "@aws-cdk/aws-cloudfront": "~1.61.1", + "@aws-cdk/aws-dynamodb": "~1.61.1", + "@aws-cdk/aws-iot": "~1.61.1", + "@aws-cdk/aws-kinesis": "~1.61.1", + "@aws-cdk/aws-kinesisanalytics": "~1.61.1", + "@aws-cdk/aws-kinesisfirehose": "~1.61.1", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-lambda-event-sources": "~1.61.1", + "@aws-cdk/aws-logs": "~1.61.1", + "@aws-cdk/aws-s3": "~1.61.1", + "@aws-cdk/aws-sns": "~1.61.1", + "@aws-cdk/aws-sqs": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-cdk/aws-apigateway": "~1.61.1", + "@aws-cdk/aws-kms": "~1.61.1", + "@aws-cdk/aws-events": "~1.61.1", + "@aws-cdk/aws-cognito": "~1.61.1", + "@aws-cdk/aws-elasticsearch": "~1.61.1", + "@aws-cdk/aws-cloudwatch": "~1.61.1", + "@aws-cdk/aws-stepfunctions": "~1.61.1", + "@aws-cdk/aws-cloudfront-origins": "~1.61.1" } } diff --git a/source/patterns/@aws-solutions-constructs/core/test/__snapshots__/kms-helper.test.js.snap b/source/patterns/@aws-solutions-constructs/core/test/__snapshots__/kms-helper.test.js.snap index ce4625cb1..ff88da21a 100644 --- a/source/patterns/@aws-solutions-constructs/core/test/__snapshots__/kms-helper.test.js.snap +++ b/source/patterns/@aws-solutions-constructs/core/test/__snapshots__/kms-helper.test.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Test minimal deployment with no properties 1`] = ` +exports[`Test minimal deployment with custom properties 1`] = ` Object { "Resources": Object { "EncryptionKey1B843E66": Object { "DeletionPolicy": "Retain", "Properties": Object { - "EnableKeyRotation": true, + "EnableKeyRotation": false, "KeyPolicy": Object { "Statement": Array [ Object { @@ -59,13 +59,13 @@ Object { } `; -exports[`Test minimal deployment with no properties 2`] = ` +exports[`Test minimal deployment with no properties 1`] = ` Object { "Resources": Object { "EncryptionKey1B843E66": Object { "DeletionPolicy": "Retain", "Properties": Object { - "EnableKeyRotation": false, + "EnableKeyRotation": true, "KeyPolicy": Object { "Statement": Array [ Object { diff --git a/source/patterns/@aws-solutions-constructs/core/test/__snapshots__/sns-helper.test.js.snap b/source/patterns/@aws-solutions-constructs/core/test/__snapshots__/sns-helper.test.js.snap index c5dc021b0..f62612e96 100644 --- a/source/patterns/@aws-solutions-constructs/core/test/__snapshots__/sns-helper.test.js.snap +++ b/source/patterns/@aws-solutions-constructs/core/test/__snapshots__/sns-helper.test.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Test deployment w/ custom properties 1`] = ` +exports[`Test deployment w/ imported encryption key 1`] = ` Object { "Resources": Object { "EncryptionKey1B843E66": Object { @@ -150,67 +150,12 @@ Object { } `; -exports[`Test deployment w/ imported encryption key 1`] = ` +exports[`Test deployment with no properties using AWS Managed KMS Key 1`] = ` Object { "Resources": Object { - "EncryptionKey1B843E66": Object { - "DeletionPolicy": "Retain", - "Properties": Object { - "EnableKeyRotation": true, - "KeyPolicy": Object { - "Statement": Array [ - Object { - "Action": Array [ - "kms:Create*", - "kms:Describe*", - "kms:Enable*", - "kms:List*", - "kms:Put*", - "kms:Update*", - "kms:Revoke*", - "kms:Disable*", - "kms:Get*", - "kms:Delete*", - "kms:ScheduleKeyDeletion", - "kms:CancelKeyDeletion", - "kms:GenerateDataKey", - "kms:TagResource", - "kms:UntagResource", - ], - "Effect": "Allow", - "Principal": Object { - "AWS": Object { - "Fn::Join": Array [ - "", - Array [ - "arn:", - Object { - "Ref": "AWS::Partition", - }, - ":iam::", - Object { - "Ref": "AWS::AccountId", - }, - ":root", - ], - ], - }, - }, - "Resource": "*", - }, - ], - "Version": "2012-10-17", - }, - }, - "Type": "AWS::KMS::Key", - "UpdateReplacePolicy": "Retain", - }, "SnsTopic2C1570A4": Object { "Properties": Object { - "KmsMasterKeyId": Object { - "Ref": "EncryptionKey1B843E66", - }, - "TopicName": "custom-topic", + "KmsMasterKeyId": "alias/aws/sns", }, "Type": "AWS::SNS::Topic", }, @@ -300,7 +245,7 @@ Object { } `; -exports[`Test deployment with no properties 1`] = ` +exports[`Test deployment without imported encryption key 1`] = ` Object { "Resources": Object { "EncryptionKey1B843E66": Object { @@ -360,6 +305,7 @@ Object { "KmsMasterKeyId": Object { "Ref": "EncryptionKey1B843E66", }, + "TopicName": "custom-topic", }, "Type": "AWS::SNS::Topic", }, diff --git a/source/patterns/@aws-solutions-constructs/core/test/__snapshots__/sqs-helper.test.js.snap b/source/patterns/@aws-solutions-constructs/core/test/__snapshots__/sqs-helper.test.js.snap index ad6c9de4c..6261b50af 100644 --- a/source/patterns/@aws-solutions-constructs/core/test/__snapshots__/sqs-helper.test.js.snap +++ b/source/patterns/@aws-solutions-constructs/core/test/__snapshots__/sqs-helper.test.js.snap @@ -731,66 +731,9 @@ Object { exports[`Test deployment without imported encryption key 1`] = ` Object { "Resources": Object { - "EncryptionKey1B843E66": Object { - "DeletionPolicy": "Retain", - "Properties": Object { - "EnableKeyRotation": true, - "KeyPolicy": Object { - "Statement": Array [ - Object { - "Action": Array [ - "kms:Create*", - "kms:Describe*", - "kms:Enable*", - "kms:List*", - "kms:Put*", - "kms:Update*", - "kms:Revoke*", - "kms:Disable*", - "kms:Get*", - "kms:Delete*", - "kms:ScheduleKeyDeletion", - "kms:CancelKeyDeletion", - "kms:GenerateDataKey", - "kms:TagResource", - "kms:UntagResource", - ], - "Effect": "Allow", - "Principal": Object { - "AWS": Object { - "Fn::Join": Array [ - "", - Array [ - "arn:", - Object { - "Ref": "AWS::Partition", - }, - ":iam::", - Object { - "Ref": "AWS::AccountId", - }, - ":root", - ], - ], - }, - }, - "Resource": "*", - }, - ], - "Version": "2012-10-17", - }, - }, - "Type": "AWS::KMS::Key", - "UpdateReplacePolicy": "Retain", - }, "existingqueue03D57A53": Object { "Properties": Object { - "KmsMasterKeyId": Object { - "Fn::GetAtt": Array [ - "EncryptionKey1B843E66", - "Arn", - ], - }, + "KmsMasterKeyId": "alias/aws/sqs", "QueueName": "existing-queue", }, "Type": "AWS::SQS::Queue", diff --git a/source/patterns/@aws-solutions-constructs/core/test/kms-helper.test.ts b/source/patterns/@aws-solutions-constructs/core/test/kms-helper.test.ts index c9e6c0d9e..91a3872c9 100644 --- a/source/patterns/@aws-solutions-constructs/core/test/kms-helper.test.ts +++ b/source/patterns/@aws-solutions-constructs/core/test/kms-helper.test.ts @@ -39,14 +39,12 @@ test('Test minimal deployment with no properties', () => { // -------------------------------------------------------------- // Test deployment w/ custom properties // -------------------------------------------------------------- -test('Test minimal deployment with no properties', () => { +test('Test minimal deployment with custom properties', () => { // Stack const stack = new Stack(); // Helper declaration defaults.buildEncryptionKey(stack, { - encryptionKeyProps: { - enableKeyRotation: false - } + enableKeyRotation: false }); // Assertion 1 expect(SynthUtils.toCloudFormation(stack)).toMatchSnapshot(); diff --git a/source/patterns/@aws-solutions-constructs/core/test/sns-helper.test.ts b/source/patterns/@aws-solutions-constructs/core/test/sns-helper.test.ts index 9e7d65044..4ff505d9f 100644 --- a/source/patterns/@aws-solutions-constructs/core/test/sns-helper.test.ts +++ b/source/patterns/@aws-solutions-constructs/core/test/sns-helper.test.ts @@ -18,21 +18,25 @@ import { SynthUtils, expect as expectCDK, haveResource } from '@aws-cdk/assert'; import '@aws-cdk/assert/jest'; // -------------------------------------------------------------- -// Test deployment with no properties +// Test deployment with no properties using AWS Managed KMS Key // -------------------------------------------------------------- -test('Test deployment with no properties', () => { +test('Test deployment with no properties using AWS Managed KMS Key', () => { // Stack const stack = new Stack(); // Helper declaration - defaults.buildTopic(stack); + defaults.buildTopic(stack, {}); // Assertion 1 expect(SynthUtils.toCloudFormation(stack)).toMatchSnapshot(); + // Assertion 2 + expect(stack).toHaveResource("AWS::SNS::Topic", { + KmsMasterKeyId: "alias/aws/sns" + }); }); // -------------------------------------------------------------- -// Test deployment w/ custom properties +// Test deployment without imported encryption key // -------------------------------------------------------------- -test('Test deployment w/ custom properties', () => { +test('Test deployment without imported encryption key', () => { // Stack const stack = new Stack(); // Helper declaration @@ -40,7 +44,7 @@ test('Test deployment w/ custom properties', () => { topicProps: { topicName: "custom-topic" }, - enableEncryption: true + enableEncryptionWithCustomerManagedKey: true }); // Assertion 1 expect(SynthUtils.toCloudFormation(stack)).toMatchSnapshot(); @@ -48,6 +52,10 @@ test('Test deployment w/ custom properties', () => { expect(stack).toHaveResource("AWS::SNS::Topic", { TopicName: "custom-topic" }); + // Assertion 3 + expect(stack).toHaveResource("AWS::KMS::Key", { + EnableKeyRotation: true + }); }); // -------------------------------------------------------------- @@ -56,102 +64,103 @@ test('Test deployment w/ custom properties', () => { test('Test deployment w/ imported encryption key', () => { // Stack const stack = new Stack(); + // Generate KMS Key + const key = defaults.buildEncryptionKey(stack); // Helper declaration defaults.buildTopic(stack, { topicProps: { topicName: "custom-topic" }, - enableEncryption: true, - encryptionKey: defaults.buildEncryptionKey(stack) + enableEncryptionWithCustomerManagedKey: true, + encryptionKey: key }); // Assertion 1 expect(SynthUtils.toCloudFormation(stack)).toMatchSnapshot(); // Assertion 2 expect(stack).toHaveResource("AWS::SNS::Topic", { - TopicName: "custom-topic" - }); - // Assertion 3 - expect(stack).toHaveResource("AWS::KMS::Key", { - EnableKeyRotation: true + KmsMasterKeyId: { + Ref: "EncryptionKey1B843E66" + }, + TopicName: "custom-topic" }); }); test('Check SNS Topic policy', () => { const stack = new Stack(); - defaults.buildTopic(stack); + defaults.buildTopic(stack, {}); expectCDK(stack).to(haveResource("AWS::SNS::TopicPolicy", { - PolicyDocument: { - Statement: [ - { - Action: [ - "SNS:Publish", - "SNS:RemovePermission", - "SNS:SetTopicAttributes", - "SNS:DeleteTopic", - "SNS:ListSubscriptionsByTopic", - "SNS:GetTopicAttributes", - "SNS:Receive", - "SNS:AddPermission", - "SNS:Subscribe" - ], - Condition: { - StringEquals: { - "AWS:SourceOwner": { + PolicyDocument: { + Statement: [ + { + Action: [ + "SNS:Publish", + "SNS:RemovePermission", + "SNS:SetTopicAttributes", + "SNS:DeleteTopic", + "SNS:ListSubscriptionsByTopic", + "SNS:GetTopicAttributes", + "SNS:Receive", + "SNS:AddPermission", + "SNS:Subscribe" + ], + Condition: { + StringEquals: { + "AWS:SourceOwner": { + Ref: "AWS::AccountId" + } + } + }, + Effect: "Allow", + Principal: { + AWS: { + "Fn::Join": [ + "", + [ + "arn:", + { + Ref: "AWS::Partition" + }, + ":iam::", + { Ref: "AWS::AccountId" - } - } - }, - Effect: "Allow", - Principal: { - AWS: { - "Fn::Join": [ - "", - [ - "arn:", - { - Ref: "AWS::Partition" - }, - ":iam::", - { - Ref: "AWS::AccountId" - }, - ":root" - ] - ] - } - }, - Resource: { - Ref: "SnsTopic2C1570A4" - }, - Sid: "TopicOwnerOnlyAccess" - }, - { - Action: [ - "SNS:Publish", - "SNS:RemovePermission", - "SNS:SetTopicAttributes", - "SNS:DeleteTopic", - "SNS:ListSubscriptionsByTopic", - "SNS:GetTopicAttributes", - "SNS:Receive", - "SNS:AddPermission", - "SNS:Subscribe" - ], - Condition: { - Bool: { - "aws:SecureTransport": "false" - } - }, - Effect: "Deny", - Principal: "*", - Resource: { - Ref: "SnsTopic2C1570A4" - }, - Sid: "HttpsOnly" + }, + ":root" + ] + ] } + }, + Resource: { + Ref: "SnsTopic2C1570A4" + }, + Sid: "TopicOwnerOnlyAccess" + }, + { + Action: [ + "SNS:Publish", + "SNS:RemovePermission", + "SNS:SetTopicAttributes", + "SNS:DeleteTopic", + "SNS:ListSubscriptionsByTopic", + "SNS:GetTopicAttributes", + "SNS:Receive", + "SNS:AddPermission", + "SNS:Subscribe" ], - Version: "2012-10-17" - }, + Condition: { + Bool: { + "aws:SecureTransport": "false" + } + }, + Effect: "Deny", + Principal: "*", + Resource: { + Ref: "SnsTopic2C1570A4" + }, + Sid: "HttpsOnly" + } + ], + Version: "2012-10-17" + }, })); }); \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/core/test/sqs-helper.test.ts b/source/patterns/@aws-solutions-constructs/core/test/sqs-helper.test.ts index b7fc41dda..ff60760c7 100644 --- a/source/patterns/@aws-solutions-constructs/core/test/sqs-helper.test.ts +++ b/source/patterns/@aws-solutions-constructs/core/test/sqs-helper.test.ts @@ -25,7 +25,7 @@ test('Test minimal deployment with no properties', () => { // Stack const stack = new Stack(); // Helper declaration - defaults.buildQueue(stack, 'primary-queue'); + defaults.buildQueue(stack, 'primary-queue', {}); // Assertion 1 expect(SynthUtils.toCloudFormation(stack)).toMatchSnapshot(); }); @@ -58,7 +58,7 @@ test('Test dead letter queue deployment/configuration', () => { const stack = new Stack(); // Helper setup const encKey = defaults.buildEncryptionKey(stack); - const dlq = defaults.buildQueue(stack, 'dead-letter-queue'); + const [dlq] = defaults.buildQueue(stack, 'dead-letter-queue', {}); const dlqi = defaults.buildDeadLetterQueue({ deadLetterQueue: dlq, maxReceiveCount: 3 @@ -84,7 +84,7 @@ test('Test dead letter queue deployment/configuration w/o mrc', () => { const stack = new Stack(); // Helper setup const encKey = defaults.buildEncryptionKey(stack); - const dlq = defaults.buildQueue(stack, 'dead-letter-queue'); + const [dlq] = defaults.buildQueue(stack, 'dead-letter-queue', {}); const dlqi = defaults.buildDeadLetterQueue({ deadLetterQueue: dlq }); @@ -108,7 +108,7 @@ test('Test existingQueueObj', () => { // Stack const stack = new Stack(); // Helper setup - const existingQueue = defaults.buildQueue(stack, 'existing-queue', { + const [existingQueue] = defaults.buildQueue(stack, 'existing-queue', { queueProps: { queueName: 'existing-queue' } @@ -132,7 +132,7 @@ test('Test deployment w/ imported encryption key', () => { queueProps: { queueName: 'existing-queue' }, - enableEncryption: true, + enableEncryptionWithCustomerManagedKey: true, encryptionKey: defaults.buildEncryptionKey(stack) }); // Assertion 1 @@ -157,17 +157,13 @@ test('Test deployment without imported encryption key', () => { defaults.buildQueue(stack, 'existing-queue', { queueProps: { queueName: 'existing-queue' - }, - enableEncryption: true + } }); // Assertion 1 expect(SynthUtils.toCloudFormation(stack)).toMatchSnapshot(); // Assertion 2 expect(stack).toHaveResource("AWS::SQS::Queue", { - QueueName: "existing-queue" - }); - // Assertion 3 - expect(stack).toHaveResource("AWS::KMS::Key", { - EnableKeyRotation: true + QueueName: "existing-queue", + KmsMasterKeyId: "alias/aws/sqs" }); }); diff --git a/source/tools/cdk-integ-tools/package.json b/source/tools/cdk-integ-tools/package.json index 40c835339..22b4ba6df 100644 --- a/source/tools/cdk-integ-tools/package.json +++ b/source/tools/cdk-integ-tools/package.json @@ -31,9 +31,9 @@ "typescript": "~3.7.4" }, "dependencies": { - "@aws-cdk/cloudformation-diff": "~1.61.0", - "@aws-cdk/cx-api": "~1.61.0", - "aws-cdk": "~1.61.0", + "@aws-cdk/cloudformation-diff": "~1.61.1", + "@aws-cdk/cx-api": "~1.61.1", + "aws-cdk": "~1.61.1", "fs-extra": "^8.1.0", "yargs": "^15.1.0" }, diff --git a/source/use_cases/aws-s3-static-website/package.json b/source/use_cases/aws-s3-static-website/package.json index 599416494..48d72bc22 100644 --- a/source/use_cases/aws-s3-static-website/package.json +++ b/source/use_cases/aws-s3-static-website/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-s3-static-website", - "version": "1.61.0", + "version": "1.61.1", "description": "Use case pattern for deploying a S3 static website.", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -28,19 +28,19 @@ "build+lint+test": "npm run build && npm run lint && npm test && npm run integ-assert" }, "dependencies": { - "@aws-solutions-constructs/aws-cloudfront-s3": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-cloudfront": "~1.61.0", - "@aws-cdk/aws-s3": "~1.61.0", - "@aws-cdk/custom-resources": "~1.61.0", - "@aws-cdk/aws-cloudformation": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-solutions-constructs/aws-cloudfront-s3": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-cloudfront": "~1.61.1", + "@aws-cdk/aws-s3": "~1.61.1", + "@aws-cdk/custom-resources": "~1.61.1", + "@aws-cdk/aws-cloudformation": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "source-map-support": "^0.5.16" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, diff --git a/source/use_cases/aws-serverless-image-handler/package.json b/source/use_cases/aws-serverless-image-handler/package.json index 5c62ba0c8..6fcb2bd03 100644 --- a/source/use_cases/aws-serverless-image-handler/package.json +++ b/source/use_cases/aws-serverless-image-handler/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-serverless-image-handler", - "version": "1.61.0", + "version": "1.61.1", "description": "Use case pattern for deploying a serverless image handler API.", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -53,18 +53,18 @@ } }, "dependencies": { - "@aws-cdk/aws-apigateway": "~1.61.0", - "@aws-cdk/aws-cloudfront": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-s3": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-solutions-constructs/aws-cloudfront-apigateway-lambda": "~1.61.0", - "@aws-solutions-constructs/aws-lambda-s3": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0" + "@aws-cdk/aws-apigateway": "~1.61.1", + "@aws-cdk/aws-cloudfront": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-s3": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-solutions-constructs/aws-cloudfront-apigateway-lambda": "~1.61.1", + "@aws-solutions-constructs/aws-lambda-s3": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" }, @@ -74,14 +74,14 @@ ] }, "peerDependencies": { - "@aws-solutions-constructs/aws-cloudfront-apigateway-lambda": "~1.61.0", - "@aws-solutions-constructs/aws-lambda-s3": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-apigateway": "~1.61.0", - "@aws-cdk/aws-cloudfront": "~1.61.0", - "@aws-cdk/aws-s3": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0" + "@aws-solutions-constructs/aws-cloudfront-apigateway-lambda": "~1.61.1", + "@aws-solutions-constructs/aws-lambda-s3": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-apigateway": "~1.61.1", + "@aws-cdk/aws-cloudfront": "~1.61.1", + "@aws-cdk/aws-s3": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1" } } diff --git a/source/use_cases/aws-serverless-web-app/package.json b/source/use_cases/aws-serverless-web-app/package.json index 0e96c9678..bfecdaad3 100644 --- a/source/use_cases/aws-serverless-web-app/package.json +++ b/source/use_cases/aws-serverless-web-app/package.json @@ -1,6 +1,6 @@ { "name": "@aws-solutions-constructs/aws-serverless-web-app", - "version": "1.61.0", + "version": "1.61.1", "description": "Use case pattern for deploying a serverless web app.", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -28,24 +28,24 @@ "build+lint+test": "npm run build && npm run lint && npm test && npm run integ-assert" }, "dependencies": { - "@aws-solutions-constructs/aws-cloudfront-s3": "~1.61.0", - "@aws-solutions-constructs/aws-cognito-apigateway-lambda": "~1.61.0", - "@aws-solutions-constructs/aws-lambda-dynamodb": "~1.61.0", - "@aws-cdk/core": "~1.61.0", - "@aws-cdk/aws-lambda": "~1.61.0", - "@aws-cdk/aws-cloudfront": "~1.61.0", - "@aws-cdk/aws-s3": "~1.61.0", - "@aws-cdk/custom-resources": "~1.61.0", - "@aws-cdk/aws-cloudformation": "~1.61.0", - "@aws-cdk/aws-iam": "~1.61.0", - "@aws-cdk/aws-cognito": "~1.61.0", - "@aws-cdk/aws-apigateway": "~1.61.0", - "@aws-cdk/aws-dynamodb": "~1.61.0", - "@aws-solutions-constructs/core": "~1.61.0", + "@aws-solutions-constructs/aws-cloudfront-s3": "~1.61.1", + "@aws-solutions-constructs/aws-cognito-apigateway-lambda": "~1.61.1", + "@aws-solutions-constructs/aws-lambda-dynamodb": "~1.61.1", + "@aws-cdk/core": "~1.61.1", + "@aws-cdk/aws-lambda": "~1.61.1", + "@aws-cdk/aws-cloudfront": "~1.61.1", + "@aws-cdk/aws-s3": "~1.61.1", + "@aws-cdk/custom-resources": "~1.61.1", + "@aws-cdk/aws-cloudformation": "~1.61.1", + "@aws-cdk/aws-iam": "~1.61.1", + "@aws-cdk/aws-cognito": "~1.61.1", + "@aws-cdk/aws-apigateway": "~1.61.1", + "@aws-cdk/aws-dynamodb": "~1.61.1", + "@aws-solutions-constructs/core": "~1.61.1", "source-map-support": "^0.5.16" }, "devDependencies": { - "@aws-cdk/assert": "~1.61.0", + "@aws-cdk/assert": "~1.61.1", "@types/jest": "^24.0.23", "@types/node": "^10.3.0" },