AWS DevOps DevOps Configuration Management & Infrastructure as Code 2 — Questions and Answers
Question 1: A team uses AWS CloudFormation and wants to prevent accidental deletion of a production database stack. Which CloudFormation feature should they enable?
- Stack termination protection (Correct answer)
- DeletionPolicy: Retain on the stack
- Stack drift detection
- AWS Config rules
Correct answer: Stack termination protection
Stack termination protection prevents a CloudFormation stack from being deleted until the protection is explicitly disabled.
Question 2: When using AWS CDK, what command synthesizes the CloudFormation template from your CDK app without deploying it?
- cdk deploy
- cdk synth (Correct answer)
- cdk diff
- cdk bootstrap
Correct answer: cdk synth
`cdk synth` generates and prints the CloudFormation template without making any AWS API calls to deploy resources.
Question 3: A CloudFormation stack update fails and rolls back. Which resource status indicates the resource was successfully rolled back to its previous state?
- UPDATE_FAILED
- ROLLBACK_COMPLETE
- UPDATE_ROLLBACK_COMPLETE (Correct answer)
- ROLLBACK_IN_PROGRESS
Correct answer: UPDATE_ROLLBACK_COMPLETE
UPDATE_ROLLBACK_COMPLETE means the stack failed to update and was successfully rolled back to its prior configuration.
Question 4: Which AWS Systems Manager capability allows you to define and enforce configuration baselines across EC2 instances at scale?
- Session Manager
- State Manager (Correct answer)
- Parameter Store
- Run Command
Correct answer: State Manager
State Manager automates the process of keeping EC2 instances in a defined and consistent state by applying configuration documents on a schedule.
Question 5: In Terraform, which command shows what infrastructure changes will be made before actually applying them?
- terraform apply -auto-approve
- terraform validate
- terraform plan (Correct answer)
- terraform refresh
Correct answer: terraform plan
`terraform plan` creates an execution plan showing which actions Terraform will take without making any actual changes.
Question 6: A CloudFormation template includes a resource with `DeletionPolicy: Snapshot`. What happens to an RDS instance with this policy when the stack is deleted?
- The RDS instance is deleted immediately with no backup
- A final DB snapshot is created before the instance is deleted (Correct answer)
- The RDS instance is retained without deletion
- The deletion fails with an error
Correct answer: A final DB snapshot is created before the instance is deleted
DeletionPolicy: Snapshot causes CloudFormation to create a snapshot of the resource before deleting it when the stack is removed.
Question 7: Which AWS service provides a managed Git repository integrated with CodePipeline and supports branch-level access controls using IAM policies?
- AWS CodeCommit (Correct answer)
- AWS CodeArtifact
- Amazon S3 versioning
- AWS CodeDeploy
Correct answer: AWS CodeCommit
AWS CodeCommit is a fully managed Git-based source control service that integrates natively with other AWS Developer Tools and supports IAM-based access control.
A team uses AWS CloudFormation and wants to prevent accidental deletion of a production database stack.
Which CloudFormation feature should they enable?