AWS Builder Center

aws-cdk-examples, read against today's AWS

aws-cdk-examples, read against today's AWS

aws-cdk-examples, read against today's AWS

aws-samples/aws-cdk-examples  is AWS's official list of CDK example code: 5,600 stars, 273 contributors, and a commit two weeks ago (6408f42, 22 September 2026). The README calls it "an intermediate learning resource", to be read after the Developer Guide and the CDK Workshop. Each example shows "a common service implementation, or infrastructure pattern".
This page reads it for one question: if you copy an example today, does it deploy against current AWS, using only what AWS offers?
The short answer has two halves:
  • The library side is well maintained. Every TypeScript example pins aws-cdk-lib 2.262.1 (one pins 2.268.0), and every Python example requires aws-cdk-lib>=2.262.0. A multi-language dependency updater was added three months ago (scripts/, PR #1301). No example imports CDK v1. The four @aws-cdk/... imports are v2 alpha modules (aws-lambda-python-alpha, aws-neptune-alpha).
  • The service side is not. The updater bumps packages. It does not touch the runtime and engine constants inside the code, and those are what AWS retires.

The numbers

count
example directories202 — TypeScript 79, Python 64, Java 22, Go 20, C# 17
distinct example names across languages147
… present in all five languages2 (classic-load-balancer, lambda-cron)
… present in exactly one language117 (49 TypeScript-only, 45 Python-only)
examples whose Lambda runtime is blocked at create15
examples on a runtime already deprecated, still creatable until 29 July 202720
examples using RemovalPolicy.DESTROY57
examples opening port 22 to 0.0.0.0/04 (one of them, an SFTP server, by design)

15 examples ask Lambda for a runtime it no longer creates

The Lambda runtime table has three dates per retired runtime: deprecation, block function create, and block function update. After "block function create", CreateFunction refuses that runtime. A new stack built from these examples fails at the first Lambda function.
runtime in the codeLambda blocked create onexamples
PYTHON_3_618 July 2022go/lambda-cron, python/lambda-layer
PYTHON_3_79 January 2024python/api-cors-lambda, python/cross-stack-resources, python/ec2-alarms-to-opsitem, python/image-content-search, python/lambda-layer, python/lambda-s3-trigger, python/lambda-triggered-by-existing-kinesis-stream, python/lambda-with-existing-s3-code, python/serverless-backend, python/url-shortener, csharp/elasticbeanstalk
DOTNET_CORE_3_13 April 2023csharp/apigateway-cognito-lambda-dynamodb
JAVA_8 (java8, Amazon Linux 1)8 February 2024java/api-cors-lambda-crud-dynamodb, java/s3-lambda-s3
That is 15 distinct examples; python/lambda-layer appears twice, using both 3.6 and 3.7. Ten of the 64 Python examples are in the table.
The fix in each is one constant:
  • Python: PYTHON_3_13 or later. Lambda's table gives 3.13 and 3.14 a deprecation date of 30 June 2029.
  • .NET: DOTNET_8 or later. Note that .NET 8's own deprecation date is 10 November 2026.
  • Java: JAVA_21.
Function code written for Python 3.7 usually runs on 3.13. Code using distutils or other removed modules does not, so test before bumping.
Already deprecated, still creatable until 29 July 2027:
runtimedeprecatedexamples
PYTHON_3_814 October 2024python/api-eventbridge-lambda, python/api-stages-lambda, python/rekognition-lambda-s3-trigger, python/s3-object-lambda
PYTHON_3_915 December 2025python/apigw-http-api-lambda-dynamodb-python-cdk, python/opensearch, python/s3-sns-sqs-lambda-chain, python/stepfunctions, java/eventbridge-lambda, java/lambda-cron, go/step-functions
NODEJS_18_X1 September 2025python/codepipeline-build-deploy, python/codepipeline-build-deploy-github-manual, go/codepipeline-build-deploy
NODEJS_20_X30 April 2026python/amazon-verified-permissions-rest-api, csharp/my-widget-service, csharp/random-writer, java/my-widget-service
PROVIDED_AL231 July 2026go/restapi-lambda, go/sqs-lambda
Due soon: PYTHON_3_10 on 31 October 2026, and DOTNET_8 on 10 November 2026.
The most common runtimes in the repository are current: NODEJS_24_X (29 uses), PYTHON_3_12 (18), NODEJS_LATEST (12), PYTHON_3_14 (9). The examples written or refreshed recently are fine. The table above is the long tail nobody revisited.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article