DEV Community

Cover image for Why I picked AWS CDK?
Fabien Townsend
Fabien Townsend

Posted on • Updated on

Why I picked AWS CDK?

Title: Choosing AWS CDK for Infrastructure Improvement: A Practical Approach


Introduction

In this article, I'll detail the reasoning behind my choice of AWS CDK (Cloud Development Kit) based on a real-life scenario. Drawing from my extensive experience as a software consultant and product engineer for start-ups, I'll walk you through the decision-making process and share insights gained from working on projects with demanding automated testing requirements.

High level issue with software

Identifying the Challenge

The challenge at hand involved a software system plagued by reliability issues. This system was hosted on an EC2 server and deployed manually through FTP, resulting in a user-experience problem where the server frequently lost user states, forcing a restart of user journeys from the beginning.

Approaching the Issue

My initial approach was twofold: comprehensively understand the problematic features and their expectations. Once I had a clear understanding, I considered two potential strategies:

  1. Work with the existing legacy code and fix identified issues.
  2. Reimplement the feature from scratch.

Choosing between these options was contingent on a case-by-case evaluation, with the understanding that "just rewriting it" shouldn't be the default solution.

Considering Solutions

When addressing problems, I habitually explore diverse solutions and weigh their trade-offs. This might involve:

  • Implementing a straightforward fix.
  • Implementing a temporary hotfix while planning a comprehensive solution.
  • Opting for a complete rewrite.

The Decision to Improve

In this particular case, with a tight deadline for the fix and an opportunity to enhance the team's workflow, I chose not only to address the issue by rewriting the code but also to improve infrastructure and deployment processes.

Choosing AWS CDK

Considering various tools like AWS CloudFormation, Terraform, Serverless framework, and AWS CDK, I opted for AWS CDK. This decision was influenced by my limited experience with AWS CloudFormation and Terraform, as well as the consideration that their learning curves might not align with the team's proficiency. Comparing Serverless and AWS CDK, I leaned towards AWS CDK due to its flexibility and the fact that our infrastructure was entirely on AWS.

AWS CDK logo

Key Factors for Choosing AWS CDK

  • Familiarity with AWS infrastructure.
  • Flexibility required for the project.
  • Quick decision-making, prioritizing agility over extensive research.
  • Positive experiences with ChatGPT-generated insights for implementation.

Implementation and Results

Deploying and testing AWS Lambda + AWS API Gateway with the refactored functionality proved successful in addressing the reliability issue. The outcome includes:

  • Migration of one service from an EC2 server to a Lambda function.
  • Enhanced understanding of the service.
  • Streamlined code updates and deployments through the CLI.

High level representation of the solution

Conclusion

AWS CDK has proven to be an impressive tool, facilitating swift infrastructure deployment and code updates. Its user-friendly approach aligns well with our need to move rapidly and adapt to evolving requirements. The decision-making process, though expedited, remains open to future adjustments, recognizing the potential for evolving needs and associated costs.

Top comments (0)