What I Learned Using AWS CDK Over the Past Year Alex, 20 May 202529 April 2025 A year with the AWS Cloud Development Kit (CDK) taught me more than just syntax and stack configuration. It rewired the way I approach infrastructure, automation, and software deployment. CDK bridges the gap between infrastructure and application logic, and this bridge is not without its construction quirks. Here’s what stood out after months of real-world use. 1. CDK Makes IaC More Developer-Friendly, But Not Effort-Free Writing infrastructure as code in a programming language like TypeScript feels natural if you’re coming from a development background. You skip YAML indentation fights and get real IDE support, autocomplete, and inline documentation. Still, CDK doesn’t write your architecture for you. You need to understand AWS constructs, permissions, and edge cases. The syntax might look familiar, but the implications of a misconfigured VPC or policy can be severe. 2. Abstractions Are a Double-Edged Sword High-level constructs like Bucket, Function, and RestApi simplify common tasks. They abstract away the boilerplate so you can launch fast. The downside? Once you hit a scenario not covered by the abstraction, you’re thrown into the weeds. Bridging high-level convenience with low-level customization often meant rewriting sections of the stack or using escape hatches like Cfn* resources. Example: The default RestApi construct works until you need fine-grained throttling or a custom domain with path mapping. Then you’re back to defining raw CloudFormation resources. 3. Context Management Needs Discipline CDK’s use of context values (cdk.context.json) allows you to cache environment-specific information. It’s helpful for things like availability zones or VPC lookups. It’s also a silent footgun. If your team doesn’t commit or sync this file properly, you’ll end up with different behaviors across environments. One team member may see a failed deployment while another has no issues. Fix: Always treat cdk.context.json as a managed file. Include it in source control. Know when to clear it. 4. Deploy Times Aren’t Instant — Plan Accordingly CDK deploys generate CloudFormation templates, and those templates take time to apply. If your stack is large or has complex dependencies, the deploy step can easily stretch past five or ten minutes. This affects CI/CD pipelines. It also means that “just testing a change” can be slower than expected. Stack modularization and resource retention policies can help, but don’t expect near-instant feedback loops. 5. Logical ID Management Can Bite You Later Behind the scenes, CDK generates logical IDs for CloudFormation. If you change certain identifiers or refactor constructs, the generated ID might change—even if you didn’t intend to replace the resource. The result: resources get destroyed and recreated. For something like an S3 bucket or RDS instance, this can cause data loss. Tip: Use overrideLogicalId() where stability matters. Otherwise, tag all stateful resources with removalPolicy: Retain. 6. Cross-Stack References Are Powerful but Risky CDK supports sharing outputs between stacks using exports and stack references. This is great for larger projects that separate networking, compute, and app layers. But cross-stack dependencies increase blast radius. One misconfigured dependency or reference loop can stall all deployments. Over time, the stacks become tightly coupled unless consciously kept clean. Solution: Prefer parameterized stacks or SSM Parameter Store for loosely coupling shared values. 7. The Construct Ecosystem Is Growing, But You Still Write Plenty The CDK Construct Library has grown with packages like aws-ecs-patterns or aws-s3-deployment. These help you deploy standard patterns quickly. Still, most real-world use cases require writing custom constructs. You’ll often hit gaps or need behavior that isn’t provided out of the box. You can build reusable constructs, but doing so well takes thought, versioning, and test coverage. 8. Testing Infrastructure Code Is Worth It Writing unit tests for infrastructure may feel like overkill, but they’ve saved my team hours. CDK’s assertions module lets you verify resource counts, properties, and relationships before deployment. Testing helped us catch: Misconfigured environment variables Missing IAM permissions Unintended resource replacements Write tests for anything involving conditional logic or resource loops. You’ll thank yourself later. 9. Documentation Doesn’t Always Match Reality CDK is under active development, and the documentation sometimes lags. Features get deprecated, behaviors change, and examples don’t always work as-is. Stack Overflow helps, but the best learning came from reading the actual source code of constructs or diving into GitHub issues. If something behaves strangely, check the implementation or open a discussion. The community and maintainers are responsive, but you need to be willing to investigate. 10. CDK Is More Than a Tool — It’s a Mindset Shift Using CDK well isn’t about memorizing classes. It’s about thinking in terms of reusable components, testable infrastructure, and application-aware deployment logic. You begin to see infrastructure as an extension of code, not something bolted on afterward. The learning curve is steep but worthwhile. Over time, your stack becomes not just easier to manage—but also easier to evolve. Software Engineering & Development