Section 18: AWS CloudFormation Flashcards
CloudFormation is … ? (hint, it’s a buzzword term. buzzterm?)
infrastructure as code
T/F, A CloudFormation stack relies on things called “templates” to determine what infrastucture is warranted. These templates are basically yaml or json files. This code (the templates/aka yamls aka json files) can be version controlled.
True
T/F When you specify a template you can use the url of a template you uploaded to S3, or you can upload a template file when creating a stack (and the file will end up in a new S3 URL anyway)
S3. I beleive you reference this uploaded templates via URL.
Can you edit existing versions of uploaded templates?
No. You have to upload new versions of the template instead.
What are stacks identified by?
Name
What happens when you delete a template generated stack?
Every artifact belonging to that stack gets deleted
What is the manual way of deploying a CloudFormation template?
edit the template in the CloudFormation Designer and then use the console to input parameters.
What is the automated way of deploying CloudFormation templates?
You edit the yaml/json files and use aws cli to deploy the template.
What is the preferred way to deploy a cloudFormation template, manual or automatic?
Automatic.
What are template resources?
the aws resources declared in your template. These are mandatory.
What are the template parameters
the dynamic inputs for your template
what are the template mappings?
the static variables for your template
What are the template outputs?
references to what has been created
What are the template conditionals?
List of conditions to perform resource creation.
What is template metadata (answer is metadata)
metadata
What are the six main CloudFormation template components? What are the two template helpers?
main CloudFormation template components:
* resources
* parameters
* mappings
* outputs
* conditionals
* metadata
template helpers:
* references
* functions
Does the exam require you to write CloudFormation
No
Does the exam expect you to know how to read CloudFormation?
Yes
What is the name of the Resource created from this template? Is this template missing anything, or does it work?
Name is MyInstance. It’s not missing anything, it works.
T/F CloudFormation calls the things it makes “stacks”
true
Is the safest way to delete a stack to go into the individual components created by the stack and delete them, or is it to go to CloudFormation and delete the whole stack from there?
Delete the stack from CloudFormation, don’t try to delete each invidual resource on it’s usual aws page (ex, don’t go to ec2 and try to delete the ec2 instance associated with the stack).
T/F, steph thinks JSON is terrible for CloudFormation templates and that you should use YAML instead.
True
What is the core component of an aws cloudformation template?
Resources. These are MANDATORY. They represent the differente aws components that will be created and configured.
- Can template resources reference each other?
- Is this the valid resource identifier pattern:
AWS::aws-product-name::data-type-name
Yes. there are over 224 different types of resources.
What are parameters? When are they important?
Parameters are a way to provide inputs to your AWS CLoudFormation template. THey’re important if you want to reuse your templates accross a company. Some inputs cannot be determined ahead of time. You can ask yourself this: if a CloudFormation resource configuration is likely to change in the future, make it a parameter.
How do you reference a parameter in a template?
the Fn:Ref function can be leveraged to reference parameters. the shorthand for this in YAML is “!Ref” (but without the quotes). parameters can be used anywhere in the template.
Parameters:
Stage:
Type: String
Default: Dev
AllowedValues:
- Dev
- Prod
Conditions:
isProd: !Equals
- !Ref Stage
- Prod
isDev: !Equals
- !Ref Stage
- Dev
Which psuedo parameters can be referenced by default in any CloudFormation template?
- AWS::AccountId
- AWS::NotificationARNs
- AWS::NoValue
- AWS::Region
- AWS::StackId
- AWS::StackName
What are template mappings? Could you mention some key parts of a template with a region mapping?
Fixed variables within your cloudFormation Template. They’re very handy for differentiating between different environments (dev vs prod), regions (AWS), AMI types etc. all values are hardcoded within the template.
When would you use template mappings vs template parameters?
mappings are great when you’re dealing with variables such as aws regions, availabiilty zones, aws account, environment (dev v prod) etc. They allow safer controls over the template. Parameters are really best for when the values are user specific (not sure how this is different from account specific, but okay).
What do you use to return a named value from a specific key (a mapping key value pair) (hint, it’s code-looking.) Could you point out what the possible values of it might be in the picture?
Fn::FindInmap
!FindInMap [MapName, TopLevelKey, SecondLevelKey]
What is CloudFormation template Outputs section (or what goes in it/when would you use it etc)?
The outputs section declares optional outputs values that you can import into other stacks (if you export them first). you can view them using the aws console or aws cli. They’re useful if you define a network CloudFormation and output the variables such as VPC ID and Subnet IDs. It’s the best way perform some collaboration cross stack.