{"id":23384449,"url":"https://github.com/wheatstalk/aws-cdk-exec","last_synced_at":"2025-04-11T02:22:04.016Z","repository":{"id":37049529,"uuid":"458989018","full_name":"wheatstalk/aws-cdk-exec","owner":"wheatstalk","description":"A CLI tool to find and execute your CDK Lambdas and Step Functions in AWS","archived":false,"fork":false,"pushed_at":"2024-04-13T01:07:28.000Z","size":1748,"stargazers_count":19,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-14T00:42:11.334Z","etag":null,"topics":["aws","aws-cdk","aws-lambda","lambda","serverless"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wheatstalk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-02-14T02:23:04.000Z","updated_at":"2024-08-07T02:23:05.965Z","dependencies_parsed_at":"2023-12-05T02:31:18.819Z","dependency_job_id":"4e98d2b3-3a53-42af-8bea-9d4250cb960f","html_url":"https://github.com/wheatstalk/aws-cdk-exec","commit_stats":{"total_commits":423,"total_committers":2,"mean_commits":211.5,"dds":"0.047281323877068515","last_synced_commit":"477226b16157850c9e0253e36d5300617d79fc30"},"previous_names":[],"tags_count":595,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wheatstalk%2Faws-cdk-exec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wheatstalk%2Faws-cdk-exec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wheatstalk%2Faws-cdk-exec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wheatstalk%2Faws-cdk-exec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wheatstalk","download_url":"https://codeload.github.com/wheatstalk/aws-cdk-exec/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248328462,"owners_count":21085323,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","aws-cdk","aws-lambda","lambda","serverless"],"created_at":"2024-12-21T23:20:29.977Z","updated_at":"2025-04-11T02:22:03.988Z","avatar_url":"https://github.com/wheatstalk.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AWS CDK Exec\n\nProvides `cdk-exec`, an AWS CDK dev tool to quickly find and execute your\nLambdas and State Machines in AWS.\n\n```\n$ cdk-exec integ-cdk-exec/Function --input '{\"succeed\":true}'\n⚡  Executing integ-cdk-exec/Function/Resource (integ-cdk-exec-Function76856677-k5ehIzbG2T6S)\n\n\n✨  Final status of integ-cdk-exec/Function/Resource\n\nOutput:\n{\n  \"succeed\": true,\n  \"message\": \"Hello from Lambda\"\n}\n\n✅  Execution succeeded\n```\n\n\u003e WARNING: Do not rely on this tool to execute your functions in a production\n\u003e environment. Now that you have been warned, please read on.\n\n**Exporting Environment Variables**\n\nIf during local development you want to access the environment variables\nconfigured for a Lambda Function, such as to see the arns of real resources,\nyou may use `cdk-exec --export-env integ-cdk-exec/Function`.\n\n```\n$ cdk-exec --export-env integ-cdk-exec/Function\nFOO=bar\nSECRET_ARN=arn:aws:secretsmanager:REGION:000000000000:secret:SecretA720EF05-qa4X020B9S3f-UI3sIs\n```\n\n## Usage\n\nFirst, add `@wheatstalk/aws-cdk-exec` to your project's dev dependencies.\nThen synthesize your app to a `cdk.out` directory. Once synthesized there, you\ncan execute one of your resources with `cdk-exec`.\n\n\u003e If you're using `cdk watch`, the CDK will keep your `cdk.out` up to date, so\n\u003e when you use watch mode, you can run `cdk-exec` (roughly) at will.\n\n## Full Example\n\n**app.ts**\n\n```ts\nimport { App, Stack } from 'aws-cdk-lib';\nimport { Code, Function, Runtime } from 'aws-cdk-lib/aws-lambda';\nimport { Choice, Condition, Fail, StateMachine, Succeed } from 'aws-cdk-lib/aws-stepfunctions';\n\nconst app = new App();\nconst stack = new Stack(app, 'integ-cdk-exec');\n\nnew StateMachine(stack, 'StateMachine', {\n  definition: new Choice(stack, 'Choice')\n    .when(Condition.isPresent('$.succeed'),\n      new Succeed(stack, 'ChoiceSucceed'))\n    .otherwise(\n      new Fail(stack, 'ChoiceFail')),\n});\n\nnew Function(stack, 'Function', {\n  runtime: Runtime.PYTHON_3_9,\n  handler: 'index.handler',\n  code: Code.fromInline(`\ndef handler(event, context):\n  if \"succeed\" in event:\n    return {\"succeed\": True, \"message\": \"Hello from Lambda\"}\n\n  raise Exception('Error from lambda')\n`),\n});\n\napp.synth();\n```\n\n**Synthesize your app**\n\nThe `cdk-exec` tool operates on a synthesized cloud assembly (your `cdk.out`\ndirectory), so the first step is to synthesize your app:\n\n```console\n$ cdk synth --output cdk.out\n```\n\n**Execute a state machine with input**\n\n```\n$ cdk-exec integ-cdk-exec/StateMachine --input '{\"succeed\":true}'\n⚡  Executing integ-cdk-exec/StateMachine/Resource (arn:aws:states:REGION:000000000000:stateMachine:StateMachine2E01A3A5-8z4XHXAvT3qq)\n\n\n✨  Final status of integ-cdk-exec/StateMachine/Resource\n\nOutput:\n{\n  \"succeed\": true\n}\n\n✅  Execution succeeded\n```\n\n**Execute a lambda with input**\n\n```\n$ cdk-exec integ-cdk-exec/Function --input '{\"succeed\":true}'\n⚡  Executing integ-cdk-exec/Function/Resource (integ-cdk-exec-Function76856677-k5ehIzbG2T6S)\n\n\n✨  Final status of integ-cdk-exec/Function/Resource (integ-cdk-exec-Function76856677-k5ehIzbG2T6S)\n\nOutput:\n{\n  \"succeed\": true,\n  \"message\": \"Hello from Lambda\"\n}\n\n✅  Execution succeeded\n```\n\n**Use a custom cloud assembly directory**\n\n```\n$ cdk-exec --app path/to/cdkout integ-cdk-exec/Function --input '{\"json\":\"here\"}'\n⚡  Executing integ-cdk-exec/Function/Resource (integ-cdk-exec-Function76856677-k5ehIzbG2T6S)\n\n\n✨  Final status of integ-cdk-exec/Function/Resource\n\nOutput:\n{\n  \"succeed\": true,\n  \"message\": \"Hello from Lambda\"\n}\n\n✅  Execution succeeded\n```\n\n## Resource Matching\n\n**Path matching**\n\n`cdk-exec` searches for resources matching the exact path you provide and any\ndeeper nested resources. This is how we support both L1 \u0026 L2 constructs, but\nis also a convenient shortcut when your app has only one executable resource.\n\nFor example, if you have only one function or state machine in a stack, you\ncan type `cdk-exec my-stack` and your resource will be found. If your entire\napp has only one executable resource, you can run `cdk-exec` without arguments\nto run it.\n\n**Tag matching**\n\nWhen running `cdk-exec --tag mytag=value`, cdk-exec will search for a resource\nmatching tags that you have defined in your CDK app. If more than one resource\nwould match, by default `cdk-exec` will produce an error message. But, if you\nwant to execute several resources simultaneously, `cdk-exec` provides `--all`.\n\nWe have also added aliases and shorthands to streamline typing label-matching\ncommands. For example, `cdk-exec -at mytag` will try to run all resources with\na tag named `mytag`, regardless of the value of the tag. This has the same\neffect as typing the longer `cdk-exec --all --tag mytag` command.\n\n**Metadata matching**\n\nWhen running `cdk-exec --metadata mymeta=myvalue`, cdk-exec will search for and\nrun resources containing the given metadata. Same as for tag matching, you can\nrun one or more matching resources if you specify the `--all` option.\n\n## Notes\n\n**Path metadata**\n\nThis tool requires path metadata to be enabled in your assembly.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwheatstalk%2Faws-cdk-exec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwheatstalk%2Faws-cdk-exec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwheatstalk%2Faws-cdk-exec/lists"}