CloudFormation 1 Flashcards
Nested Stacks
What are Nested Stacks?
Multi-level tree of stacks that all deploy together, succeed/fail together, delete together
Nested Stacks
What about resourcees in a stack and individual lifecycles?
All resources in a single stack share a common lifecycle (live and die together)
Nested Stacks
Max number of resources in a single CFN Stack?
500
Nested Stacks
Why aren’t single-stack solutions a good idea in an enterprise?
Can’t re-use anything in a stack
Nested Stacks
How do you set up Nested Stacks?
AWS::CloudFormation::Stack resource, points to a URL where the template lives
Nested Stacks
How do parent-child stacks communicate?
Parent passes Parameters to child, child’s Outputs referencable in parent stack
Nested Stacks
How can a parent stack reference individual resources in a child stack?
Can’t. Parent can only reference the child’s Outputs section
Nested Stacks
How do you control the sequence of parent resources and multiple child stacks?
DependsOn
Nested Stacks
When should you use Nested Stacks over Cross-Stack References or StackSets?
important
Single AWS account, need whole set to succeed or fail together as a unit., Lifecycle-Linked
Nested Stacks
What should you do if you want to share template components across multiple stacks?
Nested Stacks
Nested Stacks
If a template creates a VPC and it’s a child template in two Nested Sets, how many VPCs do you have?
Two. You’re sharing the template, not the resources it creates.
Cross-stack References
What are Cross-stack References?
Two independent Stacks, one has a dependency on a resource in the other
Cross-stack References
How do you use cross-stack references?
important
One uses Export
in Outputs
section, other uses Fn::ImportValue
(not “!Ref”!)
Cross-stack References
What are the constraints on names in Exports
section?
important
They have to be unique in the region in your AWS account
Cross-stack References
How do you !ImportValue
from an Export in a different AWS account?
Can’t. This is only within one AWS account
Cross-stack References
When should you use Cross-Stack References over Nested Stacks or StackSets?
Single AWS account, want to deploy sub-stacks independently.
Cross-stack References
Typical enterprise architecture that would work well with cross-stack references?
important
Services-oriented (SOA) where tons of apps need to reference each other
Cross-stack References
If a template creates a VPC and another template references it via !ImportValue
, how many VPCs do you have?
One
Stack Sets
What are StackSets?
Deploy stacks across accounts and regions
Stack Sets
What is an “admin account” for a StackSet?
Just the AWS account coordinating the work. Nothing administrative or elevated privs about it
Stack Sets
What and where is an actual StackSet? Where does it live and what is it?
The account that admins the StackSet has a StackSet—just a container for Stack Instances
Stack Sets
Do StackSets live anywhere other than a StackSet admin account?
No. Actual StackSet is just a notional container, no resources in it
Stack Sets
What is a Stack Instance?
Place in a Target account that references a real CFN Stack in that account
Stack Sets
Why have both Stack Instances and stacks?
Instances outlive actual CFN stacks; hold status. Instances are shadows of real stacks, pointers
Stack Sets
What are in the non-admin accounts?
Target accounts. They get real CF Stacks.
Stack Sets
How do you control the security across all these accounts?!
Do it manually yourself or use AWS Organizations
Stack Sets
How do you manually set up the security for StackSets?
important
Called “self-managed”. You create lots of cross-account roles and permissions
Stack Sets
How does Organizations handle security?
important
Called “service-managed”, Orgs establishes all the roles for you
Stack Sets
How do you control the rate that things happen with StackSets?
“Concurent Accounts” setting: sets number of accts deployed at same time
Stack Sets
What happens if you remove a stack from a Stack Set?
Depends on what you set for “Retain Stacks”: can leave them alone or delete them
Stack Sets
So…what happens if a Stack fails in a StackSet?
Depends. What’s the Failure Tolerance? :-)
Stack Sets
When should you use StackSets?
Need cross-account or cross-region references.