CDK walkthrough

Inside the infrastructure-as-go/cdk-go/hellocdk directory of the git repo:

1 Show local stack names

cdk ls
HellocdkStack

2 Deploy stack

During deploy

cdk deploy
HellocdkStack: deploying...
[0%] start: Publishing aaaa958c50090e7f44be864f4e9e2bae793087e92a70410a7e1cad7511759b66:current_account-current_region
[100%] success: Published aaaa958c50090e7f44be864f4e9e2bae793087e92a70410a7e1cad7511759b66:current_account-current_region
HellocdkStack: creating CloudFormation changeset...
[███████████████████▎······································] (1/3)

18:42:05 | CREATE_IN_PROGRESS   | AWS::CloudFormation::Stack | HellocdkStack
18:42:09 | CREATE_IN_PROGRESS   | AWS::SNS::Topic    | MyTopic

After deploy

cdk deploy
HellocdkStack: deploying...
...

 ✅  HellocdkStack

Stack ARN:
arn:aws:cloudformation:eu-central-1:795048271754:stack/HellocdkStack/a5059400-31c4-11ec-adbe-026289f72b2e

3 Show status of stacks with cdkstat

Prepare

cdk ls >stacks.csv

Show

cdkstat
Name                             Status                           Description
----                             ------                           -----------
HellocdkStack                    CREATE_COMPLETE                  -

Show created resources

 cdkstat HellocdkStack
Logical ID                       Pysical ID                       Type                             Status
----------                       ----------                       -----------                      -----------
CDKMetadata                      a5059400-31c4-11ec-adbe-026289f  AWS::CDK::Metadata               CREATE_COMPLETE
MyTopic86869434                  arn:aws:sns:eu-central-1:795048  AWS::SNS::Topic                  CREATE_COMPLETE

4 Destroy

cdk destroy
Are you sure you want to delete: HellocdkStack (y/n)? y
HellocdkStack: destroying...
 ✅  HellocdkStack: destroyed

See also