AWS CDK allows us to define these dependencies explicitly, thereby enabling us to control the sequence in which resources are created or deleted. Install AWS CDK and TypeScript NPM packages
Now that we’ve configured our profile and installed the packages, it’s time to create an AWS CDK TypeScript project where you’re going to build the Amazon S3 Bucket construct. You can generate a new AWS CDK TypeScript project by running the following command in an empty directory: ➜ cdk init sample-app --language=typescript
You’ve successfully established a DependsOn relationship between an EC2 Instance and an RDS Instance using AWS CDK in TypeScript.