Introducing AWS Solutions Constructs

AWS announced that they’re presenting a library of predefined CDK constructs available to use. IMHO it is an awaited element, that should be available from a day zero. Let’s investigate what it brings to the table!

Finally! I think this is an exciting announcement, especially the community prepared something like this earlier (cdk-patterns). I do not have anything against a community-driven version, but it should be the creator’s responsibility to provide an initial release for it.

Let’s investigate what it is and what it gives.

What are AWS Solutions Constructs?

AWS Solutions Constructs (Constructs) is an open-source extension of the AWS Cloud Development Kit (AWS CDK) that provides multi-service, well-architected patterns for quickly defining solutions in code to create predictable and repeatable infrastructure. The goal is to accelerate the experience for developers to build solutions of any size using pattern-based definitions for their architecture.

Definition from the official documentation.

In other words: it’s the way to create architecture in an opinionated way with the use of AWS best practices. It is also great a presentation of the AWS CDK capabilities (mostly reusability and modularity) and a model example of how it can work.

Here you can browse the full catalog of AWS Solutions Constructs patterns. Additionally, you can review the available examples in the form of the use cases that contain a complete and working implementation of a given problem (e.g., AWS Static S3 Website). 

Example use cases for AWS Solutions Constructs available in the library.
Example use cases for AWS Solutions Constructs available in the library.

So how can we add those to our projects? We need to add a dependency, and use it as a typical CDK construct: 

const { LambdaToS3 } = require("@aws-solutions-constructs/aws-lambda-s3"); new LambdaToS3(stack, "LambdaToS3Pattern", { lambdaFunctionProps: { runtime: lambda.Runtime.NODEJS_10_X, handler: "index.handler", code: lambda.Code.asset(`${__dirname}/lambda`) } });


At the moment there a few problems with the library:

  • AWS Solutions Constructs is supported on AWS CDK ≥ 1.46.0.
  • It supports TypeScriptJavaScriptPython, and Java at this time – so no .NET.
  • Each construct is marked as experimental when it comes to stability. So probably it will evolve, and potential updates may introduce breaking changes.
    • I’d suggest pinning to a precise version, but it may propagate to a problem with AWS CDK versioning, as main can be in higher version than solution construct, and we may face difficulties.

What’s next?

I think the first step should be to stabilize a few, the most popular solutions. It is a recent addition to the CDK (22nd of June 2002), so we need to be patient.

Nevertheless, that’s something that I expected and wanted. This is a significant improvement in the adoption of AWS CDK and something that I missed in the AWS CloudFormation space (I do not count the plethora of sparse, official/unofficial templates here and there).

By Wojciech Gawroński

Principal Cloud Architect at Pattern Match. Infrastructure as Code, DevOps culture and AWS aficionado. Functional Programming wrangler (Erlang/Elixir).

2 replies on “Introducing AWS Solutions Constructs”

Leave a Reply to AWS Maniac Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.