0
0
AWScloud~10 mins

Stack drift detection in AWS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to start drift detection on a CloudFormation stack.

AWS
aws cloudformation detect-stack-drift --stack-name [1]
Drag options to blanks, or click blank then click option'
AStackName
BMyStack
CStackId
DDriftStack
Attempts:
3 left
💡 Hint
Common Mistakes
Using generic terms like 'StackName' instead of the actual stack name.
Confusing stack ID with stack name.
2fill in blank
medium

Complete the command to check the drift detection status for a stack.

AWS
aws cloudformation describe-stack-drift-detection-status --stack-drift-detection-id [1]
Drag options to blanks, or click blank then click option'
AdetectionId
BstackName
CdriftId
DstackId
Attempts:
3 left
💡 Hint
Common Mistakes
Using the stack name instead of the drift detection ID.
Confusing drift detection ID with stack ID.
3fill in blank
hard

Fix the error in the command to list all resources with drift information for a stack.

AWS
aws cloudformation [1] --stack-name MyStack --query 'StackResourceDrifts[?[2]==`MODIFIED`]'
Drag options to blanks, or click blank then click option'
Adescribe-stack-resource-drifts
BResourceDriftStatus
CStackResourceStatus
DResourceStatus
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'list-stack-resources' instead of 'describe-stack-resource-drifts'.
Using incorrect property names like 'DriftStatus' or 'ResourceStatus'.
Not quoting the filter value correctly.
4fill in blank
hard

Fill both blanks to create a command that detects drift and waits until detection completes.

AWS
aws cloudformation detect-stack-drift --stack-name [1] && aws cloudformation wait stack-drift-detection-complete --stack-drift-detection-id [2]
Drag options to blanks, or click blank then click option'
AMyAppStack
BdetectionId
CstackId
DStackName
Attempts:
3 left
💡 Hint
Common Mistakes
Using stack ID instead of detection ID in the wait command.
Using generic names instead of actual stack name.
5fill in blank
hard

Fill all three blanks to create a script snippet that detects drift, waits for completion, and then lists modified resources.

AWS
detection_id=$(aws cloudformation detect-stack-drift --stack-name [1] --query 'StackDriftDetectionId' --output text)
aws cloudformation wait stack-drift-detection-complete --stack-drift-detection-id [2]
aws cloudformation describe-stack-resource-drifts --stack-name [3] --query 'StackResourceDrifts[?ResourceDriftStatus==`MODIFIED`]'
Drag options to blanks, or click blank then click option'
AMyProdStack
Bdetection_id
DStackDriftId
Attempts:
3 left
💡 Hint
Common Mistakes
Using different stack names in different commands.
Using incorrect variable names for detection ID.