Cloud Development Kit Flashcards
How can you use SAM CLI to test CDK apps?
Run cdk synth to generate your CloudFormation template from the code
-> Use sam invoke to run your template that was generated from the synth command
What is a CDK contruct?
A component that encapsulates everything CDK needs to create the final CF stack
-> Can represent one or more AWS resources (e.g., S3 bucket, worker queue with compute)
What is CDK bootstrapping?
Provisioning resources for CDK before you deploy CDK apps into an environment
-> Run the command cdk bootstrap
-> Creates a CF Stack called CDKToolkit: contains an S3 bucket and IAM roles
How can you test CDK apps?
Using CDK Assertions Module
What types of testing are available for CDK apps?
Fine-grained assertions
-> Test specific aspects of the CF template (resource has a property with value X)
Snapshot Tests
-> Test the synthed CF template against a previously stored baseline template
What methods do you have to import a template for CDK testing?
Template.fromStack(MyStack) - stack built in CDK
Template.fromString(mystring) - stack built outside CDK