CloudFormation and CDK Flashcards
What is AWS CloudFormation?
A declarative service to outline and manage AWS infrastructure as code.
What are the benefits of CloudFormation?
Infrastructure as code, version control, cost estimation, productivity, reusable templates.
How does CloudFormation work?
Templates define resources, uploaded to S3, and referenced by CloudFormation to create/update stacks.
What happens when a stack is deleted?
All resources created by the stack are deleted.
What are CloudFormation building blocks?
Resources (mandatory), Parameters, Mappings, Outputs, Conditionals, References, Functions.
Which languages are used for CloudFormation templates?
YAML and JSON; YAML is preferred.
What are CloudFormation resources?
Core components of a template that define AWS infrastructure.
Can CloudFormation create dynamic number of resources?
Yes, using Macros and Transforms.
What are CloudFormation Parameters?
Inputs to templates for reuse and dynamic configuration.
When should you use Parameters?
When values are user-specific or likely to change.
What are CloudFormation Mappings?
Fixed variables to differentiate values like region or environment.
How to access Mapping values?
Use Fn::FindInMap.
When to use Mappings vs Parameters?
Mappings for predictable values, Parameters for dynamic inputs.
What are CloudFormation Outputs?
Named values you can declare in your template to return information about the resources that were created. Share values with other stacks (cross-stack references).
How to use cross-stack references?
Use Fn::ImportValue in the referencing stack.
What are CloudFormation Conditions?
Logic to create resources based on parameter values or environment.
How to use a Condition in a resource?
Attach a Condition with logical functions like Fn::If.
What is Fn::Ref used for?
Reference parameters and resources.
What does Fn::GetAtt do?
Get attributes from a resource (e.g., AZ from an EC2 instance).
What does Fn::Base64 do?
Encodes a string to Base64, e.g., for EC2 UserData.
What happens when stack creation fails?
Rolls back all created resources unless rollback is disabled.
What is a CloudFormation Service Role?
IAM role that AWS CloudFormation assumes on your behalf to create, update, or delete stack resources.
What are CAPABILITY_NAMED_IAM and CAPABILITY_IAM?
Explicit acknowledgments you must provide when your CloudFormation template creates or modifies IAM resources
What is CAPABILITY_AUTO_EXPAND?
Used when templates use Macros or Nested Stacks.