Every construct takes the same three arguments. Add your first one — a versioned S3 bucket — and watch it synthesize.
Every construct you'll ever write in CDK — a bucket, a table, a function, all of it — takes the same three arguments.
export class FirstStack extends Construct {
constructor(scope: Construct, id: string) {
super(scope, id);
// resources go here
}
}scope — the parent construct this one lives inside. Every resource in a CDK app sits somewhere in a tree; scope is that resource's position in it.id — a name unique within scope, used to tell resources apart and to derive the logical IDs CloudFormation actually uses.super(scope, id) — calls the parent class's constructor, wiring your construct into that tree before you add anything to it.Every resource you create inside — new Bucket(this, 'MyFirstBucket', ...) — follows the exact same shape: this as the scope, a string id, then whatever properties that resource needs.
Add a single S3 bucket, MyFirstBucket, with versioning turned on.
new Bucket(this, 'MyFirstBucket', {
versioned: true,
});Run the synthesizer and you'll see this exact construct turn into a real AWS::S3::Bucket resource in the CloudFormation output — the same translation that happens whether you deploy it from CloudSynth's sandbox or, in the next lesson, from your own machine.
Edit the construct, then run synth & validate to check your work.