Saturday, December 11, 2021

AWS CDK (Cloud Development Kit): IaC from TypeScript, Python, C#, Java, vs ...

AWS Cloud Development Kit (CDK)

"The AWS Cloud Development Kit (AWS CDK) is an open-source software development framework to define your cloud application resources using familiar programming languages."

AWS CDK is "pre-processor" generating AWS CloudFormation templates for declarative "infrastructure as a code" (IaC, IaaC) on AWS.

While CloudFormation is also "IaC", the "code" there is in form of JSON or YML config files. No "real" executable code, instead "configuration".

In CDK the definition of this cloud infrastructure is done from standard programming languages: JavaScript, TypeScript, Python, C#, Java, by using modules / libraries for those languages. From that code CDK "under the hood" generates CloudFormation and leverages all available AWS infrastructure.

There are 2 levels of such modules: "level 1" that directly maps to CloudFormation templates,
and "level 2" that is a bit "higher level of abstraction", that hides some of internal details required for defining AWS resources and focuses on what is essential, resulting in much smaller number of lines of code: more readable and maintainable system.

Related or similar tools that can be used for AWS IaC

- CloudFormation itself: most of AWS is based on CloudFormation, so that is a "safe choice", while YML and especially JSON configuration files could get quite complex and brittle sometimes. No intelli-sense, not real code :)

- Serverless framework: a tool for deploying and managing "serverless" resource on various cloud providers, including AWS. The configuration is done in form of custom simple YML files that generate and deploys by CloudFormation template. Newer version can also integrate with CDK itself.

Advantage: widely used tool, support for multi-cloud;
Limitation: serverless resources only (Lambda, S3, API gateway and related)

- AWS SAM: Serverless Application Model: a "native" AWS tool that is similar to Serveless framework, specific to AWS. SAM also includes "local emulators" of serverless resources like Lambda. 
compared: SAM vs Serverless

Effectively SAM has subset of features of AWS CDK, a bit simpler and limited to serverless. 

- Terraform  is a popular multi-cloud deployment tool, where "infrastructure" is defined in a custom, relatively simple to use language. "Under the hood" Terraform is different from CDK, since it is calling management APIs of cloud providers directly, not leveraging AWS CloudFormation "declarative" tools.

That "imperative / procedural" approach means that Terraform needs to implement support for many scenarios where resources are crated or removed in specific order, detecting differences etc. For the users of the tools this is not really important as long as it works as expected, though. 

The advantage of AWS CDK is direct integration with common programming languages instead of need to learn and use new platform, and ability to leverage powerful features of those general purpose programming languages. The advantage of Terraform is support for multiple "clouds". 
 
- Pulimi is likely THE main reason why Amazon decided to invest heavily in CDK. Pulumi extends common programming languages with "cloud management" libraries, same as AWS CDK does, while Pulumi also support other major cloud providers and tools: Azure, GCP, Kubernetes and 50 more. 

JavaScript, Go, Python, C#, but no Java support yet :)
Founded by ex-Microsoft developers, this new startup has relatively high valuation already. 

Useful links

github.com/aws-samples/aws-cdk-examples

Developer Guide







Microsoft Team "metaverse" ( 3D animated avatars)

 Microsoft Teams (Mesh) gets 3D animated avatars, because metaverse | TechCrunch

Mesh for Teams slide 6

Microsoft Metaverse vs Facebook Metaverse (Watch the reveals) - YouTube


“meta-worse” :)