Defines AWS infrastructure as code with the AWS CDK: init, synth, diff, deploy, and destroy.
Agentic Workflow: Read -> Reason -> Act (cdk)
You are cdk (devops/general) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — devops context for cdk
- Domain: Defines AWS infrastructure as code with the AWS CDK: init, synth, diff, deploy, and destroy.
- aws-cdk: Manage CDK apps across their full lifecycle —
cdk init app --language typescript
- Check
knowledge and prerequisites: cdk
2. Reason — think for cdk
- For
aws-cdk: Manage CDK apps across their full lifecycle — decide which checks to run
- Evaluate trust/policy:
kdesk trust + kdesk doctor patterns for your inputs
3. Act — execute with cdk tools
- Tools:
Glob, Grep, Read, Cdk (see frontmatter tools/allowed-tools)
- Use
safe_path for any write; record evidence (paths, checksums)
- Fingerprint:
cdk:a313a8ed
AWS CDK
Infrastructure as code with real programming languages: construct stacks, synth
CloudFormation, deploy with diff verification.
When to Use
- Building infrastructure as versioned code
- Reusable stack patterns across environments
- Reviewable, testable infra changes
Real Commands
# Scaffold
sudo cdk init app --language typescript
# Bootstrap the account/region (once)
sudo cdk bootstrap aws://ACCOUNT_ID/eu-west-1
# Synthesize CloudFormation
sudo cdk synth
sudo cdk synth MyStack
# Preview changes
sudo cdk diff
# Deploy
sudo cdk deploy --all --require-approval never
sudo cdk deploy MyStack --context env=prod
# Lists stacks
sudo cdk list
# Destroy
sudo cdk destroy --all --force
Example Stack (lib/my-stack.ts)
import * as s3 from 'aws-cdk-lib/aws-s3';
export class MyStack extends Stack {
constructor(scope: Construct, id: string, props: StackProps) {
super(scope, id, props);
new s3.Bucket(this, 'Bucket', {
bucketName: `app-assets-${this.account}`,
versioned: true,
});
}
}
Best Practices
- Use environments (accounts/regions) as context per stack
- Review
cdk diff in PRs, not just deploy
- Prefer L2 constructs and escape hatches for customization
- Add tests with assertions on the synthesized template
- Bootstrap once per account/region with a dedicated role
Example Response
Synthesizes the app, diffs against the live account, deploys, and reports the
created resources with their ARNs.
Capabilities
aws-cdk
Manage CDK apps across their full lifecycle
Parameters:
language (string): App language: typescript, python, java, go
require-approval (string): Deploy approval: never, any-change, broadening
context (string): Context values, e.g. env=prod
Commands:
cdk init app --language typescript
cdk bootstrap aws://ACCOUNT_ID/eu-west-1
cdk synth
cdk diff
cdk deploy --all --require-approval never
Examples:
- cdk list
- cdk deploy MyStack --context env=prod
- cdk destroy --all --force
References
1---2name: "cdk"3description: "Defines AWS infrastructure as code with the AWS CDK: init, synth, diff, deploy, and destroy. Use when working with aws cdk, devops or when the user mentions aws cdk, devops."4license: "MIT"5compatibility: "Requires cdk."6metadata:7 source: https://skillmd.com/skills/opknock/cdk8 author: Kdesk9 version: 2.0.010 category: devops11allowed-tools: "Glob Grep Read Bash(cdk:*)"12---1314Defines AWS infrastructure as code with the AWS CDK: init, synth, diff, deploy, and destroy.1516## Agentic Workflow: Read -> Reason -> Act (cdk)1718You are **cdk** (devops/general) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.1920### 1. Read — devops context for `cdk`21- Domain: Defines AWS infrastructure as code with the AWS CDK: init, synth, diff, deploy, and destroy.22- **aws-cdk**: Manage CDK apps across their full lifecycle — `cdk init app --language typescript`23- Check `knowledge` and `prerequisites: cdk`2425### 2. Reason — think for `cdk`26- For `aws-cdk`: Manage CDK apps across their full lifecycle — decide which checks to run27- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs2829### 3. Act — execute with `cdk` tools30- Tools: `Glob`, `Grep`, `Read`, `Cdk` (see frontmatter `tools`/`allowed-tools`)31- Use `safe_path` for any write; record evidence (paths, checksums)32- Fingerprint: `cdk:a313a8ed`3334# AWS CDK3536Infrastructure as code with real programming languages: construct stacks, synth37CloudFormation, deploy with diff verification.3839## When to Use4041- Building infrastructure as versioned code42- Reusable stack patterns across environments43- Reviewable, testable infra changes4445## Real Commands4647```bash48# Scaffold49sudo cdk init app --language typescript5051# Bootstrap the account/region (once)52sudo cdk bootstrap aws://ACCOUNT_ID/eu-west-15354# Synthesize CloudFormation55sudo cdk synth56sudo cdk synth MyStack5758# Preview changes59sudo cdk diff6061# Deploy62sudo cdk deploy --all --require-approval never63sudo cdk deploy MyStack --context env=prod6465# Lists stacks66sudo cdk list6768# Destroy69sudo cdk destroy --all --force70```7172## Example Stack (lib/my-stack.ts)7374```ts75import * as s3 from 'aws-cdk-lib/aws-s3';7677export class MyStack extends Stack {78 constructor(scope: Construct, id: string, props: StackProps) {79 super(scope, id, props);80 new s3.Bucket(this, 'Bucket', {81 bucketName: `app-assets-${this.account}`,82 versioned: true,83 });84 }85}86```8788## Best Practices8990- Use environments (accounts/regions) as context per stack91- Review `cdk diff` in PRs, not just deploy92- Prefer L2 constructs and escape hatches for customization93- Add tests with assertions on the synthesized template94- Bootstrap once per account/region with a dedicated role9596## Example Response9798Synthesizes the app, diffs against the live account, deploys, and reports the99created resources with their ARNs.100101## Capabilities102103### aws-cdk104Manage CDK apps across their full lifecycle105106**Parameters:**107- `language` (string): App language: typescript, python, java, go108- `require-approval` (string): Deploy approval: never, any-change, broadening109- `context` (string): Context values, e.g. env=prod110111**Commands:**112- `cdk init app --language typescript`113- `cdk bootstrap aws://ACCOUNT_ID/eu-west-1`114- `cdk synth`115- `cdk diff`116- `cdk deploy --all --require-approval never`117118**Examples:**119- cdk list120- cdk deploy MyStack --context env=prod121- cdk destroy --all --force122123## References124- [AWS CDK docs](https://docs.aws.amazon.com/cdk/v2/guide/home.html)125- [CDK CLI reference](https://docs.aws.amazon.com/cdk/v2/guide/cli.html)