Diagram
AWS Cloud Development Kit Tree/Node Diagram (draw.io viewer)
Details
- The AWS CDK is a tree/node relationship structure, requiring the initializing of the root node via the
app = new.cdk.App()
object, imported from theaws-cdk-lib
CDK library. The object inherits theStage
object which in turn inherits theConstruct
object. - Subsequent AWS resources are instantiated
Stack
objects, such as thebucketStack = new BucketStack(app, 'BucketStack')
instance created, which in turn inherits theConstruct
object. - Hence, each new instantiation of an AWS resource, is a child of the Construct, which is then added to the root Construct,
app
per the firstscope
argument for each instantiated resource’s constructor.- i.e., handlerStack = new HandlerStack(
app
, ‘HandlerStack’, extendedProps..)
- i.e., handlerStack = new HandlerStack(
- Resouces created inside resources, such as the
new LambdaFunction(this, 'LambdaFunction', FunctionProps)
Lambda functions, contains the first argumentthis
, for thescope
parameter since this is the parent object, handlerStack, which inherits aConstruct
object.
To button up the tree node relationship, each object is inherited from Construst
, which in turn is nested within each other via the scope
parameter, either as this when scoping in as a child of a resource, such as handlerStack, or as app for each new instantiated resource. Each nested resource is scoped within it’s parent, and each resource is scoped within its root node, app
.