Cleaning Up Resources

Cleaning Up Resources

To delete resources deployed through the AWS Cloud Development Kit (CDK), you need to use the cdk destroy command in your CDK project. Here are the basic steps to accomplish this:

  1. Open Terminal or Command Prompt: Open a terminal or command prompt window on your computer.
  2. Navigate to the CDK Project Directory: Use the cd command to move to the directory containing your CDK project.
cd path/to/your/cdk/project
  1. Run the cdk destroy Command: Once in the project directory, use the cdk destroy command to delete the resources. This command will list all the resources to be deleted and ask for your confirmation before proceeding.
cdk destroy
  1. Confirm Resource Deletion: When prompted, you need to confirm that you want to delete the resources. This usually requires entering “y” or “yes”.

  2. Wait for the Process to Complete: The AWS CDK will proceed to delete the resources. This process can take a few minutes depending on the number and type of resources being deleted.

Note that using cdk destroy will delete all the resources managed by the CDK stack you are working with. Make sure you no longer need these resources before proceeding with the deletion.