AWS construct library
The AWS CDK is shipped with an extensive library of constructs called the AWS Construct Library. The construct library is divided into modules, one for each AWS service. For example, if you want to define an AWS Lambda function, we will need to use the AWS Lambda construct library.
To discover and learn about AWS constructs, you can browse the AWS Construct Library reference.

A few words about copying & pasting
It is highly recommended to type CDK code instead of copying & pasting (there’s usually not much to type). It’s especially cool to see your IDE help you with auto-complete, inline documentation and type safety.

A word about constructs and constructors
As you can see, the class constructors of both CdkWorkshopStack and lambda.Function (and many other classes in the CDK) have the signature (scope, id, props). This is because all of these classes are constructs. Constructs are the basic building block of CDK apps. They represent abstract “cloud components” which can be composed together into higher level abstractions via scopes. Scopes can include constructs, which in turn can include other constructs, etc.
Constructs are always created in the scope of another construct and must always have an identifier which must be unique within the scope it’s created. Therefore, construct initializers (constructors) will always have the following signature:
scope: the first argument is always the scope in which this construct is created. In almost all cases, you’ll be defining constructs within the scope of current construct, which means you’ll usually just want to passthisfor the first argument. Make a habit out of it.
id: the second argument is the local identity of the construct. It’s an ID that has to be unique amongst construct within the same scope. The CDK uses this identity to calculate the CloudFormation Logical ID for each resource defined within this scope. To read more about IDs in the CDK, see the CDK user manual.
props: the last (sometimes optional) argument is always a set of initialization properties. Those are specific to each construct. For example, thelambda.Functionconstruct accepts properties likeruntime,codeandhandler. You can explore the various options using your IDE’s auto-complete or in the online documentation.