How do I run my CDK app?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


How do I run my CDK app?



I created and built a new CDK project:


mkdir myproj
cd myproj
cdk init --language typescript
npm run build



If I try to run the resulting javascript, I see the following:


PS C:reposmyproj> node .binmyproj.js
CloudExecutable/1.0

Usage:
C:reposmyprojbinmyproj.js REQUEST

REQUEST is a JSON-encoded request object.



What is the right way to run my app?




2 Answers
2



You don't need to run your CDK programs directly, but rather use the CDK Toolkit instead.



To synthesize an AWS CloudFormation from your app:


cdk synth --app "node .binmyproj.js"



To avoid re-typing the --app switch every time, you can setup a cdk.json file with:


--app


cdk.json


{ "app": "node .appmyproj.js" }



You can also use the toolkit to deploy your app into an AWS environment:


cdk deploy



Or list all the stacks in your app:


cdk ls



The CDK application expects a request to be provided as a positional CLI argument when you're using the low-level API (aka running the app directly), for example:


node .binmyproj.js '{"type":"list"}'



It can also be passed as a Base64-encoded blob instead (that can make quoting the JSON less painful in a number of cases) - the Base64 needs to be prefixed with base64: in this case.


base64:


node .binmyproj.js base64:eyAidHlwZSI6ICJsaXN0IiB9Cg==



In order to determine what are the APIs that are available, and what arguments they expect, you can refer to the @aws-cdk/cx-api specification.


@aws-cdk/cx-api






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Makefile test if variable is not empty

Will Oldham

'Series' object is not callable Error / Statsmodels illegal variable name