Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using generic terms like 'StackName' instead of the actual stack name.
Confusing stack ID with stack name.
✗ Incorrect
You need to specify the exact stack name to detect drift on that stack.
2fill in blank
mediumComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the stack name instead of the drift detection ID.
Confusing drift detection ID with stack ID.
✗ Incorrect
The command requires the drift detection ID returned when drift detection started.
3fill in blank
hardFix 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'
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.
✗ Incorrect
Use 'describe-stack-resource-drifts' and filter on the 'ResourceDriftStatus' property where the value is 'MODIFIED'.
4fill in blank
hardFill 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'
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.
✗ Incorrect
You start drift detection on 'MyAppStack' and then wait using the returned 'detectionId'.
5fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using different stack names in different commands.
Using incorrect variable names for detection ID.
✗ Incorrect
The script uses 'MyProdStack' as the stack name, stores the detection ID in 'detection_id', and uses the same stack name to list modified resources.