0
0
AWScloud~10 mins

Creating stacks in AWS - Visual Walkthrough

Choose your learning style9 modes available
Process Flow - Creating stacks
Write template file
Use AWS CLI or Console
Create stack command
AWS CloudFormation validates template
If valid
Stack creation starts
Resources are provisioned
Stack status updates
Stack creation complete
You write a template, then use AWS tools to create a stack. AWS checks the template, provisions resources, and updates the stack status until done.
Execution Sample
AWS
aws cloudformation create-stack --stack-name MyStack --template-body file://template.yaml
This command creates a stack named MyStack using the template.yaml file.
Process Table
StepActionInputAWS ResponseStack Status
1Run create-stack commandStackName=MyStack, Template=template.yamlTemplate validatedCREATE_IN_PROGRESS
2Provision resourcesResources from templateResources being createdCREATE_IN_PROGRESS
3Wait for resourcesN/AResources created successfullyCREATE_COMPLETE
💡 Stack creation completes successfully when all resources are provisioned.
Status Tracker
VariableStartAfter Step 1After Step 2Final
StackNameNoneMyStackMyStackMyStack
TemplateNonetemplate.yaml loadedtemplate.yaml loadedtemplate.yaml loaded
StackStatusNoneCREATE_IN_PROGRESSCREATE_IN_PROGRESSCREATE_COMPLETE
Key Moments - 2 Insights
Why does the stack status show CREATE_IN_PROGRESS after running the create command?
Because AWS starts provisioning resources after validating the template, the stack status updates to CREATE_IN_PROGRESS as shown in execution_table step 1 and 2.
What happens if the template file has errors?
AWS CloudFormation will reject the create-stack command during validation, so the stack will not be created and status will not move to CREATE_IN_PROGRESS.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the stack status immediately after the create-stack command is run?
ACREATE_COMPLETE
BCREATE_IN_PROGRESS
CDELETE_IN_PROGRESS
DROLLBACK_IN_PROGRESS
💡 Hint
Check the Stack Status column in execution_table row 1.
At which step are the resources actually provisioned?
AStep 1
BStep 3
CStep 2
DAfter Step 3
💡 Hint
Look at the Action and AWS Response columns in execution_table.
If the template file is missing, what will happen to the stack status?
AIt will stay None and no stack is created
BIt will become CREATE_COMPLETE
CIt will show DELETE_IN_PROGRESS
DIt will show ROLLBACK_COMPLETE
💡 Hint
Refer to key_moments about template validation failure.
Concept Snapshot
Creating stacks in AWS CloudFormation:
- Write a template file describing resources
- Run 'aws cloudformation create-stack' with stack name and template
- AWS validates the template
- If valid, stack status becomes CREATE_IN_PROGRESS
- AWS provisions resources
- When done, stack status becomes CREATE_COMPLETE
Full Transcript
To create a stack in AWS, you first write a template file that describes the resources you want. Then you run the AWS CLI command to create the stack, providing the stack name and template file. AWS CloudFormation checks the template for errors. If the template is valid, AWS starts creating the resources and the stack status changes to CREATE_IN_PROGRESS. Once all resources are created successfully, the stack status updates to CREATE_COMPLETE. If the template has errors, the stack creation does not start and no stack is created.