Skip to content

towardsthecloud/aws-cdk-examples

Repository files navigation

AWS CDK Examples Banner

AWS CDK Examples

A collection of AWS CDK code samples crafted in TypeScript, featured on my blog at https://towardsthecloud.com/blog

Tip

Towards the Cloud runs the AWS foundation for modern product teams. This means your team ships faster, slashes AWS spend, and stay audit-ready without having to hire a platform squad.

Unsure where to start? Book a free AWS Account Review. We’ll analyse your AWS environment, hand you a security & cost report, and you decide whether to act on it yourself or have us execute. No pressure, no retainer required up front.

Book a Free AWS Account Review

☁️ See how we turn AWS chaos into a compliant, cost-efficient platform…

The problem: AWS complexity compounds fast

Ad‑hoc builds become 40–60% overspend, unmonitored security gaps put customer data at risk, and engineers burn out running infrastructure instead of shipping products.

Our managed foundation keeps you moving forward

  • Compliant Landing ZoneMulti-account AWS CDK deployment with 100% CIS benchmark coverage, centralized logging, and SSO-ready access control.
  • Production-ready CDK components – Pre-hardened building blocks so teams launch new services without reinventing best practices.
  • CI/CD with safe rollbacks – GitOps workflows and governed pipelines that let you release faster with confidence.
  • Quarterly cost & security reviewsCost Optimisation plus Security Reviews delivered proactively.
  • Fractional Cloud Engineer – On-demand expertise from an architect who implemented enterprise-grade AWS infrastructure for over a decade.

Outcomes our customers see

  • 30%+ lower AWS bill – Continuous oversight prevents expensive drift (30–60% documented savings).
  • SOC 2 / HIPAA acceleration – Guardrails, logging, and evidence packs ready on day one.
  • Audit-ready every quarter – Automated monitoring plus recurring reviews keep findings under control.
  • Faster product velocity – Engineers build features, not managing infrastructure.
  • Headcount leverage – A flexible retainer replaces the cost of a full-time platform team.

Proof: Y Combinator startup Accolade used our Landing Zone to earn SOC 2 in record time:

“We achieved a perfect security score in days, not months.” — Galen Simmons, CEO

Ready to see where your AWS account stands? Grab a spot while they’re available:

Book a Free AWS Account Review

How to run the code from the examples

To run a Typescript example, execute the following:

$ npm install -g aws-cdk
$ cd EXAMPLE_DIRECTORY
$ npm install
$ cdk synth
$ cdk deploy

Then, to dispose of the stack/s afterwards

$ cdk destroy

Table of Contents

AWS CDK Example Description Blogpost link
application-load-balanced-fargate-service Create an Application Load Balanced Fargate Service in AWS CDK Click here
cloudfront-s3-origin Create a CloudFront distribution with an S3 bucket as origin .
custom-role-lambda-function Create a custom IAM role for an AWS Lambda function Click here
aws-cdk-dependson-relation Create a DependsOn relation between resources in AWS CDK Click here
openid-connect-bitbucket Create a Bitbucket OpenID Connect (OIDC) provider in AWS CDK Click here
openid-connect-github Create a GitHub OpenID Connect (OIDC) provider in AWS CDK Click here
rds-with-cloudwatch-alarms Create an Amazon RDS instance with custom CloudWatch alarms .
scheduled-fargate-task Create a Scheduled Fargate Task example in AWS CDK Click here
scheduled-rds-stop-and-start Create a Scheduled stop and start function for an Amazon RDS Instance Click here
share-resources-across-stacks Create a stack where you share resources to another stack Click here

Author

Danny Steenman

Sponsor this project