Skip to content

Commit 7f514cc

Browse files
committed
Merge branch 'c9-repo-support' of github.com:pahud/aws-cdk into c9-repo-support
2 parents feefdb7 + 6676a61 commit 7f514cc

File tree

87 files changed

+4671
-601
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+4671
-601
lines changed

CHANGELOG.md

+44
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,50 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
## [1.42.0](https://github.com/aws/aws-cdk/compare/v1.41.0...v1.42.0) (2020-05-27)
6+
7+
8+
### ⚠ BREAKING CHANGES
9+
10+
* **cloudtrail:** API signatures of `addS3EventSelectors` and
11+
`addLambdaEventSelectors` have changed. Their parameters are now
12+
strongly typed to accept `IBucket` and `IFunction` respectively.
13+
* **cloudtrail:** `addS3EventSelectors` and `addLambdaEventSelectors`
14+
can no longer be used to configure all S3 data events or all Lambda data
15+
events. Two new APIs `logAllS3DataEvents()` and
16+
`logAllLambdaDataEvents()` have been introduced to achieve this.
17+
* **cloudtrail:** The property `snsTopic` is now of the type `ITopic`.
18+
19+
### Features
20+
21+
* **cfnspec:** cloudformation spec v14.4.0 ([#8195](https://github.com/aws/aws-cdk/issues/8195)) ([99e7330](https://github.com/aws/aws-cdk/commit/99e7330fc5fc140964c47d8c6dbaee2b46b382e1))
22+
* **cloudtrail:** create cloudwatch event without needing to create a Trail ([#8076](https://github.com/aws/aws-cdk/issues/8076)) ([0567a23](https://github.com/aws/aws-cdk/commit/0567a2360ac713e3171c9a82767611174dadb6c6)), closes [#6716](https://github.com/aws/aws-cdk/issues/6716)
23+
* **cloudtrail:** user specified log group ([#8079](https://github.com/aws/aws-cdk/issues/8079)) ([0a3785b](https://github.com/aws/aws-cdk/commit/0a3785b7626633fcbdf26ab793c70f2bc017314b)), closes [#6162](https://github.com/aws/aws-cdk/issues/6162)
24+
* **codeguruprofiler:** ProfilingGroup ([#7895](https://github.com/aws/aws-cdk/issues/7895)) ([995088a](https://github.com/aws/aws-cdk/commit/995088abb00d9c75adbb65845998a8328bb5ba14))
25+
* **codepipeline:** use a special bootstrapless synthesizer for cross-region support Stacks ([#8091](https://github.com/aws/aws-cdk/issues/8091)) ([575f1db](https://github.com/aws/aws-cdk/commit/575f1db0474327c61c4ac626608c9f443ce231d2)), closes [#8082](https://github.com/aws/aws-cdk/issues/8082)
26+
* **cognito:** user pool - case sensitivity for sign in ([460394f](https://github.com/aws/aws-cdk/commit/460394f3dc4737cee80504d6c8ef106ecc3b67d5)), closes [#7988](https://github.com/aws/aws-cdk/issues/7988) [#7235](https://github.com/aws/aws-cdk/issues/7235)
27+
* **core:** CfnJson enables intrinsics in hash keys ([#8099](https://github.com/aws/aws-cdk/issues/8099)) ([195cd40](https://github.com/aws/aws-cdk/commit/195cd405d9f0869875de2ec78661aee3af2c7c7d)), closes [#8084](https://github.com/aws/aws-cdk/issues/8084)
28+
* **eks:** improve security using IRSA conditions ([#8084](https://github.com/aws/aws-cdk/issues/8084)) ([35a01a0](https://github.com/aws/aws-cdk/commit/35a01a079af40da291007da08af6690c9a81c101))
29+
* **elbv2:** Supports new types of listener rule conditions ([#7848](https://github.com/aws/aws-cdk/issues/7848)) ([3d30ffa](https://github.com/aws/aws-cdk/commit/3d30ffa38c51ae26686287e993af445ea3067766)), closes [#3888](https://github.com/aws/aws-cdk/issues/3888)
30+
* **secretsmanager:** adds grantWrite to Secret ([#7858](https://github.com/aws/aws-cdk/issues/7858)) ([3fed84b](https://github.com/aws/aws-cdk/commit/3fed84ba9eec3f53c662966e366aa629209b7bf5))
31+
* **sns:** add support for subscription DLQ in SNS ([383cdb8](https://github.com/aws/aws-cdk/commit/383cdb86effeafdf5d0767ed379b16b3d78a933b))
32+
* **stepfunctions:** new service integration classes for Lambda, SNS, and SQS ([#7946](https://github.com/aws/aws-cdk/issues/7946)) ([c038848](https://github.com/aws/aws-cdk/commit/c0388483524832ca7863de4ee9c472b8ab39de8e)), closes [#6715](https://github.com/aws/aws-cdk/issues/6715) [#6489](https://github.com/aws/aws-cdk/issues/6489)
33+
* **stepfunctions:** support paths in Pass state ([#8070](https://github.com/aws/aws-cdk/issues/8070)) ([86eac6a](https://github.com/aws/aws-cdk/commit/86eac6af074bf78a921c52d613eca0dd4a514a49)), closes [#7181](https://github.com/aws/aws-cdk/issues/7181)
34+
* **stepfunctions-tasks:** task for starting a job run in AWS Glue ([#8143](https://github.com/aws/aws-cdk/issues/8143)) ([a721e67](https://github.com/aws/aws-cdk/commit/a721e670cdc9888cd67ef1a24021004e18bfd23c))
35+
36+
37+
### Bug Fixes
38+
39+
* **apigateway:** contextAccountId in AccessLogField incorrectly resolves to requestId ([7b89e80](https://github.com/aws/aws-cdk/commit/7b89e805c716fa73d41cc97fcb728634e7a59136)), closes [#7952](https://github.com/aws/aws-cdk/issues/7952) [#7951](https://github.com/aws/aws-cdk/issues/7951)
40+
* **autoscaling:** add noDevice as a volume type ([#7253](https://github.com/aws/aws-cdk/issues/7253)) ([751958b](https://github.com/aws/aws-cdk/commit/751958b69225fdfc52622781c618f5a77f881fb6)), closes [#7242](https://github.com/aws/aws-cdk/issues/7242)
41+
* **aws-eks:** kubectlEnabled: false conflicts with addNodegroup ([#8119](https://github.com/aws/aws-cdk/issues/8119)) ([8610889](https://github.com/aws/aws-cdk/commit/86108890a51443dc06ec6325038c7b19cbdaee76)), closes [#7993](https://github.com/aws/aws-cdk/issues/7993)
42+
* **cli:** paper cuts ([#8164](https://github.com/aws/aws-cdk/issues/8164)) ([af2ea60](https://github.com/aws/aws-cdk/commit/af2ea60e7ae4aaab17ddd10a9142e1809b4c8246))
43+
* **dynamodb:** the maximum number of nonKeyAttributes is 100, not 20 ([#8186](https://github.com/aws/aws-cdk/issues/8186)) ([0393528](https://github.com/aws/aws-cdk/commit/03935280f1addef392c9b4460737cce8bb2eb8c9)), closes [#8095](https://github.com/aws/aws-cdk/issues/8095)
44+
* **eks:** unable to add multiple service accounts ([#8122](https://github.com/aws/aws-cdk/issues/8122)) ([524440c](https://github.com/aws/aws-cdk/commit/524440c5454d15276c92581a08d4ee7cad1790eb))
45+
* **events:** cannot use the same target account for 2 cross-account event sources ([#8068](https://github.com/aws/aws-cdk/issues/8068)) ([395c07c](https://github.com/aws/aws-cdk/commit/395c07c0cac7739743fc71d71fddd8880b608ead)), closes [#8010](https://github.com/aws/aws-cdk/issues/8010)
46+
* **lambda-nodejs:** build fails on Windows ([#8140](https://github.com/aws/aws-cdk/issues/8140)) ([04490b1](https://github.com/aws/aws-cdk/commit/04490b134a05ec34523541a3ca282ba8957a7964)), closes [#8107](https://github.com/aws/aws-cdk/issues/8107)
47+
* **cloudtrail:** better typed event selector apis ([#8097](https://github.com/aws/aws-cdk/issues/8097)) ([0028778](https://github.com/aws/aws-cdk/commit/0028778c0f00f2faa8dad25345cd17f311fad5da))
48+
549
## [1.41.0](https://github.com/aws/aws-cdk/compare/v1.40.0...v1.41.0) (2020-05-21)
650

751

CONTRIBUTING.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ you need to have the following SDKs and tools locally:
7777
- We recommend using a version in [Active LTS](https://nodejs.org/en/about/releases/)
7878
- ⚠️ versions `13.0.0` to `13.6.0` are not supported due to compatibility issues with our dependencies.
7979
- [Yarn >= 1.19.1](https://yarnpkg.com/lang/en/docs/install)
80-
- [Java OpenJDK 8](http://openjdk.java.net/install/)
80+
- [Java OpenJDK 8](https://docs.aws.amazon.com/corretto/latest/corretto-8-ug/downloads-list.html)
81+
- [Apache Maven](http://maven.apache.org/install.html)
8182
- [.NET Core SDK 3.1](https://www.microsoft.com/net/download)
8283
- [Python 3.6.5](https://www.python.org/downloads/release/python-365/)
8384
- [Ruby 2.5.1](https://www.ruby-lang.org/en/news/2018/03/28/ruby-2-5-1-released/)
@@ -91,6 +92,13 @@ $ yarn install
9192
$ yarn build
9293
```
9394

95+
If you get compiler errors when building, a common cause is globally installed tools like tslint and typescript. Try uninstalling them.
96+
97+
```
98+
npm uninstall -g tslint
99+
npm uninstall -g typescript
100+
```
101+
94102
Alternatively, the [Full Docker build](#full-docker-build) workflow can be used so
95103
that you don't have to worry about installing all those tools on your local machine
96104
and instead only depend on having a working Docker install.
@@ -197,7 +205,7 @@ Examples:
197205

198206
### Step 4: Commit
199207

200-
Create a commit with the proposed change changes:
208+
Create a commit with the proposed changes:
201209

202210
* Commit title and message (and PR title and description) must adhere to [conventionalcommits](https://www.conventionalcommits.org).
203211
* The title must begin with `feat(module): title`, `fix(module): title`, `refactor(module): title` or

lerna.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
"tools/*"
1111
],
1212
"rejectCycles": "true",
13-
"version": "1.41.0"
13+
"version": "1.42.0"
1414
}

package.json

+16-7
Original file line numberDiff line numberDiff line change
@@ -48,25 +48,34 @@
4848
"nohoist": [
4949
"**/jszip",
5050
"**/jszip/**",
51-
"@aws-cdk/cdk-assets-schema/semver",
52-
"@aws-cdk/cdk-assets-schema/semver/**",
53-
"@aws-cdk/core/minimatch",
54-
"@aws-cdk/core/minimatch/**",
55-
"@aws-cdk/cloudformation-include/yaml",
56-
"@aws-cdk/cloudformation-include/yaml/**",
5751
"@aws-cdk/aws-codepipeline-actions/case",
5852
"@aws-cdk/aws-codepipeline-actions/case/**",
5953
"@aws-cdk/aws-ecr-assets/minimatch",
6054
"@aws-cdk/aws-ecr-assets/minimatch/**",
6155
"@aws-cdk/aws-lambda-nodejs/parcel-bundler",
6256
"@aws-cdk/aws-lambda-nodejs/parcel-bundler/**",
57+
"@aws-cdk/cdk-assets-schema/semver",
58+
"@aws-cdk/cdk-assets-schema/semver/**",
6359
"@aws-cdk/cloud-assembly-schema/jsonschema",
6460
"@aws-cdk/cloud-assembly-schema/jsonschema/**",
6561
"@aws-cdk/cloud-assembly-schema/semver",
6662
"@aws-cdk/cloud-assembly-schema/semver/**",
63+
"@aws-cdk/cloudformation-include/yaml",
64+
"@aws-cdk/cloudformation-include/yaml/**",
65+
"@aws-cdk/core/minimatch",
66+
"@aws-cdk/core/minimatch/**",
6767
"@aws-cdk/cx-api/semver",
6868
"@aws-cdk/cx-api/semver/**",
69-
"@aws-cdk/cx-api/semver/**"
69+
"monocdk-experiment/case",
70+
"monocdk-experiment/case/**",
71+
"monocdk-experiment/jsonschema",
72+
"monocdk-experiment/jsonschema/**",
73+
"monocdk-experiment/minimatch",
74+
"monocdk-experiment/minimatch/**",
75+
"monocdk-experiment/semver",
76+
"monocdk-experiment/semver/**",
77+
"monocdk-experiment/yaml",
78+
"monocdk-experiment/yaml/**"
7079
]
7180
}
7281
}

packages/@aws-cdk/app-delivery/lib/pipeline-deploy-stack-action.ts

+16-2
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,27 @@ export interface PipelineDeployStackActionProps {
3232
*/
3333
readonly createChangeSetRunOrder?: number;
3434

35+
/**
36+
* The name of the CodePipeline action creating the ChangeSet.
37+
*
38+
* @default 'ChangeSet'
39+
*/
40+
readonly createChangeSetActionName?: string;
41+
3542
/**
3643
* The runOrder for the CodePipeline action executing the ChangeSet.
3744
*
3845
* @default ``createChangeSetRunOrder + 1``
3946
*/
4047
readonly executeChangeSetRunOrder?: number;
4148

49+
/**
50+
* The name of the CodePipeline action creating the ChangeSet.
51+
*
52+
* @default 'Execute'
53+
*/
54+
readonly executeChangeSetActionName?: string;
55+
4256
/**
4357
* IAM role to assume when deploying changes.
4458
*
@@ -116,7 +130,7 @@ export class PipelineDeployStackAction implements codepipeline.IAction {
116130
const changeSetName = props.changeSetName || 'CDK-CodePipeline-ChangeSet';
117131
const capabilities = cfnCapabilities(props.adminPermissions, props.capabilities);
118132
this.prepareChangeSetAction = new cpactions.CloudFormationCreateReplaceChangeSetAction({
119-
actionName: 'ChangeSet',
133+
actionName: props.createChangeSetActionName ?? 'ChangeSet',
120134
changeSetName,
121135
runOrder: createChangeSetRunOrder,
122136
stackName: props.stack.stackName,
@@ -126,7 +140,7 @@ export class PipelineDeployStackAction implements codepipeline.IAction {
126140
capabilities,
127141
});
128142
this.executeChangeSetAction = new cpactions.CloudFormationExecuteChangeSetAction({
129-
actionName: 'Execute',
143+
actionName: props.executeChangeSetActionName ?? 'Execute',
130144
changeSetName,
131145
runOrder: executeChangeSetRunOrder,
132146
stackName: this.stack.stackName,

packages/@aws-cdk/app-delivery/test/test.pipeline-deploy-stack-action.ts

+38-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { expect, haveResource, isSuperObject } from '@aws-cdk/assert';
1+
import { expect, haveResource, haveResourceLike, isSuperObject } from '@aws-cdk/assert';
22
import * as cfn from '@aws-cdk/aws-cloudformation';
33
import * as codebuild from '@aws-cdk/aws-codebuild';
44
import * as codepipeline from '@aws-cdk/aws-codepipeline';
@@ -406,6 +406,43 @@ export = nodeunit.testCase({
406406
);
407407
test.done();
408408
},
409+
410+
'allows overriding the ChangeSet and Execute action names'(test: nodeunit.Test) {
411+
const stack = getTestStack();
412+
const selfUpdatingPipeline = createSelfUpdatingStack(stack);
413+
selfUpdatingPipeline.pipeline.addStage({
414+
stageName: 'Deploy',
415+
actions: [
416+
new PipelineDeployStackAction({
417+
input: selfUpdatingPipeline.synthesizedApp,
418+
adminPermissions: true,
419+
stack,
420+
createChangeSetActionName: 'Prepare',
421+
executeChangeSetActionName: 'Deploy',
422+
}),
423+
],
424+
});
425+
426+
expect(stack).to(haveResourceLike('AWS::CodePipeline::Pipeline', {
427+
Stages: [
428+
{},
429+
{},
430+
{
431+
Name: 'Deploy',
432+
Actions: [
433+
{
434+
Name: 'Prepare',
435+
},
436+
{
437+
Name: 'Deploy',
438+
},
439+
],
440+
},
441+
],
442+
}));
443+
444+
test.done();
445+
},
409446
});
410447

411448
class FakeAction implements codepipeline.IAction {

packages/@aws-cdk/aws-cloudtrail/README.md

+6-7
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,12 @@ const trail = new cloudtrail.Trail(this, 'MyAmazingCloudTrail');
6666

6767
// Adds an event selector to the bucket magic-bucket.
6868
// By default, this includes management events and all operations (Read + Write)
69-
trail.addS3EventSelector(["arn:aws:s3:::magic-bucket/"]);
69+
trail.logAllS3DataEvents();
7070

71-
// Adds an event selector to the bucket foo, with a specific configuration
72-
trail.addS3EventSelector(["arn:aws:s3:::foo/"], {
73-
includeManagementEvents: false,
74-
readWriteType: ReadWriteType.ALL,
75-
});
71+
// Adds an event selector to the bucket foo
72+
trail.addS3EventSelector([{
73+
bucket: fooBucket // 'fooBucket' is of type s3.IBucket
74+
}]);
7675
```
7776

7877
For using CloudTrail event selector to log events about Lambda
@@ -90,7 +89,7 @@ const lambdaFunction = new lambda.Function(stack, 'AnAmazingFunction', {
9089
});
9190

9291
// Add an event selector to log data events for all functions in the account.
93-
trail.addLambdaEventSelector(["arn:aws:lambda"]);
92+
trail.logAllLambdaDataEvents();
9493

9594
// Add an event selector to log data events for the provided Lambda functions.
9695
trail.addLambdaEventSelector([lambdaFunction.functionArn]);

packages/@aws-cdk/aws-cloudtrail/lib/cloudtrail.ts

+46-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import * as events from '@aws-cdk/aws-events';
22
import * as iam from '@aws-cdk/aws-iam';
33
import * as kms from '@aws-cdk/aws-kms';
4+
import * as lambda from '@aws-cdk/aws-lambda';
45
import * as logs from '@aws-cdk/aws-logs';
56
import * as s3 from '@aws-cdk/aws-s3';
7+
import * as sns from '@aws-cdk/aws-sns';
68
import { Construct, Resource, Stack } from '@aws-cdk/core';
79
import { CfnTrail } from './cloudtrail.generated';
810

@@ -82,11 +84,11 @@ export interface TrailProps {
8284
*/
8385
readonly kmsKey?: kms.IKey;
8486

85-
/** The name of an Amazon SNS topic that is notified when new log files are published.
87+
/** SNS topic that is notified when new log files are published.
8688
*
8789
* @default - No notifications.
8890
*/
89-
readonly snsTopic?: string; // TODO: fix to use L2 SNS
91+
readonly snsTopic?: sns.ITopic;
9092

9193
/**
9294
* The name of the trail. We recoomend customers do not set an explicit name.
@@ -105,7 +107,7 @@ export interface TrailProps {
105107
*
106108
* @default - if not supplied a bucket will be created with all the correct permisions
107109
*/
108-
readonly bucket?: s3.IBucket
110+
readonly bucket?: s3.IBucket;
109111
}
110112

111113
/**
@@ -252,7 +254,7 @@ export class Trail extends Resource {
252254
s3KeyPrefix: props.s3KeyPrefix,
253255
cloudWatchLogsLogGroupArn: this.logGroup?.logGroupArn,
254256
cloudWatchLogsRoleArn: logsRole?.roleArn,
255-
snsTopicName: props.snsTopic,
257+
snsTopicName: props.snsTopic?.topicName,
256258
eventSelectors: this.eventSelectors,
257259
});
258260

@@ -316,13 +318,24 @@ export class Trail extends Resource {
316318
* Data events: These events provide insight into the resource operations performed on or within a resource.
317319
* These are also known as data plane operations.
318320
*
319-
* @param dataResourceValues the list of data resource ARNs to include in logging (maximum 250 entries).
321+
* @param handlers the list of lambda function handlers whose data events should be logged (maximum 250 entries).
320322
* @param options the options to configure logging of management and data events.
321323
*/
322-
public addLambdaEventSelector(dataResourceValues: string[], options: AddEventSelectorOptions = {}) {
324+
public addLambdaEventSelector(handlers: lambda.IFunction[], options: AddEventSelectorOptions = {}) {
325+
if (handlers.length === 0) { return; }
326+
const dataResourceValues = handlers.map((h) => h.functionArn);
323327
return this.addEventSelector(DataResourceType.LAMBDA_FUNCTION, dataResourceValues, options);
324328
}
325329

330+
/**
331+
* Log all Lamda data events for all lambda functions the account.
332+
* @see https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html
333+
* @default false
334+
*/
335+
public logAllLambdaDataEvents(options: AddEventSelectorOptions = {}) {
336+
return this.addEventSelector(DataResourceType.LAMBDA_FUNCTION, [ 'arn:aws:lambda' ], options);
337+
}
338+
326339
/**
327340
* When an event occurs in your account, CloudTrail evaluates whether the event matches the settings for your trails.
328341
* Only events that match your trail settings are delivered to your Amazon S3 bucket and Amazon CloudWatch Logs log group.
@@ -332,13 +345,24 @@ export class Trail extends Resource {
332345
* Data events: These events provide insight into the resource operations performed on or within a resource.
333346
* These are also known as data plane operations.
334347
*
335-
* @param dataResourceValues the list of data resource ARNs to include in logging (maximum 250 entries).
348+
* @param s3Selector the list of S3 bucket with optional prefix to include in logging (maximum 250 entries).
336349
* @param options the options to configure logging of management and data events.
337350
*/
338-
public addS3EventSelector(dataResourceValues: string[], options: AddEventSelectorOptions = {}) {
351+
public addS3EventSelector(s3Selector: S3EventSelector[], options: AddEventSelectorOptions = {}) {
352+
if (s3Selector.length === 0) { return; }
353+
const dataResourceValues = s3Selector.map((sel) => `${sel.bucket.bucketArn}/${sel.objectPrefix ?? ''}`);
339354
return this.addEventSelector(DataResourceType.S3_OBJECT, dataResourceValues, options);
340355
}
341356

357+
/**
358+
* Log all S3 data events for all objects for all buckets in the account.
359+
* @see https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html
360+
* @default false
361+
*/
362+
public logAllS3DataEvents(options: AddEventSelectorOptions = {}) {
363+
return this.addEventSelector(DataResourceType.S3_OBJECT, [ 'arn:aws:s3:::' ], options);
364+
}
365+
342366
/**
343367
* Create an event rule for when an event is recorded by any Trail in the account.
344368
*
@@ -373,6 +397,20 @@ export interface AddEventSelectorOptions {
373397
readonly includeManagementEvents?: boolean;
374398
}
375399

400+
/**
401+
* Selecting an S3 bucket and an optional prefix to be logged for data events.
402+
*/
403+
export interface S3EventSelector {
404+
/** S3 bucket */
405+
readonly bucket: s3.IBucket;
406+
407+
/**
408+
* Data events for objects whose key matches this prefix will be logged.
409+
* @default - all objects
410+
*/
411+
readonly objectPrefix?: string;
412+
}
413+
376414
/**
377415
* Resource type for a data event
378416
*/

packages/@aws-cdk/aws-cloudtrail/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
"@aws-cdk/aws-lambda": "0.0.0",
8080
"@aws-cdk/aws-logs": "0.0.0",
8181
"@aws-cdk/aws-s3": "0.0.0",
82+
"@aws-cdk/aws-sns": "0.0.0",
8283
"@aws-cdk/core": "0.0.0",
8384
"constructs": "^3.0.2"
8485
},
@@ -90,6 +91,7 @@
9091
"@aws-cdk/aws-lambda": "0.0.0",
9192
"@aws-cdk/aws-logs": "0.0.0",
9293
"@aws-cdk/aws-s3": "0.0.0",
94+
"@aws-cdk/aws-sns": "0.0.0",
9395
"@aws-cdk/core": "0.0.0",
9496
"constructs": "^3.0.2"
9597
},

0 commit comments

Comments
 (0)