Giter Site home page Giter Site logo

aws-samples / aws-cdk-examples Goto Github PK

View Code? Open in Web Editor NEW
4.8K 78.0 2.1K 112.13 MB

Example projects using the AWS CDK

License: Apache License 2.0

Shell 1.26% Java 11.02% TypeScript 26.95% Python 35.54% Dockerfile 0.41% JavaScript 4.93% HTML 1.24% C# 8.04% Batchfile 0.54% Go 9.90% CSS 0.15%
cdk cdk-examples

aws-cdk-examples's Introduction

AWS CDK Examples

This repository contains a set of example projects for the AWS Cloud Development Kit.

Table of Contents

  1. About this Repo
  2. Examples
  3. Learning Resources
  4. Additional Examples
  5. License

About this Repo

This repo is our official list of CDK example code. The repo is subdivided into sections for each language (see "Examples"). Each language has its own subsection of examples with the ultimate aim of complete language parity (same subset of examples exist in each language). These examples each provide a demonstration of a common service implementation, or infrastructure pattern that could be useful in your use of the CDK for building your own infrastructure.

We welcome contributions to this repo in the form of fixes to existing examples or addition of new examples. For more information on contributing, please see the CONTRIBUTING guide.

This is considered an intermediate learning resource and should typically be referenced after reading the Developer Guide or CDK Workshop (please see Learning Resources for more information on these resources).

Examples

This repo contains examples in each language supported by the CDK. Some languages are fully supported by JSII, but as additional languages are added, you will see those marked as Developer Preview. You can find the examples for each of those languages at the following links:

Language JSII Language-Stability
Typescript Examples Stable
Python Examples Stable
.NET Examples Stable
Java Examples Stable
Go Examples Stable

Learning Resources

While this is an excellent learning resource for the CDK, there are other resources that can be referenced to assist with your learning/development process.

Official Resources

Unofficial/Community Resources

If you have created a CDK learning resource and would like it to be listed here, please read the related CONTRIBUTING section for more info.

Additional Examples

The examples listed below are larger examples hosted in their own repositories that demonstrate more complex or complete CDK applications.

If you would like your repo to be listed here, please read the CONTRIBUTING guide for more details.

Example Description Owner
aws-cdk-changelogs-demo A full serverless Node.js application stack deployed using CDK. It uses AWS Lambda, AWS Fargate, DynamoDB, Elasticache, S3, and CloudFront. AWS

License

This library is licensed under the Apache 2.0 License.

aws-cdk-examples's People

Contributors

colethienes avatar dependabot[bot] avatar devokun avatar doug-aws avatar garnaat avatar iliapolo avatar its-mirus-lu avatar jpeddicord avatar kaiz-io avatar kaizencc avatar markusl avatar mmaeng avatar mrarnoldpalmer avatar ngl321 avatar njlynch avatar nutterzuk avatar piradeepk avatar rhboyd avatar rix0rrr avatar romainmuller avatar rupeshtiwari avatar ryparker avatar scottbrenner avatar shivlaks avatar skinny85 avatar somanyhs avatar vikrampatil-amz avatar weirdion avatar yaseenyounus avatar zechariahks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aws-cdk-examples's Issues

chat-app example doesn't work

When I try to compile it, I get the following errors:

 14/25 | 16:23:31 | CREATE_FAILED        | AWS::Lambda::Function        | AddPostBucket (AddPostBucket26725FA1) Your access has been denied by S3, please make sure your request credentials have permission to GetObject for dougs-chat-app/AddPost.zip. S3 Error Code: AccessDenied. S3 Error Message: Access Denied (Service: AWSLambdaInternal; Status Code: 403; Error Code: AccessDeniedException; Request ID: 53caf947-2aec-11e9-9827-d719b354a89a)
	new Function (/home/local/ANT/huijbers/Workspaces/PublicCDK/aws-cdk-examples/typescript/chat-app/node_modules/@aws-cdk/aws-lambda/lib/lambda.js:62:26)
	\_ new ChatAppFunction (/home/local/ANT/huijbers/Workspaces/PublicCDK/aws-cdk-examples/typescript/chat-app/index.js:63:9)
	\_ new MyStack (/home/local/ANT/huijbers/Workspaces/PublicCDK/aws-cdk-examples/typescript/chat-app/index.js:44:9)
	\_ Object.<anonymous> (/home/local/ANT/huijbers/Workspaces/PublicCDK/aws-cdk-examples/typescript/chat-app/index.js:73:1)
	\_ Module._compile (module.js:652:30)
	\_ Object.Module._extensions..js (module.js:663:10)
	\_ Module.load (module.js:565:32)
	\_ tryModuleLoad (module.js:505:12)
	\_ Function.Module._load (module.js:497:3)
	\_ Function.Module.runMain (module.js:693:10)
	\_ startup (bootstrap_node.js:191:16)
	\_ bootstrap_node.js:612:3

Seems like it's using a hardcoded S3 bucket that I don't have access to. That should probably be replaced with assets.

Can not synthesize CloudFormation template for fargate-service-with-auto-scaling

🐛 Bug Report

What is the problem?

Can not synthesize CloudFormation template for fargate-service-with-auto-scaling

Reproduction Steps

git clone https://github.com/aws-samples/aws-cdk-examples.git
cd aws-cdk-examples/typescript/ecs/fargate-service-with-auto-scaling
npm install
npm run build

Verbose Log

> [email protected] build /home/ec2-user/environment/aws-cdk-examples/typescript/ecs/fargate-service-with-auto-scaling
> tsc

index.ts:17:7 - error TS2345: Argument of type '{ cluster: Cluster; image: RepositoryImage; }' is not assignable to parameter of type 'NetworkLoadBalancedFargateServiceProps'.
  Object literal may only specify known properties, and 'image' does not exist in type 'NetworkLoadBalancedFargateServiceProps'.

17       image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample")
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 1 error.

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: `tsc`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ec2-user/.npm/_logs/2019-10-07T18_43_55_681Z-debug.log

Environment

  • CDK CLI Version: 1.12.0 (build 923055e)
  • OS: Linux ip-172-31-26-69 4.14.143-91.122.amzn1.x86_64 1 SMP Wed Sep 11 00:43:34 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
  • Language: TypeScript

One of the Python examples breaks the CI build.

🐛 Bug Report

What is the problem?

The CI build for this package is failing currently. There is a problem with building one of the Python examples with this exception:

TypeError: __init__() got an unexpected keyword argument 'subnetType'

Verbose Log

==============================
building project: /home/travis/build/aws-samples/aws-cdk-examples/scripts/../python/ecs/cluster/requirements.txt
==============================

Traceback (most recent call last):
  File "app.py", line 40, in <module>
    ECSCluster(app, "MyFirstEcsCluster")
  File "/tmp/.venv/lib/python3.6/site-packages/jsii/_runtime.py", line 66, in __call__
    inst = super().__call__(*args, **kwargs)
  File "app.py", line 27, in __init__
    vpc_subnets={'subnetType': ec2.SubnetType.PUBLIC}
  File "/tmp/.venv/lib/python3.6/site-packages/jsii/_runtime.py", line 66, in __call__
    inst = super().__call__(*args, **kwargs)
  ...
  File "/tmp/.venv/lib/python3.6/site-packages/aws_cdk/aws_autoscaling/__init__.py", line 4152, in __init__
    if isinstance(vpc_subnets, dict): vpc_subnets = aws_cdk.aws_ec2.SubnetSelection(**vpc_subnets)
TypeError: __init__() got an unexpected keyword argument 'subnetType'

Full log: https://gist.github.com/pimlock/745a7fb8665dca2e6b10aabadb225786

Typescript examples fail to run support scripts with latest CDK releases

Describe the bug
The support scripts will no longer build with the latest releases of the CDK. They fail with the below error.

To Reproduce
Attempt to run either "scripts/build.sh" OR "scripts/build-npm.sh"

Expected behavior

> [email protected] build /codebuild/output/src827049164/src/typescript/elasticbeanstalk/elasticbeanstalk-environment 
> tsc 
 
index.ts(13,27): error TS2551: Property 'getContext' does not exist on type 'ConstructNode'. Did you mean 'setContext'? 
npm ERR! code ELIFECYCLE 
npm ERR! errno 2 
npm ERR! [email protected] build: `tsc` 
npm ERR! Exit status 2 
npm ERR!  
npm ERR! Failed at the [email protected] build script. 
npm ERR! This is probably not a problem with npm. There is likely additional logging output above. 
 
npm ERR! A complete log of this run can be found in: 
npm ERR!     /root/.npm/_logs/2019-06-11T12_38_31_507Z-debug.log 
 
[Container] 2019/06/11 12:38:31 Command did not exit successfully chmod +x scripts/*.sh && scripts/build.sh exit status 1 
[Container] 2019/06/11 12:38:31 Phase complete: BUILD State: FAILED 
[Container] 2019/06/11 12:38:31 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: chmod +x scripts/*.sh && scripts/build.sh. Reason: exit status 1 
[Container] 2019/06/11 12:38:31 Entering phase POST_BUILD 
[Container] 2019/06/11 12:38:31 Phase complete: POST_BUILD State: SUCCEEDED 
[Container] 2019/06/11 12:38:31 Phase context status code:  Message:  

Version:

  • OS: OSX-10.13.6 (High Sierra)
  • Programming Language: Typescript
  • CDK Version: 0.34.0

typescript Elastic Beanstalk: cdk deploy fails with CREATE_FAILED

🐛 Bug Report

What is the problem?

The example (typescript/elasticbeanstalk/elasticbeanstalk-environment) fails to deploy with the message:

 3/4 | 10:48:34 AM | CREATE_FAILED        | AWS::ElasticBeanstalk::Environment | Environment Environment failed to launch as it entered Terminated state
	new CdkStack (/Users/tim/Projects/cl/dad/ct/aws-cdk-examples/typescript/elasticbeanstalk/elasticbeanstalk-environment/index.js:16:9)
	\_ Object.<anonymous> (/Users/tim/Projects/cl/dad/ct/aws-cdk-examples/typescript/elasticbeanstalk/elasticbeanstalk-environment/index.js:25:1)
	\_ Module._compile (internal/modules/cjs/loader.js:701:30)
	\_ Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
	\_ Module.load (internal/modules/cjs/loader.js:600:32)
	\_ tryModuleLoad (internal/modules/cjs/loader.js:539:12)
	\_ Function.Module._load (internal/modules/cjs/loader.js:531:3)
	\_ Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
	\_ startup (internal/bootstrap/node.js:283:19)
	\_ bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

Reproduction Steps

  • modified the platformARN to region 'eu-central-1' for my account, because the example for the 'us-east-1' region cannot be used with my account.
  • Follow the steps in the README.md
  • cdk deploy --profile MY_PROFILE fails

Verbose Log

~/P/c/d/c/a/t/e/elasticbeanstalk-environment » cdk deploy --profile ct-stage                                                                                                      master ✗
ElasticBeanstalk: deploying...
ElasticBeanstalk: creating CloudFormation changeset...
 0/4 | 10:48:01 AM | CREATE_IN_PROGRESS   | AWS::ElasticBeanstalk::Application | Application
 0/4 | 10:48:01 AM | CREATE_IN_PROGRESS   | AWS::CDK::Metadata                 | CDKMetadata
 0/4 | 10:48:02 AM | CREATE_IN_PROGRESS   | AWS::ElasticBeanstalk::Environment | Environment
 0/4 | 10:48:02 AM | CREATE_IN_PROGRESS   | AWS::ElasticBeanstalk::Application | Application Resource creation Initiated
 1/4 | 10:48:02 AM | CREATE_COMPLETE      | AWS::ElasticBeanstalk::Application | Application
 1/4 | 10:48:03 AM | CREATE_IN_PROGRESS   | AWS::CDK::Metadata                 | CDKMetadata Resource creation Initiated
 2/4 | 10:48:03 AM | CREATE_COMPLETE      | AWS::CDK::Metadata                 | CDKMetadata
 2/4 | 10:48:03 AM | CREATE_IN_PROGRESS   | AWS::ElasticBeanstalk::Environment | Environment Resource creation Initiated
 3/4 | 10:48:34 AM | CREATE_FAILED        | AWS::ElasticBeanstalk::Environment | Environment Environment failed to launch as it entered Terminated state
	new CdkStack (/Users/tim/Projects/cl/dad/ct/aws-cdk-examples/typescript/elasticbeanstalk/elasticbeanstalk-environment/index.js:16:9)
	\_ Object.<anonymous> (/Users/tim/Projects/cl/dad/ct/aws-cdk-examples/typescript/elasticbeanstalk/elasticbeanstalk-environment/index.js:25:1)
	\_ Module._compile (internal/modules/cjs/loader.js:701:30)
	\_ Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
	\_ Module.load (internal/modules/cjs/loader.js:600:32)
	\_ tryModuleLoad (internal/modules/cjs/loader.js:539:12)
	\_ Function.Module._load (internal/modules/cjs/loader.js:531:3)
	\_ Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
	\_ startup (internal/bootstrap/node.js:283:19)
	\_ bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
 3/4 | 10:48:34 AM | ROLLBACK_IN_PROGRESS | AWS::CloudFormation::Stack         | ElasticBeanstalk The following resource(s) failed to create: [Environment]. . Rollback requested by user.
 3/4 | 10:48:48 AM | DELETE_IN_PROGRESS   | AWS::ElasticBeanstalk::Application | Application
 3/4 | 10:48:48 AM | DELETE_IN_PROGRESS   | AWS::ElasticBeanstalk::Environment | Environment
 3/4 | 10:48:48 AM | DELETE_IN_PROGRESS   | AWS::CDK::Metadata                 | CDKMetadata
 4/4 | 10:48:49 AM | DELETE_COMPLETE      | AWS::ElasticBeanstalk::Environment | Environment
 5/4 | 10:48:49 AM | DELETE_COMPLETE      | AWS::CDK::Metadata                 | CDKMetadata
 6/4 | 10:49:19 AM | DELETE_COMPLETE      | AWS::ElasticBeanstalk::Application | Application
 7/4 | 10:49:20 AM | ROLLBACK_COMPLETE    | AWS::CloudFormation::Stack         | ElasticBeanstalk

 ❌  ElasticBeanstalk failed: Error: The stack named ElasticBeanstalk failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE
The stack named ElasticBeanstalk failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE

Environment

  • CDK CLI Version: 1.6.1 (build a09203a)
  • Example: typescript/elasticbeanstalk/elasticbeanstalk-environment
  • Example Version: 1.0.0
  • OS: OSX Mojave
  • Language: Typescript

Other information

There's a stackoverflow question by somebody else, that suggest specifying solutionStack, but that didn't work for me. There was an error message, that you cannot specify both solution and platform:
https://stackoverflow.com/questions/55259705/elastic-beanstalk-with-aws-cdk-on-higher-level-than-resources

Custom-Resource example is no longer working

🐛 Bug Report

What is the problem?

The supplied example for custom-resource is no longer compiling. I assume something must have changed in the underlying APIs.

Reproduction Steps

Create a new typescript file with the code supplied and see the errors

Verbose Log

Argument of type 'this' is not assignable to parameter of type 'Construct'.
Type 'MyCustomResource' is not assignable to type 'Construct'.
Types of property 'node' are incompatible.

Argument of type 'SingletonFunction' is not assignable to parameter of type 'IFunction'.
Types of property 'role' are incompatible.

Environment

  • CDK CLI Version: 1.10.1 (build 82f8ec6)
  • Example: Custom-Resources
  • Example Version:
  • OS: Windows (Windows Subsystem for Linux using Ubuntu 18.04)
  • Language: TypeScript

Other information

It seems that the type Lamba Function is not compatible with the interface IFunction

I would love to see a more detailed example.

typescript/appsync-graphql-dynamodb doesn't deploy

I've encountered several issues trying to build the typescript/appsync-graphql-dynamodb example

my first stab at issues encountered are with #78

First issues are, managed policy name is invalid:

1/12 | 10:55:37 AM | CREATE_FAILED        | AWS::IAM::Role              | ItemsDynamoDBRole (ItemsDynamoDBRole7D2E3F6D) ARN arn:aws:iam::aws:policy/arn:aws:iam::aws:policy/AmazonDynamoDBFullAccess is not valid. (Service: AmazonIdentityManagement; Status Code: 400; Error Code: InvalidInput; Request ID: fcceddf5-a718-11e9-af4c-c54d1a8d020e)
	new Role (/Users/yolk/code/arturo/aws-samples/aws-cdk-examples/typescript/appsync-graphql-dynamodb/node_modules/@aws-cdk/aws-iam/lib/role.js:30:22)
	\_ new AppSyncCdkStack (/Users/yolk/code/arturo/aws-samples/aws-cdk-examples/typescript/appsync-graphql-dynamodb/index.js:50:32)
	\_ Object.<anonymous> (/Users/yolk/code/arturo/aws-samples/aws-cdk-examples/typescript/appsync-graphql-dynamodb/index.js:130:1)
	\_ Module._compile (internal/modules/cjs/loader.js:776:30)
	\_ Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
	\_ Module.load (internal/modules/cjs/loader.js:643:32)
	\_ Function.Module._load (internal/modules/cjs/loader.js:556:12)
	\_ Function.Module.runMain (internal/modules/cjs/loader.js:839:10)
	\_ internal/main/run_main_module.js:17:11

next, it fails to create any of the Query's because a reference in ApiSchema to the itemsTable exists through locals, but due to the stand-up-order, an addDependsOn is required for it to stand up without failure. (At least that's been my experience).. see #78

How to include node_modules when using typescript aws-cdk?

❓ How to include node_modules using typescript aws-cdk?

My lambda is supposed to rely on the whole bunch of different modules, part of which is private.
How should I tackle this problem with conformity with aws-cdk?

Environment

  • CDK CLI Version: 1.6.0 (build 3a0cde0)
  • OS: all
  • Language: TypeScript

Other information

Could you provide example when used some external node module, axios or joi or something else?

Lacking examples of managing/deploying Python dependencies

❓ Guidance Question

The Question

As mentioned in aws/aws-cdk#3660, we are lacking a good example of a more realistic Lambda which includes dependencies. How should a developer ensure that handlers are packaged with their required dependencies? The current examples/boilerplate code only seems to demonstrate managing deployment code (i.e. cdk dependencies) but does not demonstrate best-practice for handling runtime dependencies.

Perhaps the correct solution is to utilize Lambda Layers to package dependencies? If so, it would be helpful to have that demonstrated in an example project.

Whatever the solution, it should demonstrate:

  • separating runtime dependencies from build-time dependencies

Additionally, it would be nice if we could demonstrate:

  • supporting the concept of packaging different handlers with only the dependencies that they need

Fargate LoadBalanced Service examples are broken

🐛 Bug Report

What is the problem?

The Fargate LoadBalanced Service examples for TypeScript and Python are out of date. A breaking change was made (aws/aws-cdk#3719) and the name of the Fargate service needs to be changed in the examples.

Reproduction Steps

Just try to build/synthesize either example. You will see the error.

Verbose Log

Environment

  • CDK CLI Version: 1.8.0 (build 5244f97)
  • Example: Fargate Load Balanced Service
  • Example Version:
  • OS: all
  • Language: TypeScript | Python

Other information

api-cors-lambda-crud-dynamodb needs asset s3

the cdk deploy --profile myprofile action doesn't work, complaining that: "This stack uses assets, so the toolkit stack must be deployed to the environment". Not easy to find the fix for this.

Perhaps some doco on where to get this toolkit stack from? else info on using the cdk bootstrap command, in particular, what is an environment (i have heard of that in terms of elastic beanstalk, but what does environment mean in terms of CDK?).

resource-override "Encountered unsupported property Token" for s3

cdk deploy fails due with below terminal output from committed version of repo.

No additional repro steps

CDK Version: 0.37.0
Module Version: 0.23.0
OS: MacOS High Sierra (zsh shell)

  9/22 | 11:40:38 AM | CREATE_FAILED        | AWS::S3::Bucket                       | MyBucket (MyBucketF68F3FF0) Encountered unsupported property Token
        new Bucket (~/aws-cdk-examples/typescript/resource-overrides/node_modules/@aws-cdk/aws-s3/lib/bucket.js:334:26)
        \_ new ResourceOverridesExample (~/aws-cdk-examples/typescript/resource-overrides/index.js:12:24)
        \_ Object.<anonymous> (~/aws-cdk-examples/typescript/resource-overrides/index.js:96:1)
        \_ Module._compile (internal/modules/cjs/loader.js:759:30)
        \_ Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
        \_ Module.load (internal/modules/cjs/loader.js:628:32)
        \_ Function.Module._load (internal/modules/cjs/loader.js:555:12)
        \_ Function.Module.runMain (internal/modules/cjs/loader.js:822:10)
        \_ internal/main/run_main_module.js:17:11
 10/22 | 11:40:38 AM | CREATE_FAILED        | AWS::EC2::Subnet                      | VPC/PrivateSubnet1/Subnet (VPCPrivateSubnet1Subnet8BCA10E0) Resource creation cancelled
        new Subnet (~/aws-cdk-examples/typescript/resource-overrides/node_modules/@aws-cdk/aws-ec2/lib/vpc.js:473:24)
        \_ new PrivateSubnet (~/aws-cdk-examples/typescript/resource-overrides/node_modules/@aws-cdk/aws-ec2/lib/vpc.js:568:9)
        \_ ~/aws-cdk-examples/typescript/resource-overrides/node_modules/@aws-cdk/aws-ec2/lib/vpc.js:407:43
        \_ Array.forEach (<anonymous>)
        \_ Vpc.createSubnetResources (~/aws-cdk-examples/typescript/resource-overrides/node_modules/@aws-cdk/aws-ec2/lib/vpc.js:386:32)
        \_ Vpc.createSubnets (~/aws-cdk-examples/typescript/resource-overrides/node_modules/@aws-cdk/aws-ec2/lib/vpc.js:382:18)
        \_ new Vpc (~/aws-cdk-examples/typescript/resource-overrides/node_modules/@aws-cdk/aws-ec2/lib/vpc.js:222:14)
        \_ new ResourceOverridesExample (~/aws-cdk-examples/typescript/resource-overrides/index.js:80:21)
        \_ Object.<anonymous> (~/aws-cdk-examples/typescript/resource-overrides/index.js:96:1)
        \_ Module._compile (internal/modules/cjs/loader.js:759:30)
        \_ Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
        \_ Module.load (internal/modules/cjs/loader.js:628:32)
        \_ Function.Module._load (internal/modules/cjs/loader.js:555:12)
        \_ Function.Module.runMain (internal/modules/cjs/loader.js:822:10)
        \_ internal/main/run_main_module.js:17:11
 11/22 | 11:40:38 AM | CREATE_FAILED        | AWS::IAM::InstanceProfile             | ASG/InstanceProfile (ASGInstanceProfile0A2834D7) Resource creation cancelled
        new AutoScalingGroup (~/aws-cdk-examples/typescript/resource-overrides/node_modules/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.js:133:28)
        \_ new ResourceOverridesExample (~/aws-cdk-examples/typescript/resource-overrides/index.js:81:21)
        \_ Object.<anonymous> (~/aws-cdk-examples/typescript/resource-overrides/index.js:96:1)
        \_ Module._compile (internal/modules/cjs/loader.js:759:30)
        \_ Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
        \_ Module.load (internal/modules/cjs/loader.js:628:32)
        \_ Function.Module._load (internal/modules/cjs/loader.js:555:12)
        \_ Function.Module.runMain (internal/modules/cjs/loader.js:822:10)
        \_ internal/main/run_main_module.js:17:11
 12/22 | 11:40:38 AM | CREATE_FAILED        | AWS::EC2::VPCGatewayAttachment        | VPC/VPCGW (VPCVPCGW99B986DC) Resource creation cancelled
        new Vpc (~/aws-cdk-examples/typescript/resource-overrides/node_modules/@aws-cdk/aws-ec2/lib/vpc.js:228:25)
        \_ new ResourceOverridesExample (~/aws-cdk-examples/typescript/resource-overrides/index.js:80:21)
        \_ Object.<anonymous> (~/aws-cdk-examples/typescript/resource-overrides/index.js:96:1)
        \_ Module._compile (internal/modules/cjs/loader.js:759:30)
        \_ Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
        \_ Module.load (internal/modules/cjs/loader.js:628:32)
        \_ Function.Module._load (internal/modules/cjs/loader.js:555:12)
        \_ Function.Module.runMain (internal/modules/cjs/loader.js:822:10)
        \_ internal/main/run_main_module.js:17:11
 13/22 | 11:40:38 AM | CREATE_FAILED        | AWS::EC2::Subnet                      | VPC/PublicSubnet1/Subnet (VPCPublicSubnet1SubnetB4246D30) Resource creation cancelled
        new Subnet (~/aws-cdk-examples/typescript/resource-overrides/node_modules/@aws-cdk/aws-ec2/lib/vpc.js:473:24)
        \_ new PublicSubnet (~/aws-cdk-examples/typescript/resource-overrides/node_modules/@aws-cdk/aws-ec2/lib/vpc.js:541:9)
        \_ ~/aws-cdk-examples/typescript/resource-overrides/node_modules/@aws-cdk/aws-ec2/lib/vpc.js:402:42
        \_ Array.forEach (<anonymous>)
        \_ Vpc.createSubnetResources (~/aws-cdk-examples/typescript/resource-overrides/node_modules/@aws-cdk/aws-ec2/lib/vpc.js:386:32)
        \_ Vpc.createSubnets (~/aws-cdk-examples/typescript/resource-overrides/node_modules/@aws-cdk/aws-ec2/lib/vpc.js:382:18)
        \_ new Vpc (~/aws-cdk-examples/typescript/resource-overrides/node_modules/@aws-cdk/aws-ec2/lib/vpc.js:222:14)
        \_ new ResourceOverridesExample (~/aws-cdk-examples/typescript/resource-overrides/index.js:80:21)
        \_ Object.<anonymous> (~/aws-cdk-examples/typescript/resource-overrides/index.js:96:1)
        \_ Module._compile (internal/modules/cjs/loader.js:759:30)
        \_ Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
        \_ Module.load (internal/modules/cjs/loader.js:628:32)
        \_ Function.Module._load (internal/modules/cjs/loader.js:555:12)
        \_ Function.Module.runMain (internal/modules/cjs/loader.js:822:10)
        \_ internal/main/run_main_module.js:17:11
 14/22 | 11:40:38 AM | CREATE_FAILED        | AWS::EC2::SecurityGroup               | ASG/InstanceSecurityGroup (ASGInstanceSecurityGroup0525485D) Resource creation cancelled
        new SecurityGroup (~/aws-cdk-examples/typescript/resource-overrides/node_modules/@aws-cdk/aws-ec2/lib/security-group.js:141:30)
        \_ new AutoScalingGroup (~/aws-cdk-examples/typescript/resource-overrides/node_modules/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.js:123:30)
        \_ new ResourceOverridesExample (~/aws-cdk-examples/typescript/resource-overrides/index.js:81:21)
        \_ Object.<anonymous> (~/aws-cdk-examples/typescript/resource-overrides/index.js:96:1)
        \_ Module._compile (internal/modules/cjs/loader.js:759:30)
        \_ Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
        \_ Module.load (internal/modules/cjs/loader.js:628:32)
        \_ Function.Module._load (internal/modules/cjs/loader.js:555:12)
        \_ Function.Module.runMain (internal/modules/cjs/loader.js:822:10)
        \_ internal/main/run_main_module.js:17:11

SAM Example

🚀 Feature Request

General Information

  • 👋 I may be able to implement this feature request

Description

Example for using the CDK with AWS SAM as detailed here

_EDIT: See here for example

my-widget-service example does not work - Cannot find module './widget_service'.

Tried the following as suggested in the README:

$ npm install -g aws-cdk
$ cd typescript/my-widget-service
$ npm install
$ npm run build

results:

~/om/github.com/aws-samples/aws-cdk-examples/typescript/my-widget-service$ npm version
{ 'my-widget-service': '0.1.0',
  npm: '6.4.1',
  ares: '1.14.0',
  cldr: '33.1',
  http_parser: '2.8.0',
  icu: '62.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.34.0',
  node: '10.14.1',
  openssl: '1.1.0j',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.23.2',
  v8: '6.8.275.32-node.36',
  zlib: '1.2.11' }
~/om/github.com/aws-samples/aws-cdk-examples/typescript/my-widget-service$ npm run build

> [email protected] build /Users/pquiring/om/github.com/aws-samples/aws-cdk-examples/typescript/my-widget-service
> tsc

index.ts:3:33 - error TS2307: Cannot find module './widget_service'.

3 import widget_service = require('./widget_service');
                                  ~~~~~~~~~~~~~~~~~~


Found 1 error.

cdk.json

What generates the cdk.json that --app is required either in command-line, in cdk.json or in ~/.cdk.json demands? I end up just creating the cdk.json file like so manually: { "app": "node index" }

EventRule must be changed to Rule

On the examples for python using the cdk, there's an example for lambda-cron that doesn't work when doing the cdk synth command.

AttributeError: module 'aws_cdk.aws_events' has no attribute 'EventRule'

After taking a look on the cdk code, i could verify that EventRule has been changed to Rule only.

https://github.com/awslabs/aws-cdk/blob/master/packages/%40aws-cdk/aws-events/lib/rule.ts

This is still not documented on the official cdk documentation and could affect all examples that uses EventRule for the various programming languages.

Using AWS from CLI

Hi, I am trying to use CDK deploy from the command line and on some default python resources, from https://github.com/aws-samples/aws-cdk-examples.

When I install the dependencies successfully and try deploying, I get the following messages.

One possible reason is a firewall, but I'm not on one. The message is exactly

"Inaccessible host: cloudformation.oregon.amazonaws.com'. This service may not be available in the Oregon' region."

Any ideas how to fix this or work through it?

The certificate that is attached to your distribution doesn't cover the alternate domain name (CNAME) that you're trying to add

🐛 Bug Report

What is the problem?

Ran into a bunch of issues running https://github.com/aws-samples/aws-cdk-examples/tree/master/typescript/static-site/

Last one being

The certificate that is attached to your distribution doesn't cover the alternate domain name (CNAME) that you're trying to add

Reproduction Steps

cdk deploy -c domain=webconverger.com -c subdomain=talks

Verbose Log

https://s.natalian.org/2019-08-14/cdk.txt

I already have a *.webconverger.com certificate issued arn:aws:acm:us-east-1:407461997746:certificate/5efcc663-6e6c-43b3-bab0-49ad36b27152 so I am a little puzzled why it is:

  1. creating a webconverger.com one instead of a talks.webconverger.com one
  2. not simply using the existing wildcard certificate

Environment

Archlinux user

[hendry@t480s static-site]$ git describe --always
e8d9b04
[hendry@t480s static-site]$ cdk --version
1.3.0 (build bba9914)

Create FargateService with existing FargateTaskDefinitionArn

❓ Guidance Question

I am trying to create a ecs.FargateService with existing fargateTaskDefinitionArn. However, the taskDefinition property expects ecs.TaskDefintion but fromFargateTaskDefinitionArn() returns ecs.IFargateTaskDefinition.

Any sample or guidance is appreciated.

圖片

圖片

The Question

Environment

  • CDK CLI Version: 1.6.1 (build a09203a)
  • Example:
  • Example Version:
  • OS: OSX Mojave
  • Language: TypeScript

Other information

CREATE_FAILED when running "cdk deploy"

Hi, I am new to CDK and considering using it. I am trying to get the AppSyncGraphQLDynamoDB example working. When I run cdk deploy I get the following error:

  0/12 | 08:47:22 | CREATE_IN_PROGRESS   | AWS::IAM::Role              | ItemsDynamoDBRole (ItemsDynamoDBRole7D2E3F6D) 
  0/12 | 08:47:22 | CREATE_IN_PROGRESS   | AWS::IAM::Role              | ItemsDynamoDBRole (ItemsDynamoDBRole7D2E3F6D) Resource creation Initiated
  0/12 | 08:47:22 | CREATE_IN_PROGRESS   | AWS::DynamoDB::Table        | ItemsTable (ItemsTable5AAC2C46) Resource creation Initiated
  1/12 | 08:47:22 | CREATE_FAILED        | AWS::IAM::Role              | ItemsDynamoDBRole (ItemsDynamoDBRole7D2E3F6D) ARN arn:aws:iam::aws:policy/arn:aws:iam::aws:policy/AmazonDynamoDBFullAccess is not valid. (Service: AmazonIdentityManagement; Status Code: 400; Error Code: InvalidInput; Request ID: fda7a95a-aaca-11e9-8b34-71c203c1eb46)
        new Role (/home/ec2-user/environment/kloudkrypt/node_modules/@aws-cdk/aws-iam/lib/role.js:30:22)
        \_ new AppSyncCdkStack (/home/ec2-user/environment/kloudkrypt/index.js:50:32)
        \_ Object.<anonymous> (/home/ec2-user/environment/kloudkrypt/index.js:130:1)
        \_ Module._compile (module.js:653:30)
        \_ Object.Module._extensions..js (module.js:664:10)
        \_ Module.load (module.js:566:32)
        \_ tryModuleLoad (module.js:506:12)
        \_ Function.Module._load (module.js:498:3)
        \_ Function.Module.runMain (module.js:694:10)
        \_ startup (bootstrap_node.js:204:16)
        \_ bootstrap_node.js:625:3

Any suggestions?

Thanks,
-Derek

Move example list to sub-directories

🚀 Feature Request

General Information

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

Description

Can we break up the list of examples in the README.md into separate README.mds in each language's sub-directory, it leads to quite a few merge conflicts with the current design. The main README.md would then just contain pointers to each language's specific list of examples.

Proposed Solution

1 README.md -> 5 README.mds (one in each language directory

Environment

Github

Other information

CfnJob (aws_glue): jsii.errors.JavaScriptError

I'm trying to create a Glue job (aws_cdk.aws_glue.CfnJob) here, but I'm failing to set the command attribute...

`from aws_cdk import (
aws_glue as glue,
aws_iam as iam,
core
)

class ScheduledGlueJob (core.Stack):

def __init__(self, scope: core.Construct, id: str, **kwargs) -> None:
    super().__init__(scope, id, **kwargs)

    policy_statement = iam.PolicyStatement(
            actions=['logs:*','s3:*','ec2:*','iam:*','cloudwatch:*','dynamodb:*','glue:*']
        )

    policy_statement.add_all_resources()

    glue_job_role = iam.Role(
        self,
        'Glue-Job-Role',
        assumed_by=iam.ServicePrincipal('glue.amazonaws.com')
    ).add_to_policy(
        policy_statement
    )

    job = glue.CfnJob(
        self,
        'glue-test-job',
        role=glue_job_role,
        allocated_capacity=10,
        command=glue.CfnJob.JobCommandProperty(
            name='glueetl',
            script_location='s3://cf-article-statistics-master-artifacts/glue-scripts/permutive-pageview-count-per-article.scala'
        ))`

Output:

jsii.errors.JavaScriptError:
Error: Expected 'string', got true (boolean)
at Object.deserialize (/Users/d439087/IdeaProjects/ds/test_cdk/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:12004:23)
at Kernel._toSandbox (/Users/d439087/IdeaProjects/ds/test_cdk/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:7026:61)
at /Users/d439087/IdeaProjects/ds/test_cdk/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:12165:29
at mapValues (/Users/d439087/IdeaProjects/ds/test_cdk/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:12394:27)
at Object.deserialize (/Users/d439087/IdeaProjects/ds/test_cdk/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:12161:20)
at Kernel._toSandbox (/Users/d439087/IdeaProjects/ds/test_cdk/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:7026:61)
at /Users/d439087/IdeaProjects/ds/test_cdk/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:7079:33
at Array.map ()
at Kernel._boxUnboxParameters (/Users/d439087/IdeaProjects/ds/test_cdk/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:7079:19)
at Kernel._wrapSandboxCode (/Users/d439087/IdeaProjects/ds/test_cdk/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:7129:19)
at Kernel._create (/Users/d439087/IdeaProjects/ds/test_cdk/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6661:26)
at Kernel.create (/Users/d439087/IdeaProjects/ds/test_cdk/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6414:21)
at KernelHost.processRequest (/Users/d439087/IdeaProjects/ds/test_cdk/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6186:28)
at KernelHost.run (/Users/d439087/IdeaProjects/ds/test_cdk/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6132:14)
at /Users/d439087/IdeaProjects/ds/test_cdk/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6132:45
at KernelHost.processRequest (/Users/d439087/IdeaProjects/ds/test_cdk/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6228:16)
at KernelHost.run (/Users/d439087/IdeaProjects/ds/test_cdk/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6132:14)
at /Users/d439087/IdeaProjects/ds/test_cdk/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6132:45
at KernelHost.processRequest (/Users/d439087/IdeaProjects/ds/test_cdk/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6228:16)
at KernelHost.run (/Users/d439087/IdeaProjects/ds/test_cdk/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6132:14)

The error is thrown at that line:
command=glue.CfnJob.JobCommandProperty( name='glueetl', script_location='s3://cf-article-statistics-master-artifacts/glue-scripts/permutive-pageview-count-per-article.scala'

Example VPC with SSM Endpoints

🚀 Feature Request

General Information

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

Description

Example of a VPC with the endpoints necessary for AWS Systems Manager Agent to communicate without using a IGW or NAT Gateway (private subnets that do not have access to the Internet).

Proposed Solution

I have working CDK code I use when mocking up environments. I would add the Typescript to the aws-cdk-examples in the expected format.

Environment

  • CDK CLI Version: most current
  • Example: vpc-ssm-endpoints
  • Example Version:
  • OS: OSX Mojave, although it should work across all OS
  • Language: TypeScript

Other information

These stacks aren't going to clean themselves

Example apps should include necessary parameters so that resources are properly cleaned up with with cdk destroy. For example, setting S3 RemovalPolicy.DESTROY on all example buckets.

This would be a good first issue for a contributor.

Environment mapping to AWS Systems Manager Parameter Store

🚀 Feature Request

General Information

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

Description

https://github.com/aws-samples/aws-cdk-examples/tree/master/typescript/ecs realistically needs examples of how to setup the environment, ideally with secrets found in AWS ssm. This is typical use case for deploying Docker images on the cloud.

Proposed Solution

I have been looking for examples on Github search but I've failed: https://github.com/search?q=%27%40aws-cdk%2Faws-elasticloadbalancingv2%27+%27%40aws-cdk%2Faws-ecs%27+environment+%22ssm%22&type=Code

Be great if someone could tell me how it's done. Or is one expected to write the .ts with secrets inlined?

InvalidParameterException

🐛 Bug Report

What is the problem?

When I tried to deploy the example ecs-load-balanced-service, I got the below error

45/53 | 1:35:19 PM | CREATE_FAILED | AWS::ECS::Service | Ec2Service/Service/Service (Ec2Service398F0E46) The new ARN and resource ID format must be enabled to work with ECS managed tags. Opt in to the new format and try again. (Service: AmazonECS; Status Code: 400; Error Code: InvalidParameterException; Request ID: 9a119672-87e6-4b2b-92cb-093563b72d2f)
new BaseService (/private/var/folders/kp/cxxr8s8d6937_gv2nmkctdkw0000gn/T/jsii-kernel-jONUoW/node_modules/@aws-cdk/aws-ecs/lib/base/base-service.js:39:25)
_ new Ec2Service (/private/var/folders/kp/cxxr8s8d6937_gv2nmkctdkw0000gn/T/jsii-kernel-jONUoW/node_modules/@aws-cdk/aws-ecs/lib/ec2/ec2-service.js:40:9)
_ new LoadBalancedEc2Service (/private/var/folders/kp/cxxr8s8d6937_gv2nmkctdkw0000gn/T/jsii-kernel-jONUoW/node_modules/@aws-cdk/aws-ecs-patterns/lib/ecs/load-balanced-ecs-service.js:31:24)
_ obj._wrapSandboxCode (/Users/rakan/github/aws-cdk-examples/python/ecs/ecs-load-balanced-service/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6666:49)
_ Kernel._wrapSandboxCode (/Users/rakan/github/aws-cdk-examples/python/ecs/ecs-load-balanced-service/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:7131:20)
_ Kernel._create (/Users/rakan/github/aws-cdk-examples/python/ecs/ecs-load-balanced-service/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6666:26)
_ Kernel.create (/Users/rakan/github/aws-cdk-examples/python/ecs/ecs-load-balanced-service/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6419:21)
_ KernelHost.processRequest (/Users/rakan/github/aws-cdk-examples/python/ecs/ecs-load-balanced-service/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6191:28)
_ KernelHost.run (/Users/rakan/github/aws-cdk-examples/python/ecs/ecs-load-balanced-service/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6137:14)
_ processRequest (/Users/rakan/github/aws-cdk-examples/python/ecs/ecs-load-balanced-service/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6137:45)
_ KernelHost.processRequest (/Users/rakan/github/aws-cdk-examples/python/ecs/ecs-load-balanced-service/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6233:16)
_ KernelHost.run (/Users/rakan/github/aws-cdk-examples/python/ecs/ecs-load-balanced-service/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6137:14)
_ processRequest (/Users/rakan/github/aws-cdk-examples/python/ecs/ecs-load-balanced-service/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6137:45)
_ KernelHost.processRequest (/Users/rakan/github/aws-cdk-examples/python/ecs/ecs-load-balanced-service/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6233:16)
_ KernelHost.run (/Users/rakan/github/aws-cdk-examples/python/ecs/ecs-load-balanced-service/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6137:14)
_ processRequest (/Users/rakan/github/aws-cdk-examples/python/ecs/ecs-load-balanced-service/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6137:45)
_ KernelHost.processRequest (/Users/rakan/github/aws-cdk-examples/python/ecs/ecs-load-balanced-service/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6233:16)
_ KernelHost.run (/Users/rakan/github/aws-cdk-examples/python/ecs/ecs-load-balanced-service/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6137:14)
_ processRequest (/Users/rakan/github/aws-cdk-examples/python/ecs/ecs-load-balanced-service/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6137:45)
_ KernelHost.processRequest (/Users/rakan/github/aws-cdk-examples/python/ecs/ecs-load-balanced-service/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6233:16)
_ KernelHost.run (/Users/rakan/github/aws-cdk-examples/python/ecs/ecs-load-balanced-service/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6137:14)
_ processRequest (/Users/rakan/github/aws-cdk-examples/python/ecs/ecs-load-balanced-service/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6137:45)
_ KernelHost.processRequest (/Users/rakan/github/aws-cdk-examples/python/ecs/ecs-load-balanced-service/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6233:16)
_ KernelHost.run (/Users/rakan/github/aws-cdk-examples/python/ecs/ecs-load-balanced-service/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6137:14)
_ processRequest (/Users/rakan/github/aws-cdk-examples/python/ecs/ecs-load-balanced-service/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6137:45)
_ KernelHost.processRequest (/Users/rakan/github/aws-cdk-examples/python/ecs/ecs-load-balanced-service/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6233:16)
_ KernelHost.run (/Users/rakan/github/aws-cdk-examples/python/ecs/ecs-load-balanced-service/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6137:14)
_ processRequest (/Users/rakan/github/aws-cdk-examples/python/ecs/ecs-load-balanced-service/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6137:45)
_ KernelHost.processRequest (/Users/rakan/github/aws-cdk-examples/python/ecs/ecs-load-balanced-service/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6233:16)
_ KernelHost.run (/Users/rakan/github/aws-cdk-examples/python/ecs/ecs-load-balanced-service/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6137:14)
_ processRequest (/Users/rakan/github/aws-cdk-examples/python/ecs/ecs-load-balanced-service/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6137:45)
_ promise.then.val (/Users/rakan/github/aws-cdk-examples/python/ecs/ecs-load-balanced-service/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:6218:21)
46/53 | 1:35:19 PM | CREATE_FAILED | AWS::EC2::Route | MyVpc/PrivateSubnet1/DefaultRoute (MyVpcPrivateSubnet1DefaultRouteA8CDE2FA) Resource creation cancelled

Reproduction Steps

when the below part execute the problem appear

service = ecs.Ec2Service(
stack, "Service",
cluster=cluster,
task_definition=task_definition
)

Verbose Log

Environment

  • CDK CLI Version: 1.6.0
  • Example: ecs-load-balanced-service
  • Example Version:
  • OS: macOS
  • Language: Python

Other information

AppSync Example - No data source found

Having issues with this AppSync example, i tried a host of permutations, then did a clean sync of the repo and continue to get the error.

(base) AXmp:appsync-graphql-dynamodb XXX$ cdk deploy -v
CDK toolkit version: 1.8.0 (build 5244f97)
Command line arguments: {
  _: [ 'deploy' ],
  'ignore-errors': false,
  ignoreErrors: false,
  json: false,
  j: false,
  verbose: true,
  v: true,
  ec2creds: undefined,
  i: undefined,
  'version-reporting': undefined,
  versionReporting: undefined,
  'path-metadata': true,
  pathMetadata: true,
  'asset-metadata': true,
  assetMetadata: true,
  staging: true,
  ci: false,
  'role-arn': undefined,
  r: undefined,
  roleArn: undefined,
  'build-exclude': [],
  E: [],
  buildExclude: [],
  '$0': '/usr/local/bin/cdk'
}
Determining whether we're on an EC2 instance.
Does not look like EC2 instance.
cdk.json: {
  "app": "node index"
}
merged settings: {
  versionReporting: true,
  pathMetadata: true,
  output: 'cdk.out',
  app: 'node index',
  context: {},
  tags: [],
  assetMetadata: true,
  toolkitBucket: {},
  staging: true
}
Setting "CDK_DEFAULT_REGION" environment variable to us-east-1
Resolving default credentials
Retrieved account ID XXXXXXXXXXXX from disk cache
Setting "CDK_DEFAULT_ACCOUNT" environment variable to XXXXXXXXXXXX
context: {
  'aws:cdk:enable-path-metadata': true,
  'aws:cdk:enable-asset-metadata': true
}
outdir: cdk.out
env: {
  CDK_DEFAULT_REGION: 'us-east-1',
  CDK_DEFAULT_ACCOUNT: 'XXXXXXXXXXXX',
  CDK_CONTEXT_JSON: '{"aws:cdk:enable-path-metadata":true,"aws:cdk:enable-asset-metadata":true}',
  CDK_OUTDIR: 'cdk.out'
}
Reading existing template for stack AppSyncGraphQLDynamoDBExample.
Using default AWS SDK credentials for account XXXXXXXXXXXX
This deployment will make potentially sensitive changes according to your current security approval level (--require-approval broadening).
Please confirm you intend to make the following modifications:

IAM Statement Changes
┌───┬──────────────────────────┬────────┬────────────────┬───────────────────────────────┬───────────┐
│   │ Resource                 │ Effect │ Action         │ Principal                     │ Condition │
├───┼──────────────────────────┼────────┼────────────────┼───────────────────────────────┼───────────┤
│ + │ ${ItemsDynamoDBRole.Arn} │ Allow  │ sts:AssumeRole │ Service:appsync.amazonaws.com │           │
└───┴──────────────────────────┴────────┴────────────────┴───────────────────────────────┴───────────┘
IAM Policy Changes
┌───┬──────────────────────┬────────────────────────────────────────────────────────────────┐
│   │ Resource             │ Managed Policy ARN                                             │
├───┼──────────────────────┼────────────────────────────────────────────────────────────────┤
│ + │ ${ItemsDynamoDBRole} │ arn:${AWS::Partition}:iam::aws:policy/AmazonDynamoDBFullAccess │
└───┴──────────────────────┴────────────────────────────────────────────────────────────────┘
(NOTE: There may be security-related changes not in this list. See http://bit.ly/cdk-2EhF7Np)

Do you wish to deploy these changes (y/n)? y
AppSyncGraphQLDynamoDBExample: deploying...
Waiting for stack CDKToolkit to finish creating or updating...
Using default AWS SDK credentials for account XXXXXXXXXXXX
s3://cdktoolkit-stagingbucket-1k1e81logcqq8/cdk/AppSyncGraphQLDynamoDBExample/XXX.yml: checking if already exists
s3://cdktoolkit-stagingbucket-1k1e81logcqq8/cdk/AppSyncGraphQLDynamoDBExample/XXX.yml: found (skipping upload)
Stored template in S3 at: https://cdktoolkit-stagingbucket-1k1e81logcqq8.s3.amazonaws.com/cdk/AppSyncGraphQLDynamoDBExample/XXX.yml
Attempting to create ChangeSet CDK-7f2271e2-7e59-4c20-ae93-a4849d1279ac to create stack AppSyncGraphQLDynamoDBExample
AppSyncGraphQLDynamoDBExample: creating CloudFormation changeset...
Initiated creation of changeset: arn:aws:cloudformation:us-east-1:XXXXXXXXXXXX:changeSet/CDK-7f2271e2-7e59-4c20-ae93-a4849d1279ac/4c85627a-d92e-4bb0-b8c4-21673a861314; waiting for it to finish creating...
Waiting for changeset CDK-7f2271e2-7e59-4c20-ae93-a4849d1279ac on stack AppSyncGraphQLDynamoDBExample to finish creating...
Changeset CDK-7f2271e2-7e59-4c20-ae93-a4849d1279ac on stack AppSyncGraphQLDynamoDBExample is still creating
Initiating execution of changeset CDK-7f2271e2-7e59-4c20-ae93-a4849d1279ac on stack AppSyncGraphQLDynamoDBExample
Execution of changeset CDK-7f2271e2-7e59-4c20-ae93-a4849d1279ac on stack AppSyncGraphQLDynamoDBExample has started; waiting for the update to complete...
Waiting for stack AppSyncGraphQLDynamoDBExample to finish creating or updating...
Stack AppSyncGraphQLDynamoDBExample is still not stable (CREATE_IN_PROGRESS (User Initiated))
Stack AppSyncGraphQLDynamoDBExample is still not stable (CREATE_IN_PROGRESS)
Stack AppSyncGraphQLDynamoDBExample is still not stable (CREATE_IN_PROGRESS)
Stack AppSyncGraphQLDynamoDBExample is still not stable (CREATE_IN_PROGRESS)
Stack AppSyncGraphQLDynamoDBExample is still not stable (CREATE_IN_PROGRESS)
Stack AppSyncGraphQLDynamoDBExample is still not stable (CREATE_IN_PROGRESS)
  0/12 | 2:30:15 PM | CREATE_IN_PROGRESS   | AWS::CDK::Metadata          | CDKMetadata 
  0/12 | 2:30:15 PM | CREATE_IN_PROGRESS   | AWS::AppSync::GraphQLApi    | ItemsApi 
  0/12 | 2:30:15 PM | CREATE_IN_PROGRESS   | AWS::IAM::Role              | ItemsDynamoDBRole (ItemsDynamoDBRole7D2E3F6D) 
  0/12 | 2:30:15 PM | CREATE_IN_PROGRESS   | AWS::DynamoDB::Table        | ItemsTable (ItemsTable5AAC2C46) 
  0/12 | 2:30:15 PM | CREATE_IN_PROGRESS   | AWS::IAM::Role              | ItemsDynamoDBRole (ItemsDynamoDBRole7D2E3F6D) Resource creation Initiated
  0/12 | 2:30:15 PM | CREATE_IN_PROGRESS   | AWS::DynamoDB::Table        | ItemsTable (ItemsTable5AAC2C46) Resource creation Initiated
  0/12 | 2:30:17 PM | CREATE_IN_PROGRESS   | AWS::CDK::Metadata          | CDKMetadata Resource creation Initiated
  0/12 | 2:30:17 PM | CREATE_IN_PROGRESS   | AWS::AppSync::GraphQLApi    | ItemsApi Resource creation Initiated
  1/12 | 2:30:17 PM | CREATE_COMPLETE      | AWS::CDK::Metadata          | CDKMetadata 
  2/12 | 2:30:17 PM | CREATE_COMPLETE      | AWS::AppSync::GraphQLApi    | ItemsApi 
Stack AppSyncGraphQLDynamoDBExample is still not stable (CREATE_IN_PROGRESS)
  2/12 | 2:30:19 PM | CREATE_IN_PROGRESS   | AWS::AppSync::GraphQLSchema | ItemsSchema 
  2/12 | 2:30:19 PM | CREATE_IN_PROGRESS   | AWS::AppSync::ApiKey        | ItemsApiKey 
  2/12 | 2:30:21 PM | CREATE_IN_PROGRESS   | AWS::AppSync::ApiKey        | ItemsApiKey Resource creation Initiated
  3/12 | 2:30:21 PM | CREATE_COMPLETE      | AWS::AppSync::ApiKey        | ItemsApiKey 
  3/12 | 2:30:21 PM | CREATE_IN_PROGRESS   | AWS::AppSync::GraphQLSchema | ItemsSchema Resource creation Initiated
  4/12 | 2:30:22 PM | CREATE_COMPLETE      | AWS::AppSync::GraphQLSchema | ItemsSchema 
Stack AppSyncGraphQLDynamoDBExample is still not stable (CREATE_IN_PROGRESS)
  4/12 | 2:30:25 PM | CREATE_IN_PROGRESS   | AWS::AppSync::Resolver      | SaveMutationResolver 
  4/12 | 2:30:25 PM | CREATE_IN_PROGRESS   | AWS::AppSync::Resolver      | GetOneQueryResolver 
  4/12 | 2:30:25 PM | CREATE_IN_PROGRESS   | AWS::AppSync::Resolver      | DeleteMutationResolver 
  4/12 | 2:30:25 PM | CREATE_IN_PROGRESS   | AWS::AppSync::Resolver      | GetAllQueryResolver 
  5/12 | 2:30:27 PM | CREATE_FAILED        | AWS::AppSync::Resolver      | GetAllQueryResolver No data source found named ItemsDynamoDataSource (Service: AWSAppSync; Status Code: 404; Error Code: NotFoundException; Request ID: 778ca242-f7f0-42af-8560-fca4cd0ed9c8)
	new AppSyncCdkStack (/Users/XXX/Projects/testing_CDK/aws-cdk-examples/typescript/appsync-graphql-dynamodb/index.js:83:32)
	\_ Object.<anonymous> (/Users/XXX/Projects/testing_CDK/aws-cdk-examples/typescript/appsync-graphql-dynamodb/index.js:134:1)
	\_ Module._compile (internal/modules/cjs/loader.js:936:30)
	\_ Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
	\_ Module.load (internal/modules/cjs/loader.js:790:32)
	\_ Function.Module._load (internal/modules/cjs/loader.js:703:12)
	\_ Function.Module.runMain (internal/modules/cjs/loader.js:999:10)
	\_ internal/main/run_main_module.js:17:11
  6/12 | 2:30:27 PM | CREATE_FAILED        | AWS::AppSync::Resolver      | SaveMutationResolver No data source found named ItemsDynamoDataSource (Service: AWSAppSync; Status Code: 404; Error Code: NotFoundException; Request ID: b6b9abc2-9eab-4501-bedf-f255126a9270)
	new AppSyncCdkStack (/Users/XXX/Projects/testing_CDK/aws-cdk-examples/typescript/appsync-graphql-dynamodb/index.js:97:30)
	\_ Object.<anonymous> (/Users/XXX/Projects/testing_CDK/aws-cdk-examples/typescript/appsync-graphql-dynamodb/index.js:134:1)
	\_ Module._compile (internal/modules/cjs/loader.js:936:30)
	\_ Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
	\_ Module.load (internal/modules/cjs/loader.js:790:32)
	\_ Function.Module._load (internal/modules/cjs/loader.js:703:12)
	\_ Function.Module.runMain (internal/modules/cjs/loader.js:999:10)
	\_ internal/main/run_main_module.js:17:11
  7/12 | 2:30:27 PM | CREATE_FAILED        | AWS::AppSync::Resolver      | GetOneQueryResolver No data source found named ItemsDynamoDataSource (Service: AWSAppSync; Status Code: 404; Error Code: NotFoundException; Request ID: 384a1869-8bf2-4fd8-ac73-7f3e208cf483)
	new AppSyncCdkStack (/Users/XXX/Projects/testing_CDK/aws-cdk-examples/typescript/appsync-graphql-dynamodb/index.js:68:32)
	\_ Object.<anonymous> (/Users/XXX/Projects/testing_CDK/aws-cdk-examples/typescript/appsync-graphql-dynamodb/index.js:134:1)
	\_ Module._compile (internal/modules/cjs/loader.js:936:30)
	\_ Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
	\_ Module.load (internal/modules/cjs/loader.js:790:32)
	\_ Function.Module._load (internal/modules/cjs/loader.js:703:12)
	\_ Function.Module.runMain (internal/modules/cjs/loader.js:999:10)
	\_ internal/main/run_main_module.js:17:11
  8/12 | 2:30:27 PM | CREATE_FAILED        | AWS::AppSync::Resolver      | DeleteMutationResolver No data source found named ItemsDynamoDataSource (Service: AWSAppSync; Status Code: 404; Error Code: NotFoundException; Request ID: a2d25f2f-266f-4ccf-97a8-1c46ea0d0ec6)
	new AppSyncCdkStack (/Users/XXX/Projects/testing_CDK/aws-cdk-examples/typescript/appsync-graphql-dynamodb/index.js:115:32)
	\_ Object.<anonymous> (/Users/XXX/Projects/testing_CDK/aws-cdk-examples/typescript/appsync-graphql-dynamodb/index.js:134:1)
	\_ Module._compile (internal/modules/cjs/loader.js:936:30)
	\_ Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
	\_ Module.load (internal/modules/cjs/loader.js:790:32)
	\_ Function.Module._load (internal/modules/cjs/loader.js:703:12)
	\_ Function.Module.runMain (internal/modules/cjs/loader.js:999:10)
	\_ internal/main/run_main_module.js:17:11
  9/12 | 2:30:27 PM | CREATE_FAILED        | AWS::IAM::Role              | ItemsDynamoDBRole (ItemsDynamoDBRole7D2E3F6D) Resource creation cancelled
	new Role (/Users/XXX/Projects/testing_CDK/aws-cdk-examples/typescript/appsync-graphql-dynamodb/node_modules/@aws-cdk/aws-iam/lib/role.js:35:22)
	\_ new AppSyncCdkStack (/Users/XXX/Projects/testing_CDK/aws-cdk-examples/typescript/appsync-graphql-dynamodb/index.js:54:32)
	\_ Object.<anonymous> (/Users/XXX/Projects/testing_CDK/aws-cdk-examples/typescript/appsync-graphql-dynamodb/index.js:134:1)
	\_ Module._compile (internal/modules/cjs/loader.js:936:30)
	\_ Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
	\_ Module.load (internal/modules/cjs/loader.js:790:32)
	\_ Function.Module._load (internal/modules/cjs/loader.js:703:12)
	\_ Function.Module.runMain (internal/modules/cjs/loader.js:999:10)
	\_ internal/main/run_main_module.js:17:11
 10/12 | 2:30:27 PM | CREATE_FAILED        | AWS::DynamoDB::Table        | ItemsTable (ItemsTable5AAC2C46) Resource creation cancelled
	new Table (/Users/XXX/Projects/testing_CDK/aws-cdk-examples/typescript/appsync-graphql-dynamodb/node_modules/@aws-cdk/aws-dynamodb/lib/table.js:49:22)
	\_ new AppSyncCdkStack (/Users/XXX/Projects/testing_CDK/aws-cdk-examples/typescript/appsync-graphql-dynamodb/index.js:41:28)
	\_ Object.<anonymous> (/Users/XXX/Projects/testing_CDK/aws-cdk-examples/typescript/appsync-graphql-dynamodb/index.js:134:1)
	\_ Module._compile (internal/modules/cjs/loader.js:936:30)
	\_ Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
	\_ Module.load (internal/modules/cjs/loader.js:790:32)
	\_ Function.Module._load (internal/modules/cjs/loader.js:703:12)
	\_ Function.Module.runMain (internal/modules/cjs/loader.js:999:10)
	\_ internal/main/run_main_module.js:17:11
 10/12 | 2:30:28 PM | ROLLBACK_IN_PROGRESS | AWS::CloudFormation::Stack  | AppSyncGraphQLDynamoDBExample The following resource(s) failed to create: [GetAllQueryResolver, GetOneQueryResolver, ItemsDynamoDBRole7D2E3F6D, ItemsTable5AAC2C46, DeleteMutationResolver, SaveMutationResolver]. . Rollback requested by user.
Stack AppSyncGraphQLDynamoDBExample is still not stable (ROLLBACK_IN_PROGRESS (The following resource(s) failed to create: [GetAllQueryResolver, GetOneQueryResolver, ItemsDynamoDBRole7D2E3F6D, ItemsTable5AAC2C46, DeleteMutationResolver, SaveMutationResolver]. . Rollback requested by user.))
Stack AppSyncGraphQLDynamoDBExample is still not stable (ROLLBACK_IN_PROGRESS (The following resource(s) failed to create: [GetAllQueryResolver, GetOneQueryResolver, ItemsDynamoDBRole7D2E3F6D, ItemsTable5AAC2C46, DeleteMutationResolver, SaveMutationResolver]. . Rollback requested by user.))
Stack AppSyncGraphQLDynamoDBExample is still not stable (ROLLBACK_IN_PROGRESS (The following resource(s) failed to create: [GetAllQueryResolver, GetOneQueryResolver, ItemsDynamoDBRole7D2E3F6D, ItemsTable5AAC2C46, DeleteMutationResolver, SaveMutationResolver]. . Rollback requested by user.))
Stack AppSyncGraphQLDynamoDBExample is still not stable (ROLLBACK_IN_PROGRESS (The following resource(s) failed to create: [GetAllQueryResolver, GetOneQueryResolver, ItemsDynamoDBRole7D2E3F6D, ItemsTable5AAC2C46, DeleteMutationResolver, SaveMutationResolver]. . Rollback requested by user.))
Stack AppSyncGraphQLDynamoDBExample is still not stable (ROLLBACK_IN_PROGRESS (The following resource(s) failed to create: [GetAllQueryResolver, GetOneQueryResolver, ItemsDynamoDBRole7D2E3F6D, ItemsTable5AAC2C46, DeleteMutationResolver, SaveMutationResolver]. . Rollback requested by user.))
Stack AppSyncGraphQLDynamoDBExample is still not stable (ROLLBACK_IN_PROGRESS (The following resource(s) failed to create: [GetAllQueryResolver, GetOneQueryResolver, ItemsDynamoDBRole7D2E3F6D, ItemsTable5AAC2C46, DeleteMutationResolver, SaveMutationResolver]. . Rollback requested by user.))
Stack AppSyncGraphQLDynamoDBExample is still not stable (ROLLBACK_IN_PROGRESS)
 10/12 | 2:30:59 PM | DELETE_IN_PROGRESS   | AWS::CDK::Metadata          | CDKMetadata 
 10/12 | 2:30:59 PM | DELETE_IN_PROGRESS   | AWS::IAM::Role              | ItemsDynamoDBRole (ItemsDynamoDBRole7D2E3F6D) 
 10/12 | 2:30:59 PM | DELETE_IN_PROGRESS   | AWS::AppSync::ApiKey        | ItemsApiKey 
 10/12 | 2:30:59 PM | DELETE_IN_PROGRESS   | AWS::DynamoDB::Table        | ItemsTable (ItemsTable5AAC2C46) 
 11/12 | 2:30:59 PM | DELETE_COMPLETE      | AWS::AppSync::Resolver      | SaveMutationResolver 
 12/12 | 2:30:59 PM | DELETE_COMPLETE      | AWS::AppSync::Resolver      | GetOneQueryResolver 
 13/12 | 2:31:00 PM | DELETE_COMPLETE      | AWS::AppSync::Resolver      | DeleteMutationResolver 
 14/12 | 2:31:00 PM | DELETE_COMPLETE      | AWS::AppSync::Resolver      | GetAllQueryResolver 
Stack AppSyncGraphQLDynamoDBExample is still not stable (ROLLBACK_IN_PROGRESS)
 15/12 | 2:31:00 PM | DELETE_COMPLETE      | AWS::CDK::Metadata          | CDKMetadata 
 16/12 | 2:31:01 PM | DELETE_COMPLETE      | AWS::IAM::Role              | ItemsDynamoDBRole (ItemsDynamoDBRole7D2E3F6D) 
 16/12 | 2:31:01 PM | DELETE_IN_PROGRESS   | AWS::AppSync::GraphQLSchema | ItemsSchema 
 17/12 | 2:31:01 PM | DELETE_COMPLETE      | AWS::AppSync::ApiKey        | ItemsApiKey 
 18/12 | 2:31:04 PM | DELETE_COMPLETE      | AWS::AppSync::GraphQLSchema | ItemsSchema 
Stack AppSyncGraphQLDynamoDBExample is still not stable (ROLLBACK_IN_PROGRESS)
 18/12 | 2:31:05 PM | DELETE_IN_PROGRESS   | AWS::AppSync::GraphQLApi    | ItemsApi 
 19/12 | 2:31:08 PM | DELETE_COMPLETE      | AWS::AppSync::GraphQLApi    | ItemsApi 
Stack AppSyncGraphQLDynamoDBExample is still not stable (ROLLBACK_IN_PROGRESS)
Stack AppSyncGraphQLDynamoDBExample is still not stable (ROLLBACK_IN_PROGRESS)
Stack AppSyncGraphQLDynamoDBExample is still not stable (ROLLBACK_IN_PROGRESS)
Stack AppSyncGraphQLDynamoDBExample is still not stable (ROLLBACK_IN_PROGRESS)
Stack AppSyncGraphQLDynamoDBExample is still not stable (ROLLBACK_IN_PROGRESS)

RDS cluster example: Cannot read property 'secretRotationApplication'

    this.secretRotationApplication = props.engine.secretRotationApplication;
                                                  ^
TypeError: Cannot read property 'secretRotationApplication' of undefined
    at new DatabaseCluster (/Users/sblackstone/code/xxx/yyyy/node_modules/@aws-cdk/aws-rds/lib/cluster.ts:297:51)
    at new TafDocsProcessingStack (/Users/sblackstone/code/xxx/yyyy/lib/yyyy-stack.js:24:21)
    at Object.<anonymous> (/Users/sblackstone/code/xxx/yyyy/bin/yyyy.js:9:1)
    at Module._compile (internal/modules/cjs/loader.js:774:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
    at Module.load (internal/modules/cjs/loader.js:641:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:837:10)
    at internal/main/run_main_module.js:17:11
Subprocess exited with error 1```

Argument of type 'Function' is not assignable to parameter of type 'IFunction'.

OS: macOS 10.14.6
aws-cdk/core: 1.0.0
aws-cdk/aws-lambda: 1.0.0
aws-cdk/aws-events: 1.1.0
aws-cdk/aws-events-targets: 1.1.0
cdk: 1.0.0 (build d89592e)

I am trying to create a stack similar to the lambda-cron example.

While adding lambda function to rule, it is erring out.

Add a lambda function as a target:
rule.addTarget(new targets.LambdaFunction(queueConsumer));

queueConsumer is a lambda function (aws-cdk/aws-lambda.Function) that consumes messages from a SQS queue.

Error while adding the target
Argument of type 'Function' is not assignable to parameter of type 'IFunction'.

Is there any way to get the IFunction object from the lambda.Function object?

Access to CloudFormation layer should be documented for all languages

There's lots of TypeScript examples, but I think it's a priority to at least document clearly the "escape hatch" method in all languages as the CDK continues to evolve and might not have all features implemented. For example, I'm trying to access a resource in Java and it's not clear to me how to have the equivalent of project.node.findChild("Resource").

Bug in task-definition.js -- must have at least one of 'memoryLimitMiB' or 'memoryReservationMiB' specified

memoryLimitMiB is not optional at the moment while it should be; validate doesn't check for memoryReservationMiB.

validate() {
        const ret = super.validate();
        if (util_1.isEc2Compatible(this.compatibility)) {
            // EC2 mode validations
            // Container sizes
            for (const container of this.containers) {
                if (!container.memoryLimitSpecified) {
                    ret.push(`ECS Container ${container.node.id} must have at least one of 'memoryLimitMiB' or 'memoryReservationMiB' specified`);
                }
            }
        }
        return ret;
    }

Deprecated aws-cdk/cdk in use

The Python examples (I haven't looked at other languages) use the just-deprecated aws-cdk/cdk module. This has been replaced with the aws-cdk/core module (see here.)
The fix may well be as simple as replacing all references to aws-cdk/cdk to aws-cdk/core.

Cdk python document mixed with Node.js code example

🐛 Bug Report

What is the problem?

Python document mixed with node.js code. For example, construct a new Vpc:

https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_ec2/Vpc.html

import { SubnetType, Vpc } from '@aws-cdk/aws-ec2'

const vpc = new Vpc(this, 'TheVPC', {
   cidr: "10.0.0.0/16"
})

// Iterate the private subnets
const selection = vpc.selectSubnets({
   subnetType: SubnetType.PRIVATE
});

for (const subnet of selection.subnets) {
   // ...
}

This is node.js / typescript code, not python code.

Advanced Subnet Configuration
Connection Peers
....

https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_ec2.README.html

Amazon ECR Construct Library

https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_ecr.README.html

Reproduction Steps

Simple. For Vpc, in CLI do this:

$ python
>>> from aws_cdk.aws_ec2 import Vpc
>>> help(Vpc)

Environment

  • CDK CLI Version:1.8.0 (build 5244f97)
  • OS:OSX Mojave
  • Language:Python

ECS Fargate Load Balanced Service created via python example does not allow incoming traffic

🐛 Bug Report

What is the problem?

When deploying python/ecs/fargate-load-balanced-service/ the resulting application is not reachable via the load balancer URL.

The security group for the fargate task does not have an inbound rule allowing traffic on port 80. Manually adding the rule post deployment fixes the application.

Reproduction Steps

Verbose Log

the result of cdk synth shows that the generated YAML does not include any rules for security group ingress.

FargateServiceSecurityGroup262B61DD:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Bonjour/FargateService/Service/SecurityGroup
SecurityGroupEgress:
- CidrIp: 0.0.0.0/0
Description: Allow all outbound traffic by default
IpProtocol: "-1"

Environment

  • CDK CLI Version: 1.9.0 (build 30f158a)
  • Example: ECS Fargate Load Balanced Service
  • Example Version: Latest commit e7b755c
  • OS: Ubuntu
  • Language: Python

Other information

503 ALB error

🐛 Bug Report

What is the problem?

Load Balancer 503
-->
The stack deploys - I think this line needs to be 80 instead of 8080

s3 event (new file uplodaded) never triggers lambda

Hi guys,

I discovered CDK 2 weeks ago and spent couple of days playing with it.
It seems to be very promising.

I struggled a lot this weekend trying to invoke a lambda function when I upload manually a file in s3 bucket. For some reasons my lambda function seems to never be called.
Could someone tell me what is wrong with my code ? I tried many things: on_event, event sources but it never works.

from aws_cdk import (
    aws_ec2 as ec2,
    aws_ecs as ecs,
    aws_s3 as s3,
    aws_lambda as lambda_,
    aws_lambda_event_sources as lambda_event_sources,
    aws_sns as sns,
    cdk,
)

class BonjourFirstLambda(cdk.Stack):

    def __init__(self, scope: cdk.Construct, id: str, **kwargs) -> None:
        super().__init__(scope, id, *kwargs)

        vpc = ec2.VpcNetwork(self, 'mon-s3-bucket', cidr='10.0.0.0/16', max_a_zs=2) 
        
        with open("lambda-handler.py", encoding="utf8") as fp:
            handler_code = fp.read()

        lambdaFn = lambda_.Function(
            self,
            "firstLambda",
            code=lambda_.InlineCode(handler_code),
            handler="index.main",
            timeout=300,
            runtime=lambda_.Runtime.PYTHON37,
            tracing=lambda_.Tracing.Active
        )

        s3_bucket = s3.Bucket(self, 
            'mon-s3-bucket', 
            bucket_name='mon-s3-bucket', 
        )

        # I also tried SNS. 
        #topic = sns.Topic(self, "TopicFirstLambda")
        #s3_bucket.on_event(s3.EventType.ObjectCreated, topic, prefix="*")
        
        s3_bucket.on_event(s3.EventType.ObjectCreated, lambdaFn, prefix="*")

        # And also tried event source        
        # lambda_event = lambda_event_sources.S3EventSource(s3_bucket, events=[s3.EventType.ObjectCreated])
        # lambdaFn.add_event_source(lambda_event)



app = cdk.App()
BonjourFirstLambda(app, "Bonjour")
app.run()

Thanks for your help !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.