Open-source project
aws-samples/aws-cdk-examples avatar
aws-samples/aws-cdk-examples

aws-cdk-examples: the official CDK example repo, language by language

Example projects using the AWS CDK

5,635 stars2,472 forksTypeScriptApache-2.0

At a glance

What is it?
The aws-samples/aws-cdk-examples repository is AWS's own collection of small CDK apps, split by language, meant to be read after the Developer Guide or the CDK Workshop. It teaches patterns; it does not give you a production starter kit.
Who is it for?
Use aws-cdk-examples if you already know what a CDK construct is and want to see how a common service or infrastructure pattern is assembled in your language of choice. Skip it if you want a deployable production skeleton with CI, environment separation and tests already wired up, because the README frames the repo as an intermediate learning resource rather than a template.
Can I use it commercially?
Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 2 days ago.
What is it written in?
Mainly TypeScript, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 30, 2026, and from our analysis. They are not legal advice.

Editorial analysis

What aws-cdk-examples is, and who it is written for

The README opens by calling the repository "our official list of CDK example code." That sentence sets the scope. Each entry is a small demonstration of either a common service implementation or an infrastructure pattern, not a reusable library and not a scaffold generator. The README states the repo is "considered an intermediate learning resource" and should typically be referenced after reading the Developer Guide or the CDK Workshop. That ordering is the useful part of the description: if you have never seen a construct, a stack or a synth step, the examples will read as noise.

The audience is therefore narrow and specific. You are an engineer who already knows the CDK model and wants to see how a particular service is wired in the language you actually write. The repo is subdivided by language, and the README says the aim is "complete language parity (same subset of examples exist in each language)." That goal shapes how you should read any single example: it is written to be understandable in five languages, which tends to keep each one small and free of clever abstractions.

How the repository is organised across languages

The top level is a set of language directories: csharp/, go/, java/, python/, typescript/, plus scripts/ and the usual repository files. The README's table lists TypeScript, Python, .NET, Java and Go, and marks each of them Stable under JSII. It also notes that as additional languages are added they will be marked Developer Preview, which tells you the table is the authoritative place to check whether a language you care about is fully supported or still in preview.

The README does not describe how the language directories are laid out internally, and it does not publish a per-example inventory in the text. The practical consequence is that the README alone will not tell you whether a given service has an example in your language. You find that by browsing the directory for your language, which is also where the per-example build and deploy instructions live. The scripts/ directory exists at the top level but the README does not document what it contains, so treat it as an implementation detail of the repository's own tooling rather than something you are expected to use.

Installing the CDK and running your first example

The README gives no install command for the examples and no version pin. It points instead to the Developer Guide, the API Reference, the CDK Workshop and Construct Hub under Learning Resources, and the examples themselves are the code. So the honest first step is to install the CDK CLI globally, which is the standard entry point described by the CDK Workshop the README links to.

bash
npm install -g aws-cdk
cdk --version

The first line installs the CLI. The second prints the version, which is what you check before running any example, because nothing in this repository states which CDK version an example was written against.

From there you pick a language directory and a single example inside it. The README does not give the per-example command, so you read it from the example's own files: a Node-based example carries a package.json, and the standard sequence for a CDK app is install, synth, then deploy.

bash
cd typescript/<example-name>
npm install
npx cdk synth
npx cdk deploy

Replace <example-name> with the directory you chose. synth renders the CloudFormation template without touching your account, which is the step worth running first if you only want to read what the example produces. deploy creates real resources and, depending on the example, may cost money.

Finally, the repository ships a SNAPSHOT_TESTING.md file at the top level, which indicates that snapshot tests are part of how the examples are kept honest. The README does not explain the workflow, so if you plan to contribute a fix or a new example, read CONTRIBUTING.md and SNAPSHOT_TESTING.md before opening a pull request.

Where the examples stop being useful

The clearest limitation is stated by the project itself: this is an intermediate learning resource, not a starting template. Nothing in the README promises production readiness, and the design goal of parity across five languages pushes in the opposite direction. Code that must read naturally in TypeScript, Python, Go, Java and C# cannot lean on the idioms of any one of them, so you should expect examples to be deliberately plain.

There is a second, quieter limitation around versions. The README does not state which CDK version the examples target, and the repository has no releases to pin against. A CDK app written against an older construct API can still synth but produce deprecated resource properties, and you will only notice by reading the generated template. That is a real cost of copy-paste adoption: the example teaches the shape of the solution, and you still own the current API surface.

A third case is worth naming. If what you need is a supported, versioned construct with an owner and a changelog, this repository is the wrong place to look. It is a samples repository. The README's own pointer to Construct Hub is the better destination for anything you intend to depend on rather than learn from.

aws-cdk-examples compared with Terraform and plain CloudFormation

The comparison the repository invites is with the other two ways of describing AWS infrastructure. With CloudFormation you write the template directly, in JSON or YAML, and the template is the artifact you review and deploy. The CDK, which these examples demonstrate, puts a general-purpose language in front of that: you write TypeScript, Python, Go, Java or C#, and the CLI synthesises CloudFormation from it. That is the whole reason the repository has one directory per language instead of one directory of templates. The trade is real: you gain loops, conditionals, types and an editor that understands your infrastructure, and you take on a toolchain and a synth step between you and the template.

Terraform sits on the other side of a different line. It is not a CloudFormation front end; it has its own provider model and its own state file. The practical difference a reader of these examples will feel is that a CDK app's state lives in CloudFormation, so drift detection, rollback and stack deletion are the CloudFormation behaviours, whereas Terraform keeps a state file you must manage. The README does not make this comparison and takes no position on it. If you are choosing between them, the examples can only show you what the CDK side feels like to write; they cannot tell you which model fits your team.

Maintenance, licence and the cost of following along

The repository is not archived, and the last push was on 2026-09-22. There are no releases, so there is no version to upgrade to and no changelog to read. Upgrading, in practice, means re-reading the example you copied against the current CDK API and fixing what synth or deploy complains about. That is the maintenance cost of this repository, and it is paid by you, in your own project, not by the repository.

The licence is Apache-2.0, stated at the end of the README and present as a LICENSE file at the top level. For most teams that is a permissive licence with a patent grant, and copying an example into your own codebase is the intended use. This is not legal advice; if your organisation has rules about which licences may appear in shipped code, run the Apache-2.0 identifier past whoever owns that policy. Also note the NOTICE file at the top level, which Apache-2.0 projects typically use for attribution, and which the README does not discuss.

Editorial conclusion

Use aws-cdk-examples if you already know what a CDK construct is and want to see how a common service or infrastructure pattern is assembled in your language of choice. Skip it if you want a deployable production skeleton with CI, environment separation and tests already wired up, because the README frames the repo as an intermediate learning resource rather than a template. Before adopting anything from it, open the example's own directory and read its package manifest and stack file, since the README documents no per-example install command, no supported CDK version and no upgrade path.

Frequently asked questions

What is AWS CDK in simple terms?

The README describes the AWS Cloud Development Kit as the subject of this repository and links to its own project page. In practice, the examples here show CDK apps written in TypeScript, Python, .NET, Java and Go, which the CDK CLI turns into infrastructure.

Is AWS CDK better than Terraform?

The README takes no position on this and does not mention Terraform. What it does show is the CDK model: write infrastructure in a general-purpose language and synthesise CloudFormation from it, which is a different approach from a provider-and-state-file model.

Is AWS CDK still supported?

The README links to the CDK repository, the Developer Guide and the API Reference as official resources, and lists TypeScript, Python, .NET, Java and Go as Stable under JSII. The repository itself is not archived and its last push was on 2026-09-22.

What is AWS CDK vs SDK?

The README does not compare the CDK with the AWS SDK. It does say the examples demonstrate common service implementations and infrastructure patterns, and that the repo is an intermediate learning resource to be read after the Developer Guide or the CDK Workshop.

Official sources

  1. aws-samples/aws-cdk-examples on GitHub
  2. Issues
  3. License: Apache-2.0
  4. README
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/aws-samples-aws-cdk-examples.svg)](https://hysenlabs.com/projects/aws-samples-aws-cdk-examples)