CDK Flashcards

1
Q

How can you use SAM to locally test your CDK apps?

A
  1. Run cdk synth to generate a CloudFormation template
  2. Run sam local invoke – t <CFtemplateName> <functionName></functionName></CFtemplateName>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

When and how many times do you need to run CDK Bootstrap

A

Once per region per Account, in order to set up CDK

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the correct order of steps to be followed for creating an app using AWS CDK?

A
  1. CREATE the app from a template provided by AWS CDK
  2. ADD CODE to the app to create resources within stacks
  3. BUILD the app (optional)
  4. SYNTHESIZE one or more stacks in the app
  5. DEPLOY stack(s) to your AWS account
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the necessary prerequisites to deploying any CDK stack in an environment?

A

You need to Bootstrap the CDK Toolkit by using cdk Bootstrap aws://account/region and it contains:
an S3 Bucket to store files
IAM roles

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What if you try to deploy and you didn’t perform the Bootstrap?

A

You get an error about invalid principal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do you test your CDK app?

A

Use the CDK Assertions module

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the 2 commands to import a template for testing?

A
  1. Template.fromStack(MyStack) - for templates built inside CDK
  2. Template.fromString(MyString) - for templates built outside CDK
How well did you know this?
1
Not at all
2
3
4
5
Perfectly