CDK Constructs
Constructs are further divided into 3 levels L1, L2 and L3:
L1 Constructs
These constructs represent constructs that are defined by cloud formation. These constructs are generated from cloud formation resource specification.
Below is example for L1 construct for S3 bucket which is CfnBucket in javascript:
Javascript
const gfgbucket = new s3.CfnBucket(stackname, "gfgbucket" , { bucketName: gfgbucket" }); |
Below is example for L1 construct for Dynamo DB which is CfnTable in javascript:
Javascript
new dynamodb.CfnTable( stack name , "gfgtable" , { keySchema: [ { attributeName: props.attributeName, keyType: "HASH" , }, ], attributeDefinitions: [ { attributeName: props.attributeName, attributeType: "S" , }, ], }, ); |
L2 Constructs
These constructs are higher level constructs built over L1 constructs. These include predefined configurations and methods for configuring services reducing complexity and providing more abstraction.
L3 Constructs
These constructs are top level constructs which are used to define patterns for multiple resource provisioning or designing higher level architectures using AWS CDK.
AWS CDK(Cloud Development Kit)
AWS CDK or Cloud Development Kit is a framework that allows you to use reusable components called constructs to build cloud environments. Developers can build and create cloud services using Integrated Development Environments with the help of libraries and components. AWS CDK provides a simple and easy approach to building infrastructure with the help of programming languages. So, let’s learn more about AWS CDK.