Cleanup sample

Delete the sample code from your stack

The project created by cdk init sample-app includes an SQS queue and queue policy, an SNS topic and subscription. We’re not going to use them in our project, so remove them from the CdkworkshopStack constructor.

Open cdkworkshop/ and clean it up. Eventually it should look like this:

from aws_cdk import (

class CdkworkshopStack(core.Stack):

    def __init__(self, scope: core.Construct, id: str, **kwargs) -> None:
        super().__init__(scope, id, **kwargs)

        # Nothing here!

cdk diff

Now that we modified our stack’s contents, we can ask the toolkit to show us the difference between our CDK app and what’s currently deployed. This is a safe way to check what will happen once we run cdk deploy and is always good practice:

cdk diff

Output should look like the following:

Stack cdkworkshop
IAM Statement Changes
│   │ Resource                        │ Effect │ Action          │ Principal                 │ Condition                                                       │
│ - │ ${CdkworkshopQueue18864164.Arn} │ Allow  │ sqs:SendMessage │ │ "ArnEquals": {                                                  │
│   │                                 │        │                 │                           │   "aws:SourceArn": "${CdkworkshopTopic58CFDD3D}"                │
│   │                                 │        │                 │                           │ }                                                               │
(NOTE: There may be security-related changes not in this list. See

[-] AWS::SQS::Queue CdkworkshopQueue18864164 destroy
[-] AWS::SQS::QueuePolicy CdkworkshopQueuePolicy78D5BF45 destroy
[-] AWS::SNS::Subscription CdkworkshopQueuecdkworkshopCdkworkshopTopic7642CC2FCF70B637 destroy
[-] AWS::SNS::Topic CdkworkshopTopic58CFDD3D destroy

As expected, all of our resources are going to be brutally destroyed.

cdk deploy

Run cdk deploy and proceed to the next section (no need to wait):

cdk deploy

You should see the resources being deleted.