Clear an Initial AWS CDK Stack to Start Building an App From Scratch

Tomasz Łakomy
InstructorTomasz Łakomy

Share this video with your friends

Send Tweet
Published 4 months ago
Updated 3 months ago

In this quick lesson we're going to clear out the SQS Queue and SNS Topic that was created for us when we created a CDK app with cdk init in order for us to be able to start building our app from scratch.

Instructor: [0:00] Now is the time to create. Our stack currently contains an SQS queue and SNS topic, and both of those are things that we are not going to need to build our app.

[0:12] Let me go over here to our code and delete all of that. I'm also going to delete all of those unused imports. Also, this part can be removed. Now we are left with an empty stack.

[0:21] Let me go ahead, open up the terminal, and I'm going to run cdk diff. We can see that if I'm going to deploy this empty stack, I am going to destroy all of the resources that we have created before. This is exactly what we want.

[0:40] This is also a power of CDK because, with CDK, whatever we describe in our stack is what is going to be out there in the cloud after we do the cdk deploy.

[0:50] With that, I'm going to do cdk deploy. It's going to take a second because it needs to delete all of those resources that we have created previously. We can see those resources being actively deleted over here.

[1:02] Now, we can see that our empty to the app stack has been successfully deployed. Let me go back to AWS console. Here, in confirmation, if I click onto the app stack and click on resources, I'm going to see that I no longer have the SQS queue nor the SNS topic. I'm left with an empty stack.