Domain 2 - Configuration Management and IaC: Complete Study Guide
200
Practice Questions
17%
Exam Weight
11
Key Services
📖 How to Use This Study Guide
Read each question carefully
Try to answer before revealing the solution
Click "Show Answer & Explanation" to see detailed explanations
All answers are hidden by default to test your knowledge
Review the explanations to understand the reasoning behind each answer
Domain 2 Overview
Domain 2 accounts for 17% of the exam (approximately 13-14 questions out of 75). This domain focuses on how to implement and manage infrastructure as code, configuration management, and automation of resource provisioning.
---
Syllabus Breakdown
Task Statement 2.1: Define cloud infrastructure and reusable components to provision and manage systems throughout their lifecycle
Infrastructure as Code (IaC) best practices
Resource provisioning and orchestration
Reusable templates and modules
Lifecycle management of resources
Task Statement 2.2: Deploy automation to create, onboard, and secure AWS accounts in a multi-account/multi-region environment
AWS Organizations and account management
Service Control Policies (SCPs)
AWS Control Tower
Cross-account and cross-region deployments
Task Statement 2.3: Design and build automated solutions for complex tasks and large-scale environments
Automated provisioning patterns
Configuration drift detection and remediation
State management
Scaling automation solutions
---
Key Services to Master
1. AWS CloudFormation
What it is: AWS's native Infrastructure as Code service that allows you to model and provision AWS resources using templates.
Key Concepts to Memorize:
Concept
Description
Stacks
A collection of AWS resources managed as a single unit
StackSets
Extends stack functionality across multiple accounts and regions
Nested Stacks
Stacks created as part of other stacks for modularity
Change Sets
Preview changes before executing them
Drift Detection
Identifies configuration changes made outside CloudFormation
Stack Policies
Protect critical stack resources from unintentional updates
Intrinsic Functions
Built-in functions like !Ref, !GetAtt, !Sub, !Join, !If
Custom Resources
Extend CloudFormation with Lambda-backed custom logic
cfn-init
Helper script for configuring EC2 instances
cfn-signal
Signals CloudFormation when resources are ready
CreationPolicy
Wait for signals before marking resource creation complete
UpdatePolicy
Controls how updates are handled (especially for ASG)
DeletionPolicy
Retain, Snapshot, or Delete resources when stack is deleted
Resource Import
Bring existing resources into CloudFormation management
Dynamic References
Reference SSM Parameter Store and Secrets Manager values
Template Sections:
AWSTemplateFormatVersion
Description
Metadata
Parameters
Mappings
Conditions
Transform
Resources (only required section)
Outputs
---
2. AWS Systems Manager (SSM)
What it is: A unified interface to view operational data and automate tasks across AWS resources.
Key Components:
Component
Purpose
Parameter Store
Centralized storage for configuration data and secrets
State Manager
Define and maintain consistent configuration
Automation
Simplify maintenance and deployment tasks
Run Command
Remotely execute commands on managed instances
Patch Manager
Automate patching of managed instances
Session Manager
Secure shell access without opening inbound ports
Inventory
Collect metadata about instances and software
OpsCenter
Centralized location to view and resolve operational issues
Maintenance Windows
Schedule maintenance tasks
Distributor
Package and distribute software
AppConfig
Deploy application configuration safely
Parameter Store Details:
Standard parameters: Free, up to 10,000 parameters, 4KB max size
Advanced parameters: Paid, up to 100,000 parameters, 8KB max size, parameter policies
SecureString: Encrypted with KMS
Parameter policies: TTL, expiration notifications
SSM Documents:
Command documents (Run Command)
Automation documents (Automation runbooks)
Policy documents (State Manager)
Session documents (Session Manager)
---
3. AWS Config
What it is: Service that tracks AWS resource configurations and evaluates them against desired configurations.
Key Concepts:
Concept
Description
Configuration Items
Point-in-time view of resource attributes
Configuration Recorder
Records configuration changes
Config Rules
Evaluate resource configurations for compliance
Managed Rules
Pre-built rules by AWS
Custom Rules
Lambda-based custom evaluation logic
Conformance Packs
Collection of Config rules and remediation actions
Aggregator
Multi-account, multi-region data aggregation
Remediation Actions
Automatic remediation using SSM Automation
Organization Rules
Deploy rules across AWS Organization
Evaluation Triggers:
Configuration changes (reactive)
Periodic (proactive)
---
4. AWS Secrets Manager
What it is: Service to manage, retrieve, and rotate secrets throughout their lifecycle.
Key Features:
Automatic rotation for RDS, Redshift, DocumentDB
Custom rotation using Lambda
Cross-account access via resource policies
Versioning (AWSCURRENT, AWSPREVIOUS, AWSPENDING)
Integration with CloudFormation dynamic references
Comparison with Parameter Store:
Feature
Secrets Manager
Parameter Store (Advanced)
Automatic Rotation
Yes (built-in)
No (manual with Lambda)
Cost
$0.40/secret/month
$0.05/advanced param/month
Cross-account
Native support
Limited
Max Size
64KB
8KB
---
5. AWS Service Catalog
What it is: Allows organizations to create and manage catalogs of approved IT services.
Key Concepts:
Portfolios: Collections of products
Products: CloudFormation templates as self-service offerings
Constraints: Launch, Template, and Notification constraints
Launch Constraints: IAM role to use when launching products
TagOptions: Define tags that users must apply
Provisioned Products: Deployed instances of products
---
6. AWS Control Tower
What it is: Service to set up and govern a secure, multi-account AWS environment.
Key Concepts:
What it is: Framework to define cloud infrastructure using familiar programming languages.
Key Concepts:
Constructs: Basic building blocks (L1, L2, L3)
L1: Direct CloudFormation mapping
L2: Intent-based with sensible defaults
L3: Patterns/solutions (multiple resources)
Stacks: Unit of deployment
Apps: Container for stacks
cdk synth: Generate CloudFormation template
cdk deploy: Deploy stack
cdk diff: Compare deployed stack with current state
---
10. AWS CloudFormation Registry
What it is: Allows you to register and use third-party resource types and modules.
Components:
Resource Types: Public or private, extend CloudFormation
Modules: Reusable, encapsulated templates
Hooks: Custom logic during stack operations
---
11. Additional Services
Amazon EC2 Image Builder:
Automate creation of secure, compliant AMIs
Image pipelines, recipes, components
Integration with SSM for patching
AWS Launch Wizard:
Guided deployment of enterprise applications
SQL Server, SAP, Active Directory
AWS Proton:
Automated infrastructure provisioning for containers and serverless
Environment templates and service templates
---
Key Concepts to Understand
Infrastructure as Code Best Practices
Version Control: Store templates in Git
Modularization: Use nested stacks, modules, or constructs
Parameterization: Make templates reusable
Testing: Validate templates before deployment
Least Privilege: Minimal permissions for deployment
Immutable Infrastructure: Replace rather than update
Idempotency: Same input produces same output
Configuration Drift
Detection using CloudFormation Drift Detection
Remediation using AWS Config remediation actions
Prevention using SCPs and IAM policies
Cross-Account/Cross-Region Strategies
CloudFormation StackSets for multi-account/multi-region
AWS RAM (Resource Access Manager) for resource sharing
Cross-account IAM roles for access
S3 bucket policies for artifact sharing
State Management
CloudFormation manages state automatically
Terraform uses state files (S3 + DynamoDB for locking)
Understanding rollback behaviors
---
Exam Tips for Domain 2
CloudFormation is central - Know intrinsic functions, helper scripts, and deployment strategies
Systems Manager breadth - Understand all SSM capabilities, especially Parameter Store vs Secrets Manager
Config + Remediation - AWS Config for compliance, SSM Automation for remediation
Multi-account patterns - StackSets, Organizations, Control Tower work together
Know the differences - OpsWorks vs CloudFormation vs CDK use cases
Security integration - How IaC integrates with KMS, IAM, Secrets Manager
---
📝 Practice Questions
Question 1
A company is deploying a multi-tier application using AWS CloudFormation. The application requires an Amazon RDS database that must not be deleted even if the CloudFormation stack is deleted. How should a DevOps engineer configure this requirement?
A. Add a Stack Policy that denies delete actions on the RDS resource
B. Set the DeletionPolicy attribute to Retain on the RDS resource in the template
C. Enable termination protection on the RDS instance after stack creation
D. Use a separate stack for the RDS instance with Stack dependencies
Answer: B
Explanation:
The DeletionPolicy attribute in CloudFormation specifies what happens to a resource when the stack is deleted. Setting DeletionPolicy to "Retain" preserves the resource and its data when the stack is deleted.
Why A is incorrect: Stack Policies protect resources during stack updates, not stack deletions. They prevent accidental modifications during updates but do not prevent deletion when the entire stack is deleted.
Why B is correct: DeletionPolicy with value "Retain" explicitly tells CloudFormation to keep the resource when the stack is deleted. The resource becomes orphaned (no longer managed by CloudFormation) but continues to exist.
Why C is incorrect: RDS termination protection prevents direct deletion through the RDS console or API, but CloudFormation can override this during stack deletion unless DeletionPolicy is set appropriately.
Why D is incorrect: Using a separate stack adds operational complexity and doesn't inherently prevent resource deletion. The separate stack could still be deleted accidentally.
Question 2
A DevOps engineer needs to deploy the same CloudFormation stack to 50 AWS accounts across 4 regions. The deployment must happen in a controlled manner with the ability to specify the order of deployment. Which approach should the engineer use?
A. Create a CodePipeline with 50 deployment stages, one for each account
B. Use CloudFormation StackSets with deployment targets and operation preferences
C. Write a Lambda function that loops through accounts and creates stacks using the CloudFormation API
D. Use AWS Service Catalog to provision the stack in each account
Answer: B
Explanation:
CloudFormation StackSets is specifically designed for deploying stacks across multiple accounts and regions with controlled deployment options.
Why A is incorrect: Creating 50 deployment stages in CodePipeline is not scalable, creates maintenance overhead, and doesn't provide the built-in multi-account/multi-region features that StackSets provides.
Why B is correct: StackSets allows you to deploy to multiple accounts and regions from a single template. Operation preferences allow you to control the number of concurrent deployments, failure tolerance, and region order. You can specify deployment targets using AWS Organizations OUs or individual account IDs.
Why C is incorrect: While technically possible, this approach requires custom development, error handling, state tracking, and doesn't provide the built-in rollback, monitoring, and concurrency controls that StackSets offers.
Why D is incorrect: Service Catalog is designed for self-service provisioning by end users, not for centralized mass deployment across accounts. It doesn't provide the deployment orchestration features needed.
Question 3
A company stores database credentials in AWS Secrets Manager. The credentials are used by an application running on Amazon EC2 instances. The security team requires that credentials be automatically rotated every 30 days. The database is Amazon RDS for MySQL. What is the MOST operationally efficient solution?
A. Create a Lambda function that rotates the credentials and schedule it with EventBridge every 30 days
B. Enable automatic rotation in Secrets Manager and select the built-in MySQL rotation function
C. Use AWS Systems Manager Parameter Store with a parameter policy for automatic expiration
D. Store credentials in AWS Systems Manager Parameter Store SecureString and use a maintenance window for rotation
Answer: B
Explanation:
AWS Secrets Manager provides built-in automatic rotation for supported databases including RDS MySQL, eliminating the need for custom development.
Why A is incorrect: While this would work, it requires custom development and maintenance of the Lambda function. Secrets Manager already provides this functionality out-of-the-box for RDS databases.
Why B is correct: Secrets Manager has native integration with RDS MySQL and provides pre-built rotation Lambda functions. You simply enable rotation, select the rotation schedule (30 days), and Secrets Manager handles everything including updating the database password and the secret value atomically.
Why C is incorrect: Parameter Store doesn't provide automatic credential rotation. Parameter policies can send notifications before expiration but cannot automatically rotate credentials.
Why D is incorrect: Parameter Store doesn't have built-in rotation capabilities. You would need to create custom automation, making it less operationally efficient than using Secrets Manager.
Question 4
A DevOps engineer is creating a CloudFormation template that includes an Amazon EC2 instance. The instance must have specific software installed and configured before the stack creation is marked as complete. Which combination of CloudFormation features should be used? (Select TWO)
A. UserData with cfn-signal
B. CreationPolicy attribute
C. UpdatePolicy attribute
D. DependsOn attribute
E. Stack Policy
Answer: A and B
Explanation:
To ensure CloudFormation waits for instance configuration to complete, you need cfn-signal to send a success signal and CreationPolicy to tell CloudFormation to wait for that signal.
Why A is correct: cfn-signal is a CloudFormation helper script that sends a signal back to CloudFormation indicating whether the resource configuration succeeded or failed. It's typically called at the end of UserData or cfn-init scripts.
Why B is correct: CreationPolicy tells CloudFormation to wait for a specified number of success signals before marking the resource creation as complete. Without CreationPolicy, CloudFormation considers the EC2 instance created as soon as it launches, not after configuration completes.
Why C is incorrect: UpdatePolicy controls how resources are updated (e.g., rolling updates for Auto Scaling groups), not initial creation behavior.
Why D is incorrect: DependsOn controls the order of resource creation between different resources but doesn't make CloudFormation wait for configuration within a resource.
Why E is incorrect: Stack Policy protects resources from being modified during stack updates, it has no role in initial resource configuration.
Question 5
A company uses AWS Config to monitor compliance of their AWS resources. They need to ensure that all S3 buckets have server-side encryption enabled. If a bucket is found without encryption, it should be automatically remediated. How should this be implemented?
A. Create a custom AWS Config rule with a Lambda function that enables encryption
B. Use the AWS managed Config rule s3-bucket-server-side-encryption-enabled with an SSM Automation remediation action
C. Create an EventBridge rule to detect S3 bucket creation and trigger a Lambda function
D. Use AWS CloudTrail to monitor CreateBucket API calls and trigger Step Functions for remediation
Answer: B
Explanation:
AWS Config provides managed rules and built-in remediation actions using SSM Automation documents for automatic compliance remediation.
Why A is incorrect: Custom Config rules are for evaluation logic, not remediation. The Lambda in a custom rule determines compliance status but doesn't fix issues. You would still need separate remediation configuration.
Why B is correct: AWS provides the managed rule "s3-bucket-server-side-encryption-enabled" which evaluates S3 bucket encryption. AWS Config remediation actions can trigger SSM Automation documents (like AWS-EnableS3BucketEncryption) to automatically enable encryption on non-compliant buckets.
Why C is incorrect: This approach only handles new bucket creation, not existing buckets. It also doesn't provide compliance tracking, reporting, or the continuous evaluation that AWS Config offers.
Why D is incorrect: This is overly complex and doesn't provide compliance reporting. AWS Config is the purpose-built service for this use case.
Question 6
A DevOps engineer needs to reference the latest version of an AMI ID in a CloudFormation template without hardcoding the value. The AMI ID should be fetched from AWS Systems Manager Parameter Store where it is stored as a public parameter by AWS. Which CloudFormation syntax should be used?
A. !Ref AWS::SSM::Parameter::Value
B. {{resolve:ssm:/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2}}
C. !GetAtt SSMParameter.Value
D. !Sub '${/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2}'
Answer: B
Explanation:
CloudFormation dynamic references allow you to specify external values stored in SSM Parameter Store or Secrets Manager directly in your template.
Why A is incorrect: This syntax is for parameter types, not for referencing values within resources. AWS::SSM::Parameter::Value is used in the Parameters section to validate parameter values.
Why B is correct: The {{resolve:ssm:parameter-name}} syntax is CloudFormation's dynamic reference feature. It fetches the value from Parameter Store at stack creation/update time. AWS provides public parameters like /aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2 that always contain the latest AMI ID.
Why C is incorrect: GetAtt is used to get attributes from resources created within the template, not from external services like Parameter Store.
Why D is incorrect: Sub is for string substitution with references to parameters and resources within the template, it doesn't fetch values from Parameter Store.
Question 7
A company is implementing a multi-account strategy using AWS Organizations. They need to ensure that no one in any member account can disable CloudTrail logging. Which approach should be used?
A. Create an IAM policy in each account that denies CloudTrail StopLogging action
B. Create a Service Control Policy (SCP) attached to the root that denies CloudTrail StopLogging action
C. Enable CloudTrail organization trail with a resource policy
D. Use AWS Config rules to detect and revert CloudTrail changes
Answer: B
Explanation:
Service Control Policies (SCPs) are the mechanism for setting permission guardrails across all accounts in an AWS Organization.
Why A is incorrect: IAM policies in member accounts can be modified by account administrators. There's no guarantee the policy won't be removed or modified to allow the action.
Why B is correct: SCPs set maximum available permissions for member accounts. When you attach an SCP to the organization root (or OUs) that denies cloudtrail:StopLogging, no one in any affected account can perform this action, regardless of their IAM permissions. SCPs cannot be modified from member accounts.
Why C is incorrect: Organization trails provide centralized logging but don't prevent users from stopping trails in individual accounts. Resource policies on the S3 bucket protect log integrity but don't prevent trail disabling.
Why D is incorrect: AWS Config is reactive (detective) rather than preventive. By the time Config detects the change, logging would already be disabled. SCPs prevent the action from occurring at all.
Question 8
A DevOps engineer is using AWS CloudFormation to deploy an Auto Scaling group. During stack updates, the engineer wants to ensure that the rolling update maintains at least 2 instances running and updates no more than 1 instance at a time. Which CloudFormation configuration achieves this?
A. DeletionPolicy with MinSuccessfulInstancesPercent
B. UpdatePolicy with AutoScalingRollingUpdate settings
C. CreationPolicy with MinSuccessfulInstancesPercent
D. Metadata with AWS::CloudFormation::Init
Answer: B
Explanation:
UpdatePolicy with AutoScalingRollingUpdate controls how CloudFormation handles updates to Auto Scaling groups.
Why A is incorrect: DeletionPolicy controls what happens when resources are deleted from the stack, not how updates are performed.
Why B is correct: UpdatePolicy with AutoScalingRollingUpdate allows you to specify:
MinInstancesInService: Minimum instances that must be in service during update (set to 2)
MaxBatchSize: Maximum instances to update at once (set to 1)
PauseTime: How long to wait between batches
WaitOnResourceSignals: Whether to wait for cfn-signal
This provides precise control over rolling update behavior.
Why C is incorrect: CreationPolicy is used during initial resource creation to wait for success signals, not during updates.
Why D is incorrect: Metadata with cfn-init defines what configuration to apply to instances, but doesn't control the update process itself.
Question 9
A company needs to deploy the same infrastructure to development, staging, and production environments using CloudFormation. Each environment requires different instance types and different numbers of instances. What is the BEST approach to manage this with a single template?
A. Create three separate templates, one for each environment
B. Use CloudFormation Parameters with AllowedValues and Conditions
C. Use CloudFormation Mappings with environment-specific values and Conditions
D. Use nested stacks with different parameter files for each environment
Answer: C
Explanation:
Mappings provide a clean way to define environment-specific values within a single template, combined with Conditions for environment-specific resources.
Why A is incorrect: Maintaining three separate templates leads to configuration drift, increases maintenance burden, and makes it harder to ensure consistency across environments.
Why B is incorrect: While Parameters work, having users manually specify instance types and counts is error-prone. AllowedValues helps but still requires users to know the correct values for each environment.
Why C is correct: Mappings allow you to define a table of values (e.g., instance types, counts) keyed by environment name. You pass only the environment name as a parameter, and the template looks up the appropriate values using !FindInMap. This ensures consistency and reduces user input errors.
Why D is incorrect: Nested stacks are for modularization, not environment differentiation. Using separate parameter files adds complexity and still requires maintaining multiple files.
Question 10
A DevOps engineer needs to detect when an EC2 instance's configuration drifts from its original CloudFormation template specification. How can this be accomplished?
A. Enable CloudTrail and analyze API calls made to EC2
B. Use AWS Config rules to monitor EC2 configuration changes
C. Run CloudFormation drift detection on the stack
D. Compare EC2 describe-instances output with template values using Lambda
Answer: C
Explanation:
CloudFormation provides built-in drift detection to identify resources whose current configuration differs from the expected template configuration.
Why A is incorrect: CloudTrail logs API calls but doesn't compare current state to expected state. You would need additional processing to determine if changes constitute drift from the template.
Why B is incorrect: AWS Config tracks configuration changes over time but doesn't compare against CloudFormation template definitions. It tracks actual changes but doesn't know what the expected state should be according to CloudFormation.
Why C is correct: CloudFormation drift detection compares the current resource configuration with the expected configuration defined in the stack template. It reports:
IN_SYNC: Resource matches template
MODIFIED: Resource differs from template
DELETED: Resource was deleted outside CloudFormation
This is the purpose-built feature for this exact use case.
Why D is incorrect: While technically possible, this requires custom development, maintenance, and doesn't provide the comprehensive drift detection that CloudFormation offers natively.
Question 11
A company is using AWS OpsWorks Stacks to manage their application deployment. They need to ensure that if an instance fails, it is automatically replaced with a new instance with the same configuration. Which OpsWorks feature provides this capability?
A. Custom Chef recipes with health checks
B. Auto Scaling integration
C. Auto-healing
D. Lifecycle hooks
Answer: C
Explanation:
OpsWorks Stacks provides auto-healing functionality that automatically replaces failed instances.
Why A is incorrect: Custom Chef recipes can implement health checks, but the automatic replacement of instances is a built-in OpsWorks feature called auto-healing, not something you need to build with recipes.
Why B is incorrect: While OpsWorks can integrate with Auto Scaling for load-based scaling, the automatic replacement of a specific failed instance with the same configuration is handled by auto-healing, not Auto Scaling. Auto Scaling replaces capacity, not specific instances.
Why C is correct: Auto-healing is an OpsWorks Stacks feature that monitors instances using the OpsWorks agent. If an instance stops responding, OpsWorks stops it, terminates it, and launches a new instance with the same layer configuration. The new instance goes through the full lifecycle (setup, configure, deploy) automatically.
Why D is incorrect: Lifecycle hooks in OpsWorks refer to the lifecycle events (Setup, Configure, Deploy, Undeploy, Shutdown) that trigger recipes. They don't handle instance replacement.
Question 12
A DevOps engineer needs to create a CloudFormation template that creates an IAM role only if a parameter value is set to "true". Which CloudFormation features are required? (Select TWO)
A. Parameters section
B. Conditions section
C. Mappings section
D. Transform section
E. Metadata section
Answer: A and B
Explanation:
Conditional resource creation in CloudFormation requires a parameter to get input and a condition to evaluate that input.
Why A is correct: Parameters allow users to input values at stack creation time. In this case, a parameter would accept "true" or "false" to determine whether the IAM role should be created.
Why B is correct: Conditions define the logic for conditional resource creation. You would create a condition like:
Then apply this condition to the IAM role resource using the Condition attribute.
Why C is incorrect: Mappings provide static lookup tables and are not needed for simple true/false conditional creation.
Why D is incorrect: Transform is used for macros and SAM templates, not for conditional resource creation.
Why E is incorrect: Metadata provides additional information about resources but doesn't control conditional creation.
Question 13
A company wants to use AWS Systems Manager to run a script on 500 EC2 instances. The script must run on no more than 10% of instances at a time, and the operation should stop if more than 5% of instances fail. How should this be configured?
A. Create a State Manager association with rate control settings
B. Use Run Command with rate control and error threshold parameters
C. Create an Automation runbook with concurrency and failure thresholds
D. Use a Maintenance Window with rate limiting configuration
Answer: B
Explanation:
Run Command provides rate control options for managing command execution across many instances.
Why A is incorrect: State Manager is designed for maintaining configuration state (ensuring configurations remain applied), not for one-time script execution with specific concurrency controls.
Why B is correct: SSM Run Command supports rate control parameters:
max-concurrency: Can be set to "10%" to run on 10% of instances simultaneously
max-errors: Can be set to "5%" to stop execution if 5% of instances fail
This provides precise control over execution rate and error tolerance.
Why C is incorrect: While Automation runbooks support concurrency controls, they're designed for multi-step workflows and resource automation. For running a simple script on instances, Run Command is the appropriate tool.
Why D is incorrect: Maintenance Windows schedule when operations occur but the rate control for the actual execution would still use Run Command or Automation features. The question asks about controlling execution, not scheduling.
Question 14
A DevOps engineer is designing a solution to ensure that all AWS CloudFormation stacks across the organization are deployed using approved templates only. Which solution meets this requirement?
A. Use AWS Organizations SCPs to restrict CloudFormation actions
B. Implement AWS Service Catalog with portfolios containing approved products
C. Create IAM policies that allow only specific template URLs
D. Use AWS Config rules to detect non-compliant stacks
Answer: B
Explanation:
AWS Service Catalog is designed to provide self-service deployment of approved infrastructure while maintaining governance.
Why A is incorrect: SCPs can restrict who can use CloudFormation but cannot specify which templates are allowed. SCPs work at the API action level, not at the template content level.
Why B is correct: Service Catalog allows you to create portfolios of approved products (CloudFormation templates). Users can only launch products shared with them through portfolios. This ensures only approved templates are used while still enabling self-service. You can use launch constraints to specify the IAM role used for provisioning.
Why C is incorrect: While you could restrict which S3 buckets templates come from, this doesn't ensure the templates themselves are approved. Users with S3 access could modify templates in allowed buckets.
Why D is incorrect: AWS Config is detective, not preventive. It would detect non-compliant stacks after they're created, not prevent the use of unapproved templates.
Question 15
A company uses AWS CloudFormation to manage infrastructure. They need to reference a secret stored in AWS Secrets Manager within their template without exposing the secret value in the template. Which approach should be used?
A. Use the !GetAtt function to retrieve the secret value
B. Use dynamic reference with {{resolve:secretsmanager:secret-id:SecretString:key}}
C. Create a custom resource that retrieves the secret using Lambda
D. Store the secret in Systems Manager Parameter Store instead
Answer: B
Explanation:
CloudFormation dynamic references allow secure retrieval of secrets at runtime without exposing them in the template.
Why A is incorrect: GetAtt retrieves attributes from resources defined in the template. You cannot use GetAtt to retrieve values from Secrets Manager.
Why B is correct: Dynamic references using {{resolve:secretsmanager:...}} syntax retrieve secret values at stack creation/update time. The secret value is never written to the template or CloudFormation service logs. You can reference specific keys within a JSON secret using the syntax: {{resolve:secretsmanager:secret-id:SecretString:key-name}}
Why C is incorrect: While technically possible, this adds complexity, requires Lambda function maintenance, and the secret value would be passed through CloudFormation custom resource properties. Dynamic references are simpler and more secure.
Why D is incorrect: The question specifies the secret is in Secrets Manager. While Parameter Store SecureString could work, it doesn't provide the same features as Secrets Manager (like automatic rotation).
Question 16
A DevOps engineer needs to ensure that EC2 instances launched by CloudFormation have the latest patches applied before the stack creation completes. Which approach should be used?
A. Include patching commands in UserData and use cfn-signal with CreationPolicy
B. Create a separate maintenance window that runs after stack creation
C. Use a Launch Template with an AMI that includes all patches
D. Configure AWS Systems Manager Patch Manager with auto-patching enabled
Answer: A
Explanation:
To ensure patching completes before stack creation finishes, you need to include patching in the instance setup and signal completion.
Why A is correct: By including patch commands in UserData (or cfn-init) and calling cfn-signal after patching completes, the CreationPolicy ensures CloudFormation waits for the success signal. The stack creation only completes after patching is done:
Why B is incorrect: A separate maintenance window runs independently of stack creation. The stack would be marked as complete before patching occurs.
Why C is incorrect: Using a pre-patched AMI is a good practice, but it doesn't guarantee "latest patches" since new patches may be released after the AMI was created.
Why D is incorrect: Patch Manager runs on schedules or on-demand, not synchronized with stack creation. The stack would complete before Patch Manager runs.
Question 17
A company is using AWS Control Tower to manage their multi-account environment. A new security requirement mandates that all S3 buckets must be encrypted. Which type of Control Tower guardrail should be implemented?
A. Preventive guardrail implemented using AWS Config rules
B. Detective guardrail implemented using AWS Config rules
C. Preventive guardrail implemented using Service Control Policies
D. Detective guardrail implemented using Service Control Policies
Answer: B
Explanation:
Understanding the difference between preventive and detective guardrails and their implementation mechanisms is crucial.
Why A is incorrect: Preventive guardrails are NOT implemented using Config rules. Config rules are used for detective guardrails.
Why B is correct: Detective guardrails in Control Tower are implemented using AWS Config rules. For S3 bucket encryption, a detective guardrail would use a Config rule to detect buckets that don't have encryption enabled and report them as non-compliant. Note: To truly prevent unencrypted buckets, you would need a preventive guardrail (SCP), but SCPs cannot check for encryption settings - they can only allow/deny API actions.
Why C is incorrect: While preventive guardrails use SCPs, SCPs work at the API action level. You cannot create an SCP that says "allow CreateBucket only if encryption is enabled" - SCPs don't have that granularity.
Why D is incorrect: Detective guardrails do not use SCPs. SCPs are for preventive guardrails only.
Question 18
A DevOps engineer needs to import existing AWS resources into CloudFormation management without recreating them. Which feature should be used?
A. CloudFormation drift detection
B. CloudFormation change sets
C. CloudFormation resource import
D. CloudFormation stack adoption
Answer: C
Explanation:
CloudFormation resource import allows you to bring existing resources under CloudFormation management.
Why A is incorrect: Drift detection identifies differences between expected and actual resource configuration. It doesn't import unmanaged resources.
Why B is incorrect: Change sets preview changes to stacks before execution. They don't import unmanaged resources.
Why C is correct: Resource import allows you to add existing resources to new or existing CloudFormation stacks. You create a template that describes the resource, then use the import operation specifying the resource identifier. CloudFormation adopts the resource without modifying it. Supported for most resource types.
Why D is incorrect: "Stack adoption" is not a CloudFormation feature. Resource import is the correct term.
Question 19
A company uses AWS CDK to define their infrastructure. They want to review the CloudFormation template that will be generated before deployment. Which CDK command should be used?
A. cdk deploy --dry-run
B. cdk synth
C. cdk diff
D. cdk preview
Answer: B
Explanation:
CDK provides specific commands for different stages of the deployment workflow.
Why A is incorrect: CDK does not have a --dry-run flag for deploy. The deploy command actually deploys the stack.
Why B is correct:cdk synth (short for synthesize) generates the CloudFormation template from CDK code without deploying. It outputs the template to stdout or the cdk.out directory. This allows review of the exact CloudFormation resources that will be created.
Why C is incorrect:cdk diff compares the current CDK stack definition with the deployed stack and shows differences. While useful, it doesn't show the full generated template.
Why D is incorrect: CDK does not have a preview command. The commands are synth, deploy, diff, destroy, etc.
Question 20
A DevOps engineer needs to manage application configuration that changes frequently and must be deployed to applications without restarting them. Which AWS service is BEST suited for this requirement?
A. AWS Systems Manager Parameter Store
B. AWS AppConfig
C. AWS Secrets Manager
D. AWS CloudFormation
Answer: B
Explanation:
AWS AppConfig is specifically designed for deploying application configuration with validation and controlled rollouts.
Why A is incorrect: Parameter Store stores configuration values, but applications must poll for changes or be restarted to pick up new values. It doesn't provide deployment validation or gradual rollouts.
Why B is correct: AppConfig (part of Systems Manager) is designed for deploying application configuration with:
Validation before deployment
Gradual rollouts (percentages, time-based)
Automatic rollback on errors
No application restart required (applications poll or use agents)
Feature flags and operational configuration support
Why C is incorrect: Secrets Manager is for secrets (credentials, API keys), not general application configuration. It also requires polling or application restart for updates.
Why D is incorrect: CloudFormation is for infrastructure provisioning, not application configuration. Changing configuration would require stack updates.
Question 21
A company wants to ensure that all EC2 instances have a specific tag applied. If an instance is found without the tag, it should be automatically remediated. Which combination of AWS services should be used?
A. AWS Config rule with Systems Manager Automation remediation
B. Amazon EventBridge with Lambda remediation
C. AWS CloudTrail with Step Functions remediation
D. Amazon Inspector with Lambda remediation
Answer: A
Explanation:
AWS Config with SSM Automation is the standard pattern for compliance monitoring and automated remediation.
Why A is correct: AWS Config can evaluate resources for required tags using managed rules like required-tags. When a resource is non-compliant, Config can automatically trigger an SSM Automation document (like AWS-SetRequiredTags) to add the missing tags. This is a fully AWS-native, integrated solution.
Why B is incorrect: While EventBridge with Lambda could work, it would require custom development and wouldn't provide the compliance tracking and reporting that AWS Config offers.
Why C is incorrect: CloudTrail logs API calls but doesn't evaluate compliance. This approach would require custom development and doesn't provide compliance tracking.
Why D is incorrect: Amazon Inspector is for vulnerability assessment of applications and network configurations, not for tag compliance.
Question 22
A DevOps engineer is using CloudFormation StackSets to deploy to multiple accounts. Deployment to one account fails while others succeed. What happens by default?
A. The entire StackSet operation is rolled back across all accounts
B. Only the failed account's stack is rolled back; successful stacks remain
C. The StackSet operation pauses and waits for manual intervention
D. StackSets automatically retries the failed account deployment
Answer: B
Explanation:
StackSets treats each account/region combination as an independent stack instance.
Why A is incorrect: StackSets does not roll back successful deployments when one account fails. Each stack instance is independent.
Why B is correct: Each stack instance in a StackSet operates independently. If deployment to one account fails, that specific stack instance is rolled back (according to its rollback settings), but successful stack instances in other accounts remain deployed. This isolation prevents one account's issues from affecting others.
Why C is incorrect: StackSets doesn't pause for manual intervention by default. It continues with other accounts and marks the failed account as FAILED.
Why D is incorrect: StackSets doesn't automatically retry. The operation completes with some stacks successful and some failed. You can manually retry failed instances.
Question 23
A company needs to enforce a naming convention for all CloudFormation stacks created in their AWS account. What is the MOST effective way to implement this?
A. Create an IAM policy with a condition on the stack name
B. Use AWS Config rule to detect non-compliant stack names
C. Implement a CloudFormation Hook that validates stack names
D. Create an SCP that restricts stack creation based on naming pattern
Answer: C
Explanation:
CloudFormation Hooks provide preventive controls for stack operations.
Why A is incorrect: IAM policies support conditions on CloudFormation actions, but the aws:RequestTag conditions work with tags, not with resource names like stack names.
Why B is incorrect: AWS Config rules are detective (after creation), not preventive. The non-compliant stack would already exist.
Why C is correct: CloudFormation Hooks allow you to run custom validation logic before stack operations (create, update, delete). You can create a Hook that checks the stack name against a naming convention and fails the operation if it doesn't match. This is preventive control at the CloudFormation level.
Why D is incorrect: SCPs restrict API actions but cannot inspect request parameters like stack names. You cannot create an SCP that says "allow CreateStack only if stack name matches pattern."
Question 24
A DevOps engineer needs to store a configuration value that will be used by multiple CloudFormation stacks. The value should be managed centrally and stacks should automatically get the latest value during updates. Which approach should be used?
A. Store the value in an S3 bucket and use CloudFormation to read it
B. Use CloudFormation Exports and Imports
C. Store the value in Systems Manager Parameter Store and use dynamic references
D. Create a Lambda-backed custom resource to retrieve the value
Answer: C
Explanation:
SSM Parameter Store with dynamic references provides centralized configuration that's resolved at deployment time.
Why A is incorrect: CloudFormation cannot natively read arbitrary values from S3. You would need a custom resource, adding complexity.
Why B is incorrect: CloudFormation exports are created by stacks and depend on the stack lifecycle. Changing the exported value requires updating the exporting stack, and you can't update an exported value if other stacks reference it (import).
Why C is correct: Storing values in Parameter Store and using dynamic references {{resolve:ssm:parameter-name}} provides:
Central management of the value
Value resolved at each stack create/update
No dependency on other stacks
Easy to update without stack operations
Why D is incorrect: While possible, this adds complexity (Lambda function maintenance) that isn't necessary when Parameter Store dynamic references are available.
Question 25
An organization uses AWS Organizations and wants to prevent member accounts from leaving the organization. Which approach should be used?
A. Create an SCP that denies the organizations:LeaveOrganization action
B. Enable organization-wide MFA requirement
C. Remove IAM permissions for LeaveOrganization from all users
D. Enable AWS Organizations consolidated billing
Answer: A
Explanation:
SCPs can restrict the LeaveOrganization action at the organization level.
Why A is correct: You can attach an SCP to the organization root or specific OUs that denies the organizations:LeaveOrganization action. This prevents any user or role in member accounts from removing the account from the organization, regardless of their IAM permissions.
Why B is incorrect: MFA requirements (through SCPs) can enforce MFA for certain actions but don't prevent leaving the organization.
Why C is incorrect: You cannot reliably remove permissions from all users in all accounts, especially if new users are created or accounts have root user access.
Why D is incorrect: Consolidated billing is a billing feature and doesn't prevent accounts from leaving.
Question 26
A DevOps engineer is creating a CloudFormation template with a Lambda function. The function code exceeds 4096 characters and cannot be embedded inline. What is the correct approach?
A. Use the ZipFile property with compressed code
B. Use the S3Bucket and S3Key properties to reference code stored in S3
C. Split the code across multiple ZipFile properties
D. Use the Code property with a file path to local code
Answer: B
Explanation:
Lambda code that exceeds inline limits must be packaged and stored in S3.
Why A is incorrect: ZipFile property is for inline code, limited to 4096 characters of the code body. It doesn't support compressed code.
Why B is correct: When Lambda code is too large for inline embedding, you package it as a ZIP file, upload to S3, and reference it using S3Bucket and S3Key properties in the CloudFormation template:
This prevents users from launching instances with unapproved AMIs.
Why C is incorrect: EC2 Image Builder creates AMIs but doesn't enforce which AMIs can be used for launching instances.
Why D is incorrect: SCPs support conditions, but the ec2:ImageId condition key is not available in SCPs. SCPs have a more limited set of condition keys compared to IAM policies.
Question 28
A DevOps engineer is using AWS Systems Manager Patch Manager to patch a fleet of EC2 instances. The patching must occur during a specific time window on weekends. Which SSM feature should be used?
A. State Manager with a cron expression
B. Maintenance Windows with Patch Manager task
C. Run Command with scheduled execution
D. Automation with EventBridge scheduled rule
Answer: B
Explanation:
Maintenance Windows provide scheduled execution of Systems Manager operations including patching.
Why A is incorrect: State Manager is for maintaining consistent configuration (desired state), not for scheduling one-time or periodic maintenance tasks like patching.
Why B is correct: Maintenance Windows allow you to define a recurring schedule (e.g., every Saturday 2:00 AM) and register Patch Manager as a task. The patching occurs automatically during the defined window. You can specify:
Schedule (cron or rate expression)
Duration (how long the window is open)
Cutoff time (stop starting new tasks)
Tasks to run (Patch Manager, Run Command, etc.)
Why C is incorrect: Run Command doesn't have built-in scheduling. While you could trigger it with EventBridge, Maintenance Windows are the purpose-built feature for this.
Why D is incorrect: While this could work, Maintenance Windows are specifically designed for this use case and integrate directly with Patch Manager.
Question 29
A company is using CloudFormation nested stacks to organize their infrastructure. The parent stack needs to pass a value created by one child stack to another child stack. How should this be accomplished?
A. Use the GetAtt function to get the output from one child and pass it as parameter to another
B. Create exports in the child stack and imports in the other child stack
C. Store the value in Parameter Store and reference it in both child stacks
D. Use Mappings to share values between child stacks
Answer: A
Explanation:
Parent stacks can get outputs from child stacks and pass them as parameters to other child stacks.
Why A is correct: Child stacks can define Outputs. The parent stack uses !GetAtt ChildStackLogicalId.Outputs.OutputName to retrieve these values and passes them as parameters to other child stacks:
Why B is incorrect: While exports/imports work for cross-stack references, nested stacks should use the parent as an intermediary. Using exports between sibling nested stacks creates unnecessary dependencies and coupling.
Why C is incorrect: This adds external dependencies and complexity. The native CloudFormation approach using GetAtt is simpler and keeps all dependencies within the stack structure.
Why D is incorrect: Mappings contain static values defined at template authoring time. They cannot contain dynamically created values from other stacks.
Question 30
A DevOps engineer needs to validate CloudFormation templates before deployment to ensure they follow company standards. Which approach provides the MOST comprehensive validation?
A. Use the aws cloudformation validate-template CLI command
B. Use cfn-lint and cfn-guard in a CI/CD pipeline
C. Enable drift detection on existing stacks
D. Use CloudFormation change sets to preview changes
Answer: B
Explanation:
Comprehensive validation requires both syntax checking and policy compliance checking.
Why A is incorrect:validate-template only checks for valid JSON/YAML syntax and valid CloudFormation structure. It doesn't validate against company standards, best practices, or policy compliance.
Why B is correct:
cfn-lint: Validates CloudFormation templates for errors, warnings, and best practices. Catches issues like invalid property values, deprecated features, and syntax problems.
cfn-guard: Policy-as-code tool that validates templates against custom rules (e.g., "all S3 buckets must have encryption enabled"). Enforces company standards.
Together in CI/CD, they provide comprehensive pre-deployment validation.
Why C is incorrect: Drift detection identifies differences between deployed resources and templates, not pre-deployment validation of new templates.
Why D is incorrect: Change sets show what changes will be made, but don't validate against company standards. They're useful for review but not policy enforcement.
Question 31
A company is migrating from OpsWorks to CloudFormation. They need to replicate OpsWorks's ability to run different scripts during instance lifecycle events (setup, deploy, etc.). How can this be achieved with CloudFormation?
A. Use CloudFormation lifecycle hooks
B. Use cfn-init with different configsets
C. Use UpdatePolicy with lifecycle events
D. Use CloudWatch Events to trigger Lambda functions
Answer: B
Explanation:
cfn-init with configsets provides lifecycle-like configuration management in CloudFormation.
Why A is incorrect: CloudFormation doesn't have lifecycle hooks. (Auto Scaling has lifecycle hooks, but that's a different service.)
Why B is correct: cfn-init (AWS::CloudFormation::Init metadata) supports configsets that can organize configuration into logical groups. While not identical to OpsWorks lifecycle events, you can:
Create different configsets for different phases (install, configure, deploy)
Run different configsets at different times using cfn-init commands
Use UserData or SSM to run additional configsets after initial setup
Example: cfn-init --configsets setup,deploy
Why C is incorrect: UpdatePolicy controls how CloudFormation handles updates to resources like Auto Scaling groups, not instance lifecycle configuration.
Why D is incorrect: While you could trigger Lambda functions, this doesn't provide the integrated configuration management that cfn-init offers and adds complexity.
Question 32
A DevOps engineer is creating a CloudFormation template for a production environment. They want to ensure that critical resources like databases are not accidentally deleted during stack updates. Which TWO features should be used? (Select TWO)
A. DeletionPolicy: Retain
B. Stack Policy denying Update:Delete
C. UpdateReplacePolicy: Retain
D. Termination Protection
E. Stack Policy denying Update:*
Answer: B and C
Explanation:
Protecting resources during stack updates requires understanding both Stack Policies and UpdateReplacePolicy.
Why A is incorrect: DeletionPolicy applies when the entire stack is deleted, not during updates.
Why B is correct: Stack Policies can prevent specific update actions on resources. Denying "Update:Delete" prevents CloudFormation from deleting the resource during an update (for example, if you remove the resource from the template).
Why C is correct: UpdateReplacePolicy controls what happens when an update requires replacing a resource. Setting it to "Retain" keeps the old resource when CloudFormation creates a replacement. This prevents data loss during updates that require replacement.
Why D is incorrect: Termination Protection prevents stack deletion, not resource updates.
Why E is incorrect: Denying all updates (Update:*) prevents any changes to the resource, which may be too restrictive. You typically want to allow modifications while preventing deletion.
Question 33
A company wants to automatically create AWS accounts with specific configurations using AWS Control Tower. Which feature should be used?
A. AWS Organizations API
B. Control Tower Account Factory
C. AWS Service Catalog with account products
D. CloudFormation StackSets with account templates
Answer: B
Explanation:
Control Tower Account Factory is the purpose-built feature for automated account creation.
Why A is incorrect: AWS Organizations API can create accounts, but doesn't provide the baseline configurations, guardrails, and integrations that Control Tower offers.
Why B is correct: Account Factory in Control Tower automates account provisioning with:
Pre-configured baselines
Guardrails automatically applied
Network pre-configuration
Integration with Service Catalog for self-service
Consistent account setup across the organization
Why C is incorrect: While Service Catalog can provision infrastructure, it's not designed for account creation. Control Tower's Account Factory actually uses Service Catalog under the hood.
Why D is incorrect: StackSets deploy resources within accounts but don't create accounts themselves.
Question 34
A DevOps engineer needs to execute a script on an EC2 instance immediately after CloudFormation creates it, wait for the script to complete, and then create a dependent resource. Which CloudFormation feature combination should be used?
A. UserData, CreationPolicy, and DependsOn
B. cfn-init and Metadata only
C. WaitCondition and WaitConditionHandle
D. Custom Resource with Lambda
Answer: C
Explanation:
WaitConditions allow explicit waiting for external signals before proceeding with stack creation.
Why A is incorrect: CreationPolicy signals when a resource is ready, but DependsOn only controls creation order - it doesn't wait for signals. A resource with DependsOn would start creating after the dependency is "created" according to CloudFormation, not after the script completes.
Why B is incorrect: cfn-init executes configuration but doesn't provide a mechanism for dependent resources to wait for completion.
Why C is correct: WaitCondition and WaitConditionHandle work together:
The script uses the WaitConditionHandle URL to send a signal when complete
The WaitCondition waits for this signal
Dependent resources use DependsOn on the WaitCondition
This ensures subsequent resources only create after the script completes successfully.
Why D is incorrect: While custom resources could implement waiting, WaitConditions are the native CloudFormation feature for this specific use case.
Question 35
A company uses AWS Systems Manager to manage their EC2 fleet. They need to collect detailed software inventory from instances, including installed applications, Windows roles, and network configurations. Which SSM capability should be used?
A. SSM Run Command with custom scripts
B. SSM Inventory
C. SSM State Manager
D. SSM OpsCenter
Answer: B
Explanation:
SSM Inventory is specifically designed for collecting resource metadata and software information.
Why A is incorrect: While Run Command could execute scripts to collect this information, you would need to write and maintain custom scripts and storage logic. SSM Inventory provides this functionality out-of-the-box.
Why B is correct: SSM Inventory automatically collects metadata from managed instances including:
Applications (installed software)
AWS components
Network configurations
Windows updates and roles
Custom inventory (user-defined)
Data is stored in SSM and can be queried or exported to S3 for analysis.
Why C is incorrect: State Manager maintains desired state configurations, it doesn't collect inventory data.
Why D is incorrect: OpsCenter aggregates operational issues and remediation, it doesn't collect software inventory.
Question 36
A DevOps engineer is creating a CloudFormation template that must work across multiple AWS regions. The template creates an EC2 instance with a region-specific AMI. What is the BEST approach to make the template region-agnostic?
A. Use the AWS::EC2::AMI::Id parameter type and require users to input the AMI
B. Use Mappings to define AMI IDs for each region and reference with !FindInMap
C. Use a custom resource to query for the AMI at deployment time
D. Use SSM Parameter Store public parameters for AMI IDs with dynamic references
Answer: D
Explanation:
SSM public parameters provide the most maintainable approach for region-agnostic AMI references.
Why A is incorrect: Requiring users to input AMI IDs adds friction and potential for errors. It's not self-service friendly.
Why B is incorrect: While Mappings work, you must manually update the template whenever AMI IDs change (which happens frequently). This creates maintenance burden.
Why C is incorrect: Custom resources add complexity and require Lambda function maintenance.
Why D is correct: AWS provides public SSM parameters in each region that always contain the latest AMI IDs. For example:
This automatically resolves to the correct AMI ID in whatever region the stack is deployed, and always gets the latest version without template updates.
Question 37
A company needs to deploy a multi-tier application across three AWS accounts: development, staging, and production. The infrastructure code must be identical across accounts but with different parameters. Which approach should be used?
A. Create three separate templates with hardcoded values for each environment
B. Use CloudFormation StackSets with per-account parameter overrides
C. Store the template in a central S3 bucket and use cross-account access
D. Use AWS CodePipeline with manual approval for each environment
Answer: B
Explanation:
StackSets support parameter overrides at the account or region level for deployment customization.
Why A is incorrect: Maintaining separate templates leads to drift and inconsistency. Changes must be made in multiple places.
Why B is correct: StackSets allow you to:
Deploy the same template to multiple accounts
Specify different parameter values per account using parameter overrides
Maintain a single source of truth for infrastructure
Example: Use the same template but override InstanceType to be larger in production than development.
Why C is incorrect: While you can store templates in S3, this doesn't address the requirement for different parameters per account. You would still need a deployment mechanism.
Why D is incorrect: CodePipeline handles the deployment process, but the question asks about managing infrastructure with different parameters. StackSets is the infrastructure deployment mechanism that supports this.
Question 38
A DevOps engineer needs to ensure that configuration changes to production resources are reviewed before being applied. The current process uses CloudFormation. Which feature should be used?
A. CloudFormation drift detection
B. CloudFormation change sets
C. CloudFormation Stack Policies
D. CloudFormation rollback triggers
Answer: B
Explanation:
Change sets allow preview and approval of changes before execution.
Why A is incorrect: Drift detection shows differences between current state and expected state, not changes that are about to be made.
Why B is correct: Change sets allow you to:
Create a proposed change set from template/parameter updates
Review the changes CloudFormation will make (create, modify, delete, replace)
Execute or delete the change set
This enables review workflows before changes are applied to production.
Why C is incorrect: Stack Policies protect specific resources from being modified, but don't provide a review mechanism for all changes.
Why D is incorrect: Rollback triggers cause stack rollback if CloudWatch alarms trigger during update, but don't provide pre-change review.
Question 39
A company uses AWS Config to track configuration changes. They need to aggregate compliance data from 20 AWS accounts across 4 regions into a single dashboard. Which AWS Config feature should be used?
A. Config Rules with SNS notification aggregation
B. Config Aggregator
C. Config Conformance Packs with central S3 bucket
D. AWS Organizations Config integration
Answer: B
Explanation:
Config Aggregator is specifically designed for multi-account, multi-region data collection.
Why A is incorrect: SNS notifications would require custom aggregation logic to consolidate data. This approach is complex and doesn't provide a native dashboard.
Why B is correct: AWS Config Aggregator collects AWS Config configuration and compliance data from:
Multiple accounts and regions
An entire AWS Organization
Data appears in a single aggregated view in the aggregator account. You can then use the Config console or APIs to see cross-account compliance status.
Why C is incorrect: Conformance Packs deploy collections of rules but don't provide cross-account aggregation capabilities.
Why D is incorrect: While Config integrates with Organizations for deploying organization-wide rules, the aggregation feature is specifically called "Config Aggregator."
Question 40
A DevOps engineer is deploying an application using AWS CloudFormation. The application requires a custom domain name in Amazon Route 53. The hosted zone was created manually and should not be managed by CloudFormation. How should the template reference the existing hosted zone?
A. Create the hosted zone in the template with the same name
B. Use the AWS::Route53::HostedZone resource with a DeletionPolicy of Retain
C. Pass the hosted zone ID as a template parameter
D. Import the hosted zone using CloudFormation resource import
Answer: C
Explanation:
When using resources not managed by CloudFormation, pass identifiers as parameters.
Why A is incorrect: You cannot create a hosted zone with the same domain name as an existing one. This would fail.
Why B is incorrect: The resource doesn't exist in CloudFormation currently, so you can't set a DeletionPolicy on it. DeletionPolicy applies to resources defined in the template.
Why C is correct: The standard pattern for referencing resources not managed by the current stack is to pass their identifiers as parameters. The template would have:
Users provide the existing hosted zone ID when creating the stack.
Why D is incorrect: Resource import would bring the hosted zone under CloudFormation management, which the question states should not happen ("should not be managed by CloudFormation").
Question 41
A DevOps engineer needs to rotate database credentials stored in AWS Secrets Manager. The rotation should use a custom Lambda function because the database is not a supported type. Which rotation strategy should be used to minimize downtime?
Why A is incorrect: Single-user rotation updates the password for one database user. During rotation, there's a brief period where the old password is invalid and the application might fail if it hasn't retrieved the new password.
Why B is correct: Alternating users rotation (multi-user) maintains two database users. The rotation process:
Clone the current user to create an alternate user
Update the secret with the alternate user's credentials
On next rotation, update the original user
Applications can continue using the current credentials while the other set is being rotated, eliminating downtime.
Why C is incorrect: Cross-account rotation refers to the secret being in a different account than the Lambda, not a rotation strategy for minimizing downtime.
Why D is incorrect: "Time-based rotation" isn't a Secrets Manager rotation strategy type.
Question 42
A company is using CloudFormation to deploy infrastructure. They want to ensure that production stacks cannot be accidentally deleted. Which feature provides this protection?
Why A is incorrect: Stack Policies protect resources during stack updates, not stack deletion.
Why B is correct: Termination Protection is a stack-level setting that prevents the stack from being deleted. When enabled, delete stack operations fail. It must be explicitly disabled before the stack can be deleted, providing protection against accidental deletion.
Why C is incorrect: DeletionPolicy controls what happens to resources when the stack is deleted, but doesn't prevent the deletion operation itself.
Why D is incorrect: While IAM policies can deny DeleteStack, this would need to be applied to all users/roles, which is complex to manage. Termination Protection is a simpler, stack-specific solution.
Question 43
A DevOps engineer is using AWS CDK to define infrastructure. They need to create a reusable pattern that includes an Application Load Balancer, ECS service, and CloudWatch alarms configured together. Which CDK construct level is MOST appropriate?
Why A is incorrect: L1 constructs are direct mappings to CloudFormation resources. They're low-level and don't provide the abstraction for combining multiple resources.
Why B is incorrect: L2 constructs represent individual AWS resources with sensible defaults. They're great for single resources but don't combine multiple resources into patterns.
Why C is correct: L3 constructs (Patterns) are designed for exactly this use case. They're opinionated combinations of multiple resources that implement common architectural patterns. The ApplicationLoadBalancedFargateService pattern, for example, combines ALB, Fargate, and other resources in one construct.
Why D is incorrect: While you could create a custom construct, AWS CDK already provides L3 patterns for common architectures. Using built-in patterns reduces development effort.
Question 44
A company has multiple CloudFormation stacks that share common resources like VPCs and security groups. They want to refactor to avoid duplicating these resources. Which approach should be used?
A. Create nested stacks for shared resources
B. Use CloudFormation Exports and Imports for cross-stack references
C. Store resource IDs in Parameter Store and use dynamic references
D. Create a single large stack containing all resources
Answer: B
Explanation:
Cross-stack references using Exports and Imports allow sharing resources between independent stacks.
Why A is incorrect: Nested stacks are created as part of a parent stack. They don't allow sharing resources between independent stacks.
Why B is correct: The pattern for shared resources is:
Create a "shared infrastructure" stack that exports resource IDs/ARNs
Other stacks import these values using !ImportValue
This allows the VPC stack to be managed independently while other stacks reference its resources.
Why C is incorrect: While this works, it requires manual synchronization between resource creation and Parameter Store updates. Exports/Imports provide native CloudFormation integration with dependency tracking.
Why D is incorrect: A single large stack increases deployment time, blast radius of changes, and creates a management bottleneck. It doesn't solve the problem of resource sharing between different application stacks.
Question 45
A DevOps engineer is setting up AWS Config rules across an AWS Organization. They need to deploy the same rules to all accounts and automatically include new accounts. Which approach should be used?
A. Use AWS Config Aggregator to deploy rules
B. Deploy rules using CloudFormation StackSets with auto-deployment
C. Use AWS Config Organization Rules
D. Create rules manually in each account
Answer: C
Explanation:
AWS Config Organization Rules deploy and manage Config rules across an Organization.
Why A is incorrect: Config Aggregator collects compliance data but doesn't deploy rules. It's for visibility, not deployment.
Why B is incorrect: While StackSets could deploy Config rules, AWS provides the native Organization Rules feature for this purpose, which is simpler and automatically handles new accounts.
Why C is correct: AWS Config Organization Rules:
Deploy managed or custom rules across all accounts in the Organization
Automatically apply to new accounts when they're created
Managed from the management account or delegated administrator
Support all Config rule types
Why D is incorrect: Manual deployment is not scalable, error-prone, and doesn't automatically include new accounts.
Question 46
A DevOps engineer needs to create an AWS Systems Manager Automation runbook that can be executed across multiple accounts. Which feature enables this?
A. SSM Run Command with multi-account targets
B. SSM Automation with AWS Organizations integration
C. SSM State Manager with cross-account associations
D. SSM Maintenance Windows with multi-account registration
Answer: B
Explanation:
SSM Automation supports execution across AWS Organizations member accounts.
Why A is incorrect: Run Command targets instances directly. While it can target instances in other accounts if properly configured, it doesn't have native multi-account orchestration like Automation.
Why B is correct: SSM Automation runbooks can specify:
TargetLocations parameter with account IDs or organizational units
Execution across multiple accounts simultaneously
AWS Organizations integration for automatic account discovery
This enables centralized automation that runs in target accounts.
Why C is incorrect: State Manager associations are per-account. While you can create associations in multiple accounts using StackSets, there's no native cross-account association feature.
Why D is incorrect: Maintenance Windows are per-account resources.
Question 47
A company requires that all CloudFormation templates be stored in version control and reviewed before deployment. Templates should be automatically deployed when merged to the main branch. Which solution should be used?
A. AWS CodePipeline with CloudFormation deploy action
B. GitHub Actions with AWS CLI commands
C. AWS CodeCommit triggers with Lambda deployment
D. AWS CodePipeline with CodeCommit source and CloudFormation action
Answer: D
Explanation:
AWS-native CI/CD with CodePipeline provides automated, integrated CloudFormation deployment.
Why A is incorrect: This answer is incomplete - it doesn't specify the source. CodePipeline with CloudFormation action is correct, but needs a source stage.
Why B is incorrect: While GitHub Actions could work, it requires maintaining workflow files and AWS credentials in GitHub. It's not the AWS-native solution.
Why C is incorrect: Lambda-based deployment requires custom development for CloudFormation operations, error handling, and doesn't provide pipeline visibility.
Why D is correct: The complete solution:
CodeCommit for version-controlled template storage
CodePipeline triggered by main branch merges
CloudFormation action for deployment
Optional manual approval step for production
This is fully AWS-integrated with audit trails and visualization.
Question 48
A DevOps engineer is creating a CloudFormation template with parameters. They want to prevent users from entering invalid values. Which parameter properties should be used? (Select TWO)
A. AllowedPattern
B. ConstraintDescription
C. AllowedValues
D. MinValue and MaxValue
E. Default
Answer: A and C
Explanation:
AllowedPattern and AllowedValues are the validation mechanisms for CloudFormation parameters.
Why A is correct: AllowedPattern specifies a regular expression that the parameter value must match. Useful for validating formats like IP addresses, naming conventions, or custom patterns.
Why B is incorrect: ConstraintDescription provides a custom error message when validation fails, but doesn't perform validation itself.
Why C is correct: AllowedValues specifies an explicit list of allowed values. CloudFormation prevents any value not in the list.
Why D is partially correct but not the best answer: MinValue and MaxValue work for Number type parameters only, not the general case of "invalid values."
Why E is incorrect: Default provides a default value if none is specified, but doesn't prevent invalid values from being entered.
Question 49
A company needs to ensure that EC2 instances are configured with specific settings immediately after launch and that configuration remains consistent over time. Which AWS service combination should be used?
A. CloudFormation with cfn-init for initial configuration
B. AWS OpsWorks with Chef recipes for lifecycle management
C. Systems Manager State Manager with Automation documents
D. AWS Systems Manager State Manager with SSM Documents
Answer: D
Explanation:
State Manager ensures consistent configuration over time through associations.
Why A is incorrect: cfn-init provides initial configuration only. It doesn't continuously enforce configuration or detect drift.
Why B is incorrect: OpsWorks is a valid option but is being phased out in favor of native AWS services. State Manager is the AWS-native approach for configuration management.
Why C is incorrect: State Manager uses SSM Documents (Command or Policy documents), not Automation documents. Automation documents are for workflows, not configuration state.
A DevOps engineer is implementing disaster recovery for CloudFormation stacks. They need to be able to quickly recreate stacks in another region if the primary region fails. Which approach should be used?
A. Use CloudFormation StackSets to deploy to both regions
B. Store templates in S3 with cross-region replication and use CloudFormation exports
C. Store templates in CodeCommit and use CodePipeline with cross-region actions
D. Create a custom Lambda function that copies stacks between regions
Answer: A
Explanation:
StackSets provide the simplest way to maintain identical infrastructure in multiple regions.
Why A is correct: CloudFormation StackSets:
Deploy identical stacks to multiple regions simultaneously
Keep stacks in sync across regions
Can deploy in active-active or active-passive configurations
Automatically handles stack operations in all target regions
Why B is incorrect: While S3 cross-region replication would copy templates, CloudFormation exports are region-specific and don't transfer between regions. You would need additional automation to actually deploy stacks.
Why C is incorrect: This approach works but is more complex than StackSets. It requires pipeline configuration for each region and doesn't provide the unified management StackSets offers.
Why D is incorrect: CloudFormation stacks can't be "copied" - they must be created from templates. This approach would require significant custom development that StackSets provides natively.
Question 51
A DevOps engineer needs to enforce that all S3 buckets created via CloudFormation have versioning enabled. The enforcement should happen before the bucket is created. Which solution should be implemented?
A. AWS Config rule with remediation action
B. CloudFormation Guard policies in CI/CD pipeline
C. CloudFormation Hooks with a Lambda-based hook
D. Service Control Policy restricting S3 actions
Answer: C
Explanation:
CloudFormation Hooks provide proactive enforcement during stack operations.
Why A is incorrect: AWS Config rules are reactive - they detect issues after resources are created, not before.
Why B is incorrect: cfn-guard in CI/CD validates templates before deployment but doesn't prevent someone from deploying through the console or CLI bypassing the pipeline.
Why C is correct: CloudFormation Hooks execute during stack operations and can:
Validate resource configurations before creation
Fail the stack operation if validation fails
Apply to all CloudFormation deployments regardless of source
A hook can check that S3 bucket definitions include VersioningConfiguration with Status: Enabled.
Why D is incorrect: SCPs cannot inspect resource properties like versioning. They can only allow/deny API actions.
Question 52
A company uses AWS Secrets Manager to store database credentials. Applications running on EC2 instances need to retrieve these secrets. The company wants to minimize secret retrieval API calls to reduce costs. Which approach should be implemented?
A. Use Secrets Manager with client-side caching
B. Store secrets in SSM Parameter Store instead
C. Cache secrets in EC2 instance metadata
D. Store secrets in environment variables
Answer: A
Explanation:
Secrets Manager client-side caching reduces API calls while maintaining security.
Why A is correct: AWS provides caching libraries for Secrets Manager that:
Cache secrets in memory on the application side
Automatically refresh when cache TTL expires
Reduce GetSecretValue API calls significantly
Maintain security (secrets are cached encrypted in memory)
Why B is incorrect: Parameter Store has lower per-access costs but doesn't provide the same automatic rotation capabilities as Secrets Manager. The question is about reducing costs with Secrets Manager specifically.
Why C is incorrect: EC2 instance metadata is not designed for storing application secrets. It's accessible to all processes on the instance and doesn't provide encryption.
Why D is incorrect: Environment variables are visible in process listings and logs. This is not a secure approach for sensitive credentials.
Question 53
A DevOps engineer is creating CloudFormation templates for a microservices application. Each microservice team should be able to manage their own infrastructure while ensuring they use approved network configurations. Which approach should be used?
A. Create a central VPC stack with exports and have teams import values
B. Use nested stacks with team stacks nested under a central infrastructure stack
C. Provide teams with CloudFormation modules for approved network configurations
D. Give teams full access and use AWS Config to monitor compliance
Answer: C
Explanation:
CloudFormation Modules provide reusable, approved configurations that teams can use.
Why A is incorrect: While exports work for sharing resources, teams might not correctly configure their resources to use the shared network. There's no enforcement of approved configurations.
Why B is incorrect: Nested stacks require the parent stack to be updated whenever a child needs changes. This doesn't give teams autonomy.
Teams use modules like regular resources in their templates
Central team maintains the modules
Teams get autonomy while using approved configurations
Modules can include multiple resources with pre-configured relationships
Why D is incorrect: Full access with Config monitoring is reactive. Teams could create non-compliant resources. Modules provide preventive governance.
Question 54
A company needs to run database migrations after CloudFormation creates an RDS instance. The migrations must complete before any application resources are created. How should this be implemented?
A. Use cfn-init on an EC2 instance that runs migrations
B. Create a Lambda-backed custom resource with DependsOn
C. Use AWS Step Functions triggered after stack creation
D. Add migration scripts to UserData of application instances
Answer: B
Explanation:
Lambda-backed custom resources can execute custom logic during stack operations.
Why A is incorrect: cfn-init requires an EC2 instance. Running an instance just for migrations is wasteful and slow.
Why B is correct: Lambda-backed custom resources:
Execute during stack creation/update/deletion
Can run database migrations by connecting to RDS
Support DependsOn from application resources
Stack waits for custom resource completion before proceeding
Application resources would have DependsOn: MigrationCustomResource.
Why C is incorrect: Step Functions triggered after stack creation would run after the entire stack is complete, not between resource creations.
Why D is incorrect: Application instances shouldn't run migrations as they might start simultaneously, causing conflicts. Migrations should run once, not per instance.
Question 55
A DevOps engineer needs to create a CloudFormation template that provisions resources differently based on whether it's being deployed to the us-east-1 or eu-west-1 region. Which CloudFormation features should be used? (Select TWO)
A. Mappings with region-specific values
B. Conditions using AWS::Region pseudo parameter
C. Parameters with AllowedValues for regions
D. Metadata with region configuration
E. Transform with region-specific macros
Answer: A and B
Explanation:
Mappings and Conditions are the standard approach for region-specific configurations.
Why A is correct: Mappings can define region-specific values:
Why C is incorrect: Region parameters would require users to manually specify the region, which might not match the actual deployment region.
Why D is incorrect: Metadata provides information about resources but doesn't affect resource provisioning logic.
Why E is incorrect: Transforms are for macros and SAM. While you could create a macro for this, Mappings and Conditions are simpler.
Question 56
A company is using AWS Service Catalog to provide self-service infrastructure provisioning. They want to ensure that when users launch products, the products are created with a specific IAM role rather than the user's permissions. Which feature should be used?
A. Portfolio constraints
B. Launch constraints
C. Template constraints
D. Notification constraints
Answer: B
Explanation:
Launch constraints specify the IAM role to assume when launching products.
Why A is incorrect: "Portfolio constraints" is not a specific constraint type. Constraints are applied to products within portfolios.
Why B is correct: Launch constraints:
Specify an IAM role for provisioning
Product is provisioned using the role's permissions
Users don't need direct resource creation permissions
Role must have permissions for all resources in the product
This enables least-privilege for users while ensuring products can be provisioned.
Why C is incorrect: Template constraints restrict parameter values users can enter, they don't affect the permissions used for provisioning.
Why D is incorrect: Notification constraints configure SNS notifications for stack events, not launch permissions.
Question 57
A DevOps engineer is creating an automation workflow using AWS Systems Manager Automation. The workflow needs to execute steps conditionally based on the output of a previous step. Which Automation feature should be used?
A. onFailure and onCancel properties
B. maxConcurrency and maxErrors properties
C. nextStep and isEnd properties with conditions
D. Parallel execution blocks
Answer: C
Explanation:
Automation runbooks support conditional branching based on step outputs.
Why A is incorrect: onFailure and onCancel define what happens when a step fails or the automation is cancelled, not conditional flow based on outputs.
Why B is incorrect: maxConcurrency and maxErrors control rate limiting and error tolerance, not conditional logic.
Why C is correct: Automation supports:
nextStep: Specify which step to execute next (can be conditional)
Why D is incorrect: Parallel execution runs multiple steps simultaneously but doesn't provide conditional logic.
Question 58
A company needs to deploy a CloudFormation stack that includes a Lambda function. The Lambda function code is stored in an S3 bucket in a different account. What must be configured to allow CloudFormation to access the code?
A. Cross-account IAM role for CloudFormation
B. S3 bucket policy allowing the deployment account access
C. Lambda resource policy allowing S3 access
D. VPC endpoint for S3 cross-account access
Answer: B
Explanation:
S3 bucket policies can grant cross-account access for object retrieval.
Why A is incorrect: CloudFormation doesn't assume roles to access S3 buckets. The Lambda service retrieves the code, and the deployment needs the appropriate S3 permissions.
Why B is correct: The S3 bucket containing Lambda code must have a bucket policy allowing:
s3:GetObject for the deployment account
Or the specific role used for CloudFormation operations
The bucket policy grants cross-account access for CloudFormation to retrieve the Lambda deployment package.
Why C is incorrect: Lambda resource policies control who can invoke the function, not access to the code source.
Why D is incorrect: VPC endpoints are for private access within a VPC, not for solving cross-account access.
Question 59
A DevOps engineer is using AWS Config Conformance Packs to deploy multiple Config rules together. They need to customize the parameters for specific rules in the pack. How should this be done?
A. Modify the conformance pack template directly
B. Use input parameters when deploying the conformance pack
C. Create custom rules with the desired parameters
D. Apply parameter overrides after deployment
Answer: B
Explanation:
Conformance packs support input parameters for rule customization.
Why A is incorrect: AWS-provided conformance pack templates shouldn't be modified directly. They're managed by AWS and can be updated.
Why B is correct: Conformance packs support input parameters that allow customization without modifying templates:
Define parameters in the conformance pack template
Provide values when deploying
Parameters can customize rule thresholds, resource filters, etc.
Example: A pack might have a parameter for maximum instance count that different rules reference.
Why C is incorrect: Creating custom rules for parameter changes is overkill. Input parameters provide this flexibility.
Why D is incorrect: Conformance pack parameters must be specified at deployment time. You cannot apply overrides after deployment.
Question 60
A company is using CloudFormation to manage infrastructure. They want to receive notifications when stacks enter a failed state. Which approach should be used?
A. Configure CloudFormation Stack Notifications with SNS
B. Create CloudWatch Alarms on CloudFormation metrics
C. Use AWS Config rules to detect stack failures
D. Enable CloudTrail logging for CloudFormation
Answer: A
Explanation:
CloudFormation Stack Notifications provide event-based notifications including failure states.
Why A is correct: CloudFormation stacks can be configured with SNS notification topics that receive events including:
CREATE_FAILED
UPDATE_FAILED
DELETE_FAILED
ROLLBACK_COMPLETE
This provides immediate notification when stacks fail.
Why B is incorrect: CloudFormation doesn't publish standard CloudWatch metrics for stack state. You can use EventBridge for CloudFormation events, but SNS notifications are built-in.
Why C is incorrect: AWS Config tracks resource configurations, not CloudFormation stack states.
Why D is incorrect: CloudTrail logs API calls but doesn't provide notifications. You would need additional processing to detect failures.
Question 61
A DevOps engineer needs to ensure that only approved CloudFormation templates can be deployed in an AWS account. The templates are stored in an S3 bucket managed by a central team. Which approach provides the MOST secure enforcement?
A. IAM policy allowing cloudformation:CreateStack only with specific S3 template URLs
B. Service Control Policy restricting template sources
C. AWS Service Catalog with approved products only
D. CloudFormation Hooks validating template source
Answer: C
Explanation:
Service Catalog provides the strongest governance for template deployment.
Why A is incorrect: While IAM conditions can restrict template sources, users with CreateStack permissions could potentially bypass by providing alternative template content.
Why B is incorrect: SCPs cannot inspect template source URLs. They operate at the API action level without visibility into request content.
Why C is correct: AWS Service Catalog:
Removes direct CloudFormation access from users
Only allows launching approved products
Central team controls available products
Launch constraints can enforce specific roles
Provides complete governance over what can be deployed
Why D is incorrect: Hooks validate template content but don't restrict template sources. Users could still deploy unapproved templates if they pass hook validation.
Question 62
A company is implementing infrastructure as code using AWS CDK. They want to share CDK constructs between different application teams. What is the BEST approach?
A. Publish constructs to a private npm/PyPI repository
B. Store construct code in a shared Git repository
C. Create CloudFormation templates from constructs and share via S3
D. Use AWS Service Catalog for construct distribution
Answer: A
Explanation:
CDK constructs are best shared as packages through package managers.
Why A is correct: CDK constructs are regular code in TypeScript, Python, Java, etc. Publishing to package registries:
Enables version control and semantic versioning
Provides standard dependency management
Teams can lock to specific versions
Supports private packages for internal use
Follows software engineering best practices
Why B is incorrect: Sharing via Git requires copying code or complex submodule management. No version management beyond Git tags.
Why C is incorrect: Converting to CloudFormation loses the benefits of CDK (type safety, IDE support, higher-level abstracts).
Why D is incorrect: Service Catalog is for CloudFormation products, not CDK constructs. Teams would lose CDK benefits.
Question 63
A DevOps engineer needs to ensure that all Systems Manager managed instances have the latest SSM Agent version. How should this be automated?
A. Create a State Manager association using the AWS-UpdateSSMAgent document
B. Configure automatic updates in SSM Agent settings
C. Use Patch Manager with SSM Agent in the patch baseline
D. Create a Maintenance Window with SSM Agent update task
Answer: A
Explanation:
State Manager with AWS-UpdateSSMAgent provides automated agent updates.
Why A is correct: State Manager associations:
Apply AWS-UpdateSSMAgent document to managed instances
Run on schedule (daily, weekly, etc.)
Ensure SSM Agent stays current
Report compliance status
Automatically handle new instances when targeted by tags/resource groups
Why B is incorrect: SSM Agent doesn't have a global automatic update setting. Updates must be managed through SSM features.
Why C is incorrect: Patch Manager manages OS patches, not SSM Agent updates. SSM Agent is a separate component.
Why D is incorrect: While Maintenance Windows could run the update document, State Manager is designed for ongoing configuration management like keeping agents updated.
Question 64
A company uses CloudFormation templates that include sensitive parameter values. They want to prevent these values from being displayed in the CloudFormation console or API responses. Which parameter property should be used?
A. NoEcho: true
B. AllowedPattern: encrypted
C. Type: AWS::SSM::Parameter::Value
D. Constraint: Hidden
Answer: A
Explanation:
NoEcho prevents parameter values from being displayed in console or API.
Why A is correct: The NoEcho property:
Masks parameter values in the CloudFormation console
Hides values in describe-stacks API responses
Shows asterisks instead of actual values
Prevents accidental exposure of sensitive values
Note: Values are still passed to resources and logged in CloudTrail.
Why B is incorrect: AllowedPattern is for regex validation, not for hiding values. "encrypted" is not a valid pattern.
Why C is incorrect: This parameter type resolves SSM SecureString parameters but doesn't hide values in CloudFormation.
Why D is incorrect: There is no "Constraint: Hidden" property in CloudFormation.
Question 65
A DevOps engineer needs to automatically remediate AWS Config rule violations using custom logic. Which approach should be used?
A. AWS Config remediation with Lambda function
B. AWS Config remediation with SSM Automation document
C. EventBridge rule triggering Lambda on Config compliance changes
Why A is incorrect: AWS Config remediation actions don't directly invoke Lambda functions. They invoke SSM Automation documents.
Why B is partially correct: SSM Automation documents (including those with Lambda steps) can be used for Config remediation. This is the native approach.
Why C is partially correct: EventBridge receives Config compliance change events. You can trigger Lambda functions for custom remediation logic.
Why D is correct: Both approaches are valid:
SSM Automation is the native Config remediation mechanism
EventBridge + Lambda provides flexibility for complex remediation
The choice depends on requirements like complexity and existing infrastructure.
Question 66
A company is using AWS Organizations with multiple OUs. They want different CloudFormation StackSets deployed to different OUs. How should this be configured?
A. Create separate StackSets for each OU with OU-specific deployment targets
B. Use a single StackSet with multiple deployment configurations
C. Create StackSets with account-level targeting
D. Use CloudFormation conditions based on account ID
Answer: A
Explanation:
Different StackSets for different OUs provides the cleanest separation.
Why A is correct: Creating separate StackSets for each OU:
Each StackSet targets specific OUs
Different templates/parameters per OU
Clear separation of concerns
Automatic deployment to new accounts in target OUs
Why B is incorrect: A single StackSet deploys the same template. While you can override parameters per account, different OUs often need different templates.
Why C is incorrect: Account-level targeting loses the automatic enrollment of new accounts. OU targeting is preferred for Organizations.
Why D is incorrect: Conditions are template-level. A single template with conditions for all OUs becomes complex and hard to maintain.
Question 67
A DevOps engineer is creating an SSM Automation runbook that needs to execute AWS CLI commands. Which approach should be used?
A. Use the aws:runShellScript action type
B. Use the aws:executeAwsApi action type
C. Use the aws:invokeLambdaFunction action type with CLI wrapper
D. Use the aws:runCommand action type
Answer: B
Explanation:
aws:executeAwsApi is designed for making AWS API calls from Automation runbooks.
Why A is incorrect: aws:runShellScript executes shell scripts on managed instances, not API calls from the Automation service itself.
Why B is correct: aws:executeAwsApi:
Makes direct AWS API calls
Runs in the Automation service, not on instances
Supports all AWS service APIs
Simpler than wrapping in Lambda
Example: Call ec2:DescribeInstances directly from the runbook
Why C is incorrect: While Lambda could execute CLI commands, it adds complexity. aws:executeAwsApi is simpler for direct API calls.
Why D is incorrect: aws:runCommand executes commands on managed instances, not API calls from the Automation service.
Question 68
A company wants to create golden AMIs using AWS-native services. The AMIs should be automatically created, tested, and distributed to multiple regions. Which service should be used?
A. AWS Systems Manager Automation
B. AWS CodePipeline with custom actions
C. Amazon EC2 Image Builder
D. AWS Lambda with EC2 APIs
Answer: C
Explanation:
EC2 Image Builder is purpose-built for creating, testing, and distributing AMIs.
Why A is incorrect: SSM Automation can create AMIs but doesn't provide the complete pipeline for testing and multi-region distribution.
Why B is incorrect: CodePipeline with custom actions would require significant custom development for image building and testing.
Why C is correct: EC2 Image Builder provides:
Image recipes (base image + components)
Build pipelines with automated scheduling
Testing (component tests, STIG compliance)
Multi-region distribution
Integration with AWS services (SSM, SNS, etc.)
Why D is incorrect: Lambda with EC2 APIs would require extensive custom development and doesn't provide testing capabilities.
Question 69
A DevOps engineer needs to track all changes made to CloudFormation stacks for audit purposes. Which approach provides the MOST comprehensive audit trail?
A. Enable CloudFormation Stack Events
B. Enable AWS CloudTrail with CloudFormation events
C. Enable AWS Config with CloudFormation resource types
D. All of the above combined
Answer: D
Explanation:
Comprehensive auditing requires multiple data sources.
Why A is partially correct: Stack Events record what happens during stack operations but don't capture who initiated actions.
Why B is partially correct: CloudTrail captures API calls (who did what) but doesn't capture resource-level changes in detail.
Why C is partially correct: AWS Config tracks resource configuration changes over time but doesn't capture stack operations.
Why D is correct: Complete auditing combines:
CloudTrail: Who performed what stack operations (CreateStack, UpdateStack, etc.)
Stack Events: Detailed sequence of resource changes during operations
AWS Config: Resource configuration timeline and relationships
Together, they provide the complete audit picture.
Question 70
A company has a CloudFormation stack that creates an S3 bucket with objects. When attempting to delete the stack, it fails because the bucket is not empty. What is the BEST solution?
A. Manually empty the bucket before stack deletion
B. Create a Lambda-backed custom resource that empties the bucket on delete
C. Set DeletionPolicy to Retain on the bucket
D. Use the ForceDelete property on the S3 bucket resource
Answer: B
Explanation:
Custom resources can execute cleanup logic during stack deletion.
Why A is incorrect: Manual steps break automation and are error-prone.
Why B is correct: A Lambda-backed custom resource can:
Receive CloudFormation delete events
List and delete all objects in the bucket
Allow CloudFormation to delete the empty bucket
Make stack deletion fully automated
Why C is incorrect: This leaves the bucket behind, which might not be desired. It's a workaround, not a solution.
Why D is incorrect: S3 bucket resources in CloudFormation don't have a ForceDelete property. (Note: S3 has bucket lifecycle rules for object expiration, but that's different.)
Question 71
A DevOps engineer is implementing a blue-green deployment strategy using CloudFormation. They need to update the DNS to point to the new environment after deployment verification. Which approach should be used?
A. Use CloudFormation UpdatePolicy with DNS switching
B. Create a separate Route 53 stack with weighted routing
C. Use CodeDeploy with CloudFormation for deployment orchestration
D. Implement a custom resource that updates Route 53 records
Answer: C
Explanation:
CodeDeploy with CloudFormation provides integrated blue-green deployment capabilities.
Why A is incorrect: CloudFormation UpdatePolicy doesn't provide DNS switching capabilities. It's for Auto Scaling group updates.
Why B is incorrect: A separate Route 53 stack adds operational complexity and requires manual or external coordination.
Why C is correct: CodeDeploy integrates with CloudFormation for blue-green deployments:
Provisions new environment (green)
Runs health checks
Switches traffic (DNS/ALB)
Maintains rollback capability
The AWS::CodeDeploy::DeploymentGroup resource supports blue-green deployment configuration.
Why D is incorrect: Custom resources could work but lack the health checking and rollback capabilities of CodeDeploy.
Question 72
A company needs to ensure their CloudFormation templates conform to security best practices before deployment. Which AWS-native tool should be used?
A. Amazon Inspector
B. AWS CloudFormation Guard
C. AWS Security Hub
D. AWS Trusted Advisor
Answer: B
Explanation:
CloudFormation Guard (cfn-guard) validates templates against policy rules.
Why A is incorrect: Amazon Inspector scans running workloads for vulnerabilities, not CloudFormation templates.
Why B is correct: cfn-guard:
Policy-as-code tool for CloudFormation
Define rules for security best practices
Validate templates before deployment
Integrate into CI/CD pipelines
AWS-managed ruleset available for security
Why C is incorrect: Security Hub aggregates security findings from deployed resources, not template analysis.
Why D is incorrect: Trusted Advisor provides recommendations for deployed resources, not template validation.
Question 73
A DevOps engineer is creating a CloudFormation template that needs to generate unique resource names to avoid conflicts. Which approach should be used?
A. Use the AWS::StackName pseudo parameter
B. Use the AWS::NoValue pseudo parameter
C. Use the Fn::GenerateId function
D. Let CloudFormation auto-generate physical resource IDs
Answer: D
Explanation:
CloudFormation automatically generates unique physical IDs when not specified.
Why A is incorrect: AWS::StackName is the same for all resources in a stack. It doesn't provide unique IDs per resource.
Why B is incorrect: AWS::NoValue is used to conditionally remove properties, not generate IDs.
Why C is incorrect: Fn::GenerateId is not a CloudFormation function. (There's no such function.)
Why D is correct: When you don't specify physical resource names (like S3 bucket name, DynamoDB table name), CloudFormation:
Generates unique physical IDs automatically
Uses pattern: stack-name-logical-id-random-suffix
Prevents naming conflicts
Allows multiple stack instances
Best practice: Avoid hardcoding resource names when uniqueness is needed.
Question 74
A company uses AWS Config to monitor compliance. They want to exempt specific resources from certain Config rules. How should this be implemented?
A. Delete the non-compliant resources from the Config recording
B. Use AWS Config exclusions for specific resource IDs
C. Modify the Config rule to exclude specific resources
D. Create a conformance pack without the rule
Answer: C
Explanation:
Config rules can be scoped to exclude specific resources.
Why A is incorrect: Excluding from recording stops tracking entirely, which affects all rules and loses audit trail.
Why B is incorrect: AWS Config doesn't have a global "exclusions" feature for resource IDs.
Why C is correct: Config rules support scope configuration:
Include only specific resource types
Include only resources with specific tags
Exclude specific resource IDs using rule parameters
Custom rules can include logic to skip specific resources.
Why D is incorrect: Removing the rule from conformance pack affects all resources, not just the exempted ones.
Question 75
A DevOps engineer needs to deploy an application stack to AWS GovCloud and commercial AWS regions using the same CloudFormation template. What challenge must be addressed?
A. Different AMI IDs between partitions
B. CloudFormation syntax differences between partitions
C. IAM policy format differences between partitions
D. Stack name restrictions in GovCloud
Answer: A
Explanation:
AMI IDs are different between AWS partitions and must be handled.
Why A is correct: AMI IDs are unique per partition:
Commercial AWS (aws partition)
GovCloud (aws-us-gov partition)
China (aws-cn partition)
Templates must use Mappings or SSM Parameter Store to get correct AMI IDs per partition.
Why B is incorrect: CloudFormation syntax is consistent across partitions.
Why C is incorrect: IAM policy format is consistent across partitions.
Why D is incorrect: Stack name restrictions are the same across partitions.
Question 76
A company wants to share AWS Service Catalog portfolios with multiple accounts in their AWS Organization. What is the MOST efficient approach?
A. Manually share the portfolio with each account
B. Use CloudFormation StackSets to deploy portfolios to each account
C. Share the portfolio with the AWS Organization or specific OUs
D. Create duplicate portfolios in each account
Answer: C
Explanation:
Service Catalog supports Organization-level portfolio sharing.
Why A is incorrect: Manual sharing is not scalable and doesn't automatically include new accounts.
Why B is incorrect: StackSets could deploy portfolios, but native Organization sharing is simpler and more efficient.
Why C is correct: Service Catalog supports:
Sharing portfolios with entire Organization
Sharing with specific OUs
Automatic inclusion of new accounts
Single source of truth for products
Centralized management
Why D is incorrect: Duplicate portfolios require maintenance in each account and can drift.
Question 77
A DevOps engineer is troubleshooting a CloudFormation stack that's stuck in UPDATE_ROLLBACK_FAILED state. What should be done?
A. Delete the stack and recreate it
B. Use continue-update-rollback with resources-to-skip parameter
C. Create a new stack and import resources
D. Contact AWS Support to reset stack state
Answer: B
Explanation:
Continue-update-rollback can skip problematic resources to complete rollback.
Why A is incorrect: You cannot delete a stack in UPDATE_ROLLBACK_FAILED state until rollback is completed.
Why B is correct: When rollback fails (usually due to external resource changes):
Identify which resource(s) are causing the failure
Use continue-update-rollback with --resources-to-skip
CloudFormation skips those resources and completes rollback
Stack returns to UPDATE_ROLLBACK_COMPLETE
After completion, you may need to manually reconcile skipped resources.
Why C is incorrect: You can't import resources while the stack is in failed state.
Why D is incorrect: AWS Support typically guides you to use continue-update-rollback rather than manually resetting state.
Question 78
A company is using AWS CDK with TypeScript. They want to run unit tests on their infrastructure code to verify resource properties. Which testing approach is provided by CDK?
A. CDK assertions library
B. AWS CloudFormation test framework
C. Jest integration for CloudFormation
D. CDK synthesize with validation
Answer: A
Explanation:
CDK provides assertions libraries for testing synthesized templates.
Why A is correct: CDK assertions library (@aws-cdk/assertions or aws-cdk-lib/assertions):
Why B is incorrect: There's no AWS CloudFormation test framework for templates.
Why C is incorrect: Jest is a testing framework but doesn't provide CloudFormation-specific testing. CDK assertions work with Jest.
Why D is incorrect: CDK synth validates syntax but doesn't run custom assertions on resource properties.
Question 79
A DevOps engineer needs to implement infrastructure changes that require manual approval before being applied to production. Which approach should be used with CloudFormation?
A. Use CloudFormation change sets with manual review
B. Enable stack policy that requires approval
C. Use CodePipeline with manual approval action before CloudFormation
D. Implement custom approval workflow with Step Functions
Answer: C
Explanation:
CodePipeline manual approval gates provide workflow-integrated approval.
Why A is incorrect: Change sets require review, but the execution is immediate once approved. There's no built-in waiting for approval.
Why B is incorrect: Stack policies protect resources from changes but don't provide an approval workflow.
Why C is correct: CodePipeline with CloudFormation action:
Add manual approval action between create-change-set and execute-change-set actions
Reviewers receive notifications
Approval or rejection is recorded
Pipeline blocks until approved
Full audit trail
Why D is incorrect: Step Functions could implement approval, but CodePipeline has this built-in and is designed for deployment workflows.
Question 80
A company needs to create a CloudFormation template that works with different AWS regions where some services are not available. How should this be handled?
A. Use Conditions to check service availability
B. Create separate templates for different regions
C. Use Mappings to define available services per region
D. Combine Conditions with Mappings for service availability
Answer: D
Explanation:
Combining Mappings and Conditions handles regional service availability.
Why A is incorrect: Conditions alone don't know which services are available where.
Why B is incorrect: Separate templates are harder to maintain and lead to drift.
Why C is incorrect: Mappings alone define data but don't conditionally create/skip resources.
Why D is correct: Combined approach:
Mappings define service availability per region
Conditions evaluate Mappings for current region
Resources use Conditions to be created or skipped
Example: Create a Global Accelerator only in regions where it's available.
Question 81
A DevOps engineer is using AWS Systems Manager Parameter Store to store configuration. They need to track who changed parameters and when. Which feature should be used?
A. Parameter Store parameter history
B. AWS CloudTrail logging
C. SSM Inventory
D. Both A and B
Answer: D
Explanation:
Complete parameter change tracking requires both Parameter Store history and CloudTrail.
Why A is partially correct: Parameter Store maintains version history showing what values changed, but not who changed them.
Why B is partially correct: CloudTrail logs API calls including PutParameter, showing who made changes, but not the parameter values.
Why C is incorrect: SSM Inventory collects data from managed instances, not Parameter Store.
Why D is correct: Complete audit trail:
Parameter Store history: What changed (versions, values)
CloudTrail: Who changed it, when, from where (API calls)
Together they provide complete change tracking.
Question 82
A company has enabled AWS Config recording but wants to limit which resource types are recorded to reduce costs. How should this be configured?
A. Create a custom Config rule to filter resources
B. Modify the Config Recorder settings to specify resource types
C. Use AWS Config exclusion lists
D. Create multiple recorders for different resource types
Answer: B
Explanation:
Config Recorder can be configured to record specific resource types.
Why A is incorrect: Config rules evaluate compliance; they don't control what's recorded.
Why B is correct: Config Recorder settings support:
Record all resource types
Record specific resource types (whitelist)
Include/exclude global resources
This controls costs by recording only needed resource types.
Why C is incorrect: AWS Config doesn't have exclusion lists for resources from recording.
Why D is incorrect: You can only have one Config Recorder per region per account.
Question 83
A DevOps engineer needs to reference an AWS Secrets Manager secret in a CloudFormation template. The secret contains a JSON object with multiple key-value pairs. How should a specific key be referenced?
A. {{resolve:secretsmanager:secret-name:SecretString}}
B. {{resolve:secretsmanager:secret-name:SecretString:key-name}}
C. !GetAtt Secret.key-name
D. !Sub ${secret-name:key-name}
Answer: B
Explanation:
Dynamic references support JSON key extraction from secrets.
Why A is incorrect: This retrieves the entire secret string, not a specific key.
Why B is correct: The full dynamic reference syntax is:
Why C is incorrect: GetAtt retrieves attributes from stack resources, not external secrets.
Why D is incorrect: Sub is for string substitution, not secret retrieval.
Question 84
A company wants to ensure that CloudFormation stacks are created with specific tags. Which approach provides preventive enforcement?
A. AWS Config rule to check stack tags
B. IAM policy with tag conditions on CloudFormation actions
C. CloudFormation Hooks to validate stack tags
D. Both B and C
Answer: D
Explanation:
Both IAM conditions and CloudFormation Hooks can enforce stack tags.
Why A is incorrect: Config rules are detective, not preventive.
Why B is partially correct: IAM policies can require tags using aws:RequestTag conditions on CreateStack.
Why C is partially correct: CloudFormation Hooks can validate that stacks have required tags before creation.
Why D is correct: Both approaches provide preventive enforcement:
IAM is simpler for basic tag requirements
Hooks provide more sophisticated validation logic
Using both provides defense in depth.
Question 85
A DevOps engineer is deploying CloudFormation StackSets to member accounts in an AWS Organization. The deployment fails with an access denied error. What is the MOST likely cause?
A. StackSets service-linked role is missing
B. AWSCloudFormationStackSetExecutionRole is missing in member accounts
C. CloudFormation service role has insufficient permissions
D. OrganizationAccountAccessRole is not properly configured
Answer: B
Explanation:
StackSets require execution roles in target accounts.
Why A is incorrect: Service-linked roles are created automatically when needed.
Why B is correct: For Organization-based StackSets:
Why C is incorrect: Disabling Control Tower loses its benefits. Extensions are preferred.
Why D is incorrect: Independent StackSets don't integrate with Control Tower lifecycle events for new accounts.
Question 87
A DevOps engineer needs to create a CloudFormation macro that transforms templates at deployment time. What is required? (Select TWO)
A. Lambda function with transformation logic
B. AWS::CloudFormation::Macro resource
C. AWS SAM template for macro definition
D. CloudFormation Registry registration
E. SNS topic for macro events
Answer: A and B
Explanation:
CloudFormation macros require a Lambda function and macro resource definition.
Why A is correct: The macro logic is implemented in a Lambda function that:
Receives template fragments
Performs transformation
Returns modified template
Why B is correct: AWS::CloudFormation::Macro resource:
Defines the macro name
References the Lambda function
Makes macro available for use in templates
Why C is incorrect: SAM templates use macros but aren't required to create macros.
Why D is incorrect: Registry is for third-party resource types, not macros.
Why E is incorrect: SNS is not required for macro operation.
Question 88
A company wants to deploy AWS infrastructure across 10 AWS accounts using Terraform instead of CloudFormation. They need centralized state management and secure credential handling. Which approach should be used?
A. Store state files in S3 with DynamoDB locking in a central account
B. Store state files locally with Git synchronization
C. Use Terraform Cloud with AWS integration
D. Both A and C are valid approaches
Answer: D
Explanation:
Terraform state can be managed centrally using S3 or Terraform Cloud.
Why A is partially correct: S3 + DynamoDB is the standard AWS-native approach:
S3 for state file storage
DynamoDB for state locking
IAM for access control
Cross-account access via roles
Why B is incorrect: Local state with Git is not suitable for team collaboration and lacks locking.
Why C is partially correct: Terraform Cloud provides:
Managed state storage
Built-in locking
Remote execution
Policy enforcement
AWS credentials via dynamic provider credentials
Why D is correct: Both are valid approaches depending on requirements. S3/DynamoDB is AWS-native, Terraform Cloud provides additional features.
Question 89
A DevOps engineer is using CloudFormation nested stacks. The parent stack update is failing because a nested stack is failing to update. How can the engineer identify which nested stack is failing?
A. Check parent stack events only
B. Check nested stack events using the nested stack physical resource ID
C. Review CloudWatch Logs for CloudFormation
D. Use CloudFormation drift detection
Answer: B
Explanation:
Nested stack events are in separate stack event logs.
Why A is incorrect: Parent stack events show that a nested stack failed but don't show the detailed resource failure in the nested stack.
Why B is correct: To troubleshoot nested stack failures:
Find the nested stack's physical resource ID in parent events
Navigate to that stack's events
Review the detailed failure events
Each nested stack has its own event stream with resource-level details.
Why C is incorrect: CloudFormation doesn't log to CloudWatch Logs by default. Stack events are the troubleshooting mechanism.
Why D is incorrect: Drift detection shows configuration differences, not update failure reasons.
Question 90
A company uses AWS Secrets Manager for database credentials. They need to ensure that secrets are not accidentally deleted. Which feature should be enabled?
Why A is incorrect: Versioning maintains previous secret versions but doesn't prevent deletion.
Why B is incorrect: Resource policies control access but don't provide delete protection specifically.
Why C is correct: Secrets Manager requires a recovery window for deletion:
Minimum 7 days, maximum 30 days
Secret can be recovered during this window
Provides protection against accidental deletion
DeleteSecret API includes RecoveryWindowInDays parameter
Why D is incorrect: KMS key policies protect encryption but don't prevent secret deletion.
Question 91
A DevOps engineer is implementing automated remediation for AWS Config rules. They want to test remediation actions without affecting production resources. What approach should be used?
A. Create a test AWS Config rule with test resources
B. Use SSM Automation with dry run mode
C. Deploy remediation in a non-production account first
D. Use AWS Config remediation in manual mode for testing
Answer: D
Explanation:
Manual remediation mode allows testing before enabling automatic remediation.
Why A is incorrect: A separate test rule doesn't test the actual production rule's remediation.
Why B is incorrect: Not all SSM Automation documents support dry run mode.
Why C is incorrect: While good practice, this doesn't test against actual non-compliant resources.
Why D is correct: AWS Config remediation modes:
Manual: Requires explicit execution for each non-compliant resource
Automatic: Runs automatically on non-compliance detection
Manual mode allows:
Test remediation on specific resources
Verify results before automation
Gradual rollout
Question 92
A company uses CloudFormation to deploy resources. They need to understand the monthly costs of resources before deploying. Which feature should be used?
A. CloudFormation change sets with cost estimation
B. AWS Pricing Calculator integration
C. CloudFormation cost estimation API
D. AWS Cost Explorer forecast
Answer: A
Explanation:
CloudFormation change sets include cost estimation.
Why A is correct: CloudFormation change sets can include cost estimation:
Enable cost estimation when creating change sets
Shows estimated monthly cost for new resources
Shows cost impact of changes
Uses AWS Pricing API under the hood
Why B is incorrect: Pricing Calculator is a separate tool, not integrated into CloudFormation workflow.
Why C is incorrect: There's no separate cost estimation API. It's part of change sets.
Why D is incorrect: Cost Explorer shows historical and forecasted costs for existing resources, not template estimates.
Question 93
A DevOps engineer is using AWS Systems Manager to manage EC2 instances. Some instances are not appearing as managed instances. What should be verified? (Select TWO)
A. SSM Agent is installed and running
B. Instance has proper IAM instance profile with SSM permissions
C. Instance has a public IP address
D. CloudWatch agent is installed
E. Security groups allow all traffic
Answer: A and B
Explanation:
SSM managed instances require SSM Agent and proper IAM permissions.
Why A is correct: SSM Agent must be:
Installed (pre-installed on Amazon Linux, some Windows AMIs)
Running and healthy
Able to reach SSM endpoints
Why B is correct: The EC2 instance profile must include:
Allows SSM service to communicate with the instance
Why C is incorrect: Public IP is not required. SSM can work via:
NAT Gateway
VPC endpoints
Internet connectivity is needed, but not public IP
Why D is incorrect: CloudWatch agent is separate from SSM Agent and not required for SSM management.
Why E is incorrect: SSM uses outbound HTTPS connections. Inbound security group rules don't affect SSM.
Question 94
A company is using CloudFormation and wants to implement GitOps practices where infrastructure changes are driven by Git commits. Which approach should be used?
A. AWS CodePipeline triggered by CodeCommit changes
B. GitHub webhook to Lambda deploying CloudFormation
C. ArgoCD with CloudFormation integration
D. AWS Proton with Git repository source
Answer: A
Explanation:
CodePipeline with CodeCommit provides AWS-native GitOps for CloudFormation.
Why A is correct: GitOps pattern with AWS services:
CodeCommit (or GitHub/GitLab) stores templates
CodePipeline triggered by commits to main branch
CloudFormation action deploys changes
Pull request reviews before merge
Full audit trail
Why B is incorrect: Custom Lambda deployment lacks the pipeline visibility, approval gates, and rollback capabilities of CodePipeline.
Why C is incorrect: ArgoCD is primarily for Kubernetes, not CloudFormation.
Why D is incorrect: AWS Proton is for container/serverless infrastructure, not general CloudFormation GitOps.
Question 95
A DevOps engineer needs to create a CloudFormation template that provisions resources only if another resource creation succeeds with specific properties. How should this be implemented?
A. Use DependsOn attribute
B. Use WaitCondition based on resource output
C. Use Conditions with !GetAtt to check resource properties
D. Use custom resource to verify conditions
Answer: D
Explanation:
Complex conditional logic based on resource properties requires custom resources.
Why A is incorrect: DependsOn controls order but doesn't check success criteria beyond basic creation.
Why B is incorrect: WaitCondition waits for signals but can't evaluate resource properties.
Why C is incorrect: Conditions are evaluated at template processing time, before resources are created. They can't reference GetAtt values from resources being created.
Why D is correct: Custom resources can:
Execute after other resources are created
Query resource properties via AWS APIs
Return success/failure based on conditions
Control subsequent resource creation via dependencies
This pattern allows conditional logic based on actual resource state.
Question 96
A company uses AWS Config conformance packs for compliance. They want to receive notifications when conformance pack compliance changes. How should this be implemented?
A. Configure SNS notifications in the conformance pack
B. Create EventBridge rules for conformance pack compliance events
C. Enable CloudWatch alarms on Config metrics
D. Use AWS Config Aggregator with SNS
Answer: B
Explanation:
EventBridge receives Config compliance change events including conformance packs.
Why A is incorrect: Conformance packs don't have built-in SNS notification configuration.
Why B is correct: AWS Config sends events to EventBridge:
Compliance state changes
Conformance pack status changes
Rule evaluation results
Create EventBridge rules to route to SNS, Lambda, or other targets.
Why C is incorrect: CloudWatch metrics for Config don't include conformance pack compliance states.
Why D is incorrect: Config Aggregator collects data but doesn't send notifications directly.
Question 97
A DevOps engineer needs to deploy a multi-region active-active application using CloudFormation. Global resources like IAM roles should only be created once. How should the template be structured?
A. Create IAM resources in every region with the same name
B. Use Conditions to create global resources only in a primary region
C. Create separate stacks for global and regional resources
D. Use CloudFormation StackSets with different templates per region
Answer: C
Explanation:
Separating global and regional resources into different stacks is the best practice.
Why A is incorrect: IAM roles are global; creating them in each region would cause conflicts.
Why B is incorrect: While Conditions could work, it couples global and regional resources, making management complex.
Why C is correct: Best practice for multi-region:
Global stack: IAM, Route 53, CloudFront (deploy once)
Regional stacks: EC2, RDS, etc. (deploy per region)
Regional stacks reference global stack outputs via SSM parameters or exports
Clean separation of concerns.
Why D is incorrect: Different templates per region lose the benefit of single-source templates.
Question 98
A company is using AWS CDK and wants to prevent synthesized CloudFormation templates from creating certain resource types. Which CDK feature should be used?
A. CDK Aspects
B. CDK Context
C. CDK Tokens
D. CDK Escape Hatches
Answer: A
Explanation:
CDK Aspects allow visiting and modifying constructs in the construct tree.
Why A is correct: CDK Aspects:
Implement the Visitor pattern
Visit all constructs in the tree
Can validate, modify, or report on constructs
Run during synthesis
Example: Aspect that throws an error if EC2 instances are created without encryption.
Why B is incorrect: Context provides runtime values, not validation logic.
Why C is incorrect: Tokens are for lazy value resolution, not validation.
Why D is incorrect: Escape hatches allow accessing lower-level constructs, not preventing resource creation.
Question 99
A DevOps engineer is implementing infrastructure changes using CloudFormation. They need to understand what resources will be affected before applying changes. Which approach should be used?
A. CloudFormation validate-template command
B. CloudFormation describe-stack-resources command
C. CloudFormation create-change-set command
D. CloudFormation detect-stack-drift command
Answer: C
Explanation:
Change sets show exactly what CloudFormation will change.
Why A is incorrect: validate-template checks syntax only, not impact of changes.
Why B is incorrect: describe-stack-resources shows current resources, not proposed changes.
Why D is incorrect: detect-stack-drift shows differences from template, not planned changes.
Question 100
A company has regulatory requirements to retain all CloudFormation templates used for deployments. Which approach ensures compliance?
A. Enable CloudFormation template storage
B. Store templates in S3 with versioning enabled
C. Enable CloudTrail with CloudFormation data events
D. Use AWS Backup for CloudFormation
Answer: B
Explanation:
S3 with versioning provides durable, versioned template storage.
Why A is incorrect: CloudFormation doesn't have a built-in template storage feature. Templates are used during deployment but not permanently stored by the service.
Why B is correct: Best practice for template retention:
Store templates in S3 with versioning
Templates are retained indefinitely
Version history shows all template versions
Can reference specific S3 object versions in deployments
Why C is incorrect: CloudTrail logs API calls and can capture template content in some cases, but it's not designed for template storage and has log rotation.
Why D is incorrect: AWS Backup doesn't support CloudFormation as a backup source.
Question 101
A DevOps engineer needs to implement a CloudFormation template that creates an Application Load Balancer. The ALB should only be created if the environment parameter is "production". Which template structure is correct?
A. Use DependsOn with the environment parameter
B. Use Conditions with !Equals comparing the parameter to "production"
C. Use Mappings to define ALB properties based on environment
D. Use Transform to conditionally include ALB resources
Answer: B
Explanation:
Conditions control whether resources are created based on input values.
Why A is incorrect: DependsOn controls creation order between resources, not conditional creation.
Why C is incorrect: Mappings provide values but don't control resource creation.
Why D is incorrect: Transform is for macros, not conditional resource creation.
Question 102
A company is using AWS Systems Manager Automation to patch EC2 instances. They need to ensure instances are healthy before continuing after patching. Which Automation action should be used?
A. aws:sleep
B. aws:waitForAwsResourceProperty
C. aws:branch
D. aws:approve
Answer: B
Explanation:
waitForAwsResourceProperty waits for a resource to reach a desired state.
Why A is incorrect: aws:sleep just pauses execution for a time period without checking health.
Why B is correct: aws:waitForAwsResourceProperty:
Polls an AWS resource property
Waits until property matches desired value
Example: Wait for EC2 instance status checks to pass
Supports timeout configuration
Why C is incorrect: aws:branch is for conditional logic, not waiting for conditions.
Why D is incorrect: aws:approve requires human approval, not automated health checks.
Question 103
A DevOps engineer is implementing AWS Config rules that need to evaluate Lambda function configurations. The rule should fail if a function doesn't have a dead-letter queue configured. Which approach should be used?
A. Use the managed rule lambda-dlq-check
B. Create a custom Config rule with Lambda evaluation
C. Use AWS Config advanced queries
D. Check during deployment with cfn-guard
Answer: B
Explanation:
Custom Config rules allow checking specific Lambda configurations.
Why A is incorrect: There is no managed rule named lambda-dlq-check for DLQ configuration.
Why B is correct: Custom Config rule with Lambda:
Lambda function receives configuration item
Evaluates if DeadLetterConfig is present
Returns COMPLIANT or NON_COMPLIANT
Supports remediation action configuration
Why C is incorrect: Advanced queries retrieve data but don't provide ongoing compliance monitoring.
Why D is incorrect: cfn-guard checks templates at deployment but doesn't provide ongoing monitoring for changes made outside CloudFormation.
Question 104
A company needs to ensure that all EC2 instances launched in their account are registered with AWS Systems Manager automatically. What should be configured?
A. Create a default host management configuration
B. Enable EC2 detailed monitoring
C. Configure automatic registration in SSM
D. Ensure instances have proper IAM instance profiles
Answer: D
Explanation:
IAM instance profiles are the primary requirement for SSM management.
Why A is incorrect: Default Host Management Configuration is a feature but primarily helps with hybrid instances, not EC2.
Why B is incorrect: Detailed monitoring is for CloudWatch metrics, not SSM registration.
Why C is incorrect: There's no "automatic registration" setting. Instances with proper permissions register automatically.
Why D is correct: For automatic SSM registration:
Instance must have IAM instance profile
Profile must include SSM permissions (AmazonSSMManagedInstanceCore)
SSM Agent installed and running (default on Amazon Linux 2, Windows)
Network connectivity to SSM endpoints
With these requirements, instances automatically appear in SSM.
Question 105
A DevOps engineer is using CloudFormation macros to transform templates. The macro Lambda function is failing. Where should the engineer look for error details?
A. CloudFormation stack events
B. CloudWatch Logs for the Lambda function
C. CloudFormation console macro section
D. AWS X-Ray traces
Answer: B
Explanation:
Lambda function errors are logged to CloudWatch Logs.
Why A is incorrect: Stack events show that the macro failed but not the detailed error from Lambda.
Why B is correct: The macro Lambda function logs to CloudWatch Logs:
Input received from CloudFormation
Any exceptions or errors
Processing logs
Log group: /aws/lambda/function-name
Why C is incorrect: CloudFormation console shows macro definition but not execution logs.
Why D is incorrect: X-Ray shows traces if enabled but CloudWatch Logs is the primary debugging source.
Question 106
A company wants to implement a policy that all CloudFormation stacks must have a specific tag. The policy should prevent stack creation without the tag. Which approach should be used?
A. IAM policy with aws:RequestTag condition
B. AWS Organizations tag policy
C. CloudFormation Hook
D. Both A and C
Answer: D
Explanation:
Both IAM conditions and CloudFormation Hooks can enforce stack tags.
Why A is partially correct: IAM policies can require tags:
Why B is incorrect: Organization tag policies ensure tag value consistency but don't prevent resource creation without tags.
Why C is partially correct: CloudFormation Hooks can validate stack tags before creation.
Why D is correct: Both approaches provide preventive enforcement:
IAM for account-wide enforcement
Hooks for CloudFormation-specific validation with custom logic
Question 107
A DevOps engineer is creating an SSM Automation runbook that needs to handle failures gracefully. If a step fails, specific cleanup actions should execute. Which feature should be used?
A. onFailure and onCancel step attributes
B. try-catch blocks in the runbook
C. aws:branch with error conditions
D. Parallel steps with failure handling
Answer: A
Explanation:
onFailure attribute defines actions when a step fails.
Why A is correct: SSM Automation supports:
onFailure: Abort (stop), Continue (proceed), step:stepName (go to step)
onCancel: Define cleanup on cancellation
Example: onFailure: step:CleanupStep
Why B is incorrect: Automation runbooks don't use try-catch syntax.
Why C is incorrect: aws:branch is for conditional logic based on outputs, not error handling.
Why D is incorrect: Parallel execution doesn't inherently handle failures of other steps.
Question 108
A company needs to deploy CloudFormation stacks that include resources from the AWS Solutions Library. Which CloudFormation feature enables this?
Why A is incorrect: Registry is for third-party resource types, not solution templates.
Why B is correct: CloudFormation Modules:
Package multiple resources as a single building block
AWS publishes modules for common patterns
Use like any other resource type
Reference: AWS::Solutions::ModuleName
Why C is incorrect: Transform is for macros, not for including solutions.
Why D is incorrect: Imports bring existing resources into management, not add solution templates.
Question 109
A DevOps engineer needs to manage secrets for applications running in ECS Fargate. The secrets should be injected as environment variables at container start. Which approach should be used?
A. Store secrets in SSM Parameter Store SecureString and reference in task definition
B. Store secrets in Secrets Manager and reference in task definition
C. Pass secrets through ECS Service Connect
D. Both A and B are valid
Answer: D
Explanation:
ECS supports both Parameter Store SecureString and Secrets Manager for secrets.
Why A is partially correct: ECS task definitions can reference SSM parameters:
Why C is incorrect: ECS Service Connect is for service discovery, not secrets.
Why D is correct: Both are valid approaches with different features:
Parameter Store: Lower cost, simpler
Secrets Manager: Rotation, more features
Question 110
A company uses CloudFormation to create IAM roles. They want to limit the maximum permissions any role created via CloudFormation can have. Which approach should be used?
A. Set CloudFormation service role with limited permissions
B. Use IAM permissions boundary in CloudFormation
C. Create SCP limiting IAM actions
D. Use Stack Policy to limit role permissions
Answer: B
Explanation:
Permissions boundaries limit maximum permissions for created roles.
Why A is incorrect: Service role permissions affect what CloudFormation can do, not what the created roles can do.
Why B is correct: CloudFormation can apply permissions boundaries to roles:
The boundary limits effective permissions regardless of attached policies.
Why C is incorrect: SCPs limit account-level permissions but don't control IAM role creation specifically.
Why D is incorrect: Stack Policies protect stack resources from updates, not IAM role permissions.
Question 111
A DevOps engineer is troubleshooting a CloudFormation stack that failed to create. The error message indicates a circular dependency. How can this be resolved?
A. Remove all DependsOn attributes
B. Identify resources that reference each other and break the cycle
C. Create resources in separate stacks
D. Use WaitCondition to order resource creation
Answer: B
Explanation:
Circular dependencies occur when resources reference each other cyclically.
Why A is incorrect: Removing DependsOn might not solve it if the cycle is in intrinsic function references (!Ref, !GetAtt).
Why B is correct: Circular dependency resolution:
Identify the cycle (e.g., Security Group A references Security Group B and vice versa)
Break the cycle by:
Using separate security group rules
Creating resources without references, then adding references via separate resources
Splitting configuration across resource types
Why C is incorrect: Separate stacks might help but is often overkill. Usually cycles can be broken within one stack.
Why D is incorrect: WaitCondition doesn't resolve circular dependencies.
Question 112
A company needs to ensure that Systems Manager Run Command documents are executed only on instances with specific tags. How should this be configured?
A. Use resource groups as targets
B. Create IAM policies restricting Run Command targets
C. Use document conditions
D. Configure SSM Agent with tag filters
Answer: A
Explanation:
Resource groups enable tag-based targeting for Run Command.
Why A is correct: Run Command targeting options:
Resource groups (based on tags)
Tag-based targeting directly
Instance IDs
Resource groups: Create a group with tag criteria, use group as Run Command target.
Why B is incorrect: IAM policies control who can run commands, not which instances are targeted.
Why C is incorrect: SSM Documents don't have target conditions; targeting is specified at execution.
Why D is incorrect: SSM Agent doesn't filter commands based on tags; targeting is service-side.
Question 113
A DevOps engineer is using AWS Config to track resource configurations. They need to query configurations across the organization. Which feature should be used?
A. Config Advanced Queries with Aggregator
B. Config Rules with organization scope
C. Config Snapshot export to S3
D. CloudWatch Logs Insights on Config logs
Answer: A
Explanation:
Advanced queries with aggregator provide cross-account configuration querying.
Why A is correct: AWS Config Advanced Queries:
SQL-like queries on configuration data
Works with aggregators for cross-account
Query current and historical configurations
Example: SELECT * WHERE resourceType = 'AWS::EC2::Instance'
Why B is incorrect: Organization rules enforce compliance but don't provide querying.
Why C is incorrect: Snapshots are point-in-time exports, not queryable across organization.
Why D is incorrect: Config doesn't log to CloudWatch Logs for querying.
Question 114
A company wants to enable developers to launch approved infrastructure while preventing them from modifying the underlying CloudFormation templates. Which solution should be implemented?
A. Store templates in S3 with read-only permissions
B. Use AWS Service Catalog with constrained launch role
C. Deploy templates through CodePipeline only
D. Create CloudFormation StackSets managed by central team
Answer: B
Explanation:
Service Catalog separates template management from infrastructure provisioning.
Why A is incorrect: Read-only S3 prevents modification but developers still need CloudFormation permissions to deploy.
Why B is correct: Service Catalog solution:
Central team creates products (templates)
Developers only have Service Catalog permissions
Launch constraints use predefined IAM role
Developers can't modify templates or access CloudFormation directly
Why C is incorrect: Developers might still have CloudFormation permissions allowing bypass.
Why D is incorrect: StackSets are for multi-account deployment, not self-service.
Question 115
A DevOps engineer needs to create a CloudFormation stack that includes both AWS resources and third-party resources. Which approach enables this?
A. Use CloudFormation custom resources for third-party
B. Register third-party resources in CloudFormation Registry
C. Use separate stacks with dependencies
D. Both A and B
Answer: D
Explanation:
Both custom resources and Registry support third-party resources.
Why A is partially correct: Custom resources can provision any resource via Lambda.
Why B is partially correct: CloudFormation Registry allows registering third-party resource types (e.g., Datadog monitors, MongoDB clusters).
Why C is incorrect: Separate stacks don't integrate third-party resources into CloudFormation.
Why D is correct: Both approaches work:
Custom resources: Flexible, one-off integrations
Registry: Reusable, first-class resource types
Question 116
A company uses AWS Control Tower with multiple accounts. They need to grant temporary elevated access to developers for troubleshooting. Which approach should be used?
A. Modify SCPs temporarily
B. Use IAM Identity Center (SSO) with temporary permission sets
C. Create temporary IAM users in each account
D. Disable guardrails during troubleshooting
Answer: B
Explanation:
IAM Identity Center provides temporary elevated access.
Why A is incorrect: Modifying SCPs affects all users and requires change management.
Why B is correct: IAM Identity Center (AWS SSO):
Create elevated permission set
Assign temporarily to users/groups
Access expires automatically
Audit trail maintained
No credential sharing
Why C is incorrect: Creating IAM users is manual and credentials must be managed.
Why D is incorrect: Disabling guardrails violates compliance and security.
Question 117
A DevOps engineer is using CloudFormation and needs to ensure that resources are created in a specific order with sufficient time for each to stabilize. Which approach should be used?
A. DependsOn with manual delays
B. CreationPolicy with cfn-signal and DependsOn
C. WaitCondition between resource groups
D. Stack sets with sequential deployment
Answer: B
Explanation:
CreationPolicy with cfn-signal ensures resources are ready before dependents start.
Why A is incorrect: Manual delays in scripts are unreliable.
Why B is correct: Proper pattern:
Resource A with CreationPolicy waits for cfn-signal
cfn-signal sent when A is fully configured
Resource B has DependsOn Resource A
B starts only after A signals completion
Why C is incorrect: WaitConditions are more complex; CreationPolicy is sufficient for EC2/ASG.
Why D is incorrect: StackSets are for multi-account, not ordering within a single stack.
Question 118
A company needs to enforce that all Secrets Manager secrets have automatic rotation enabled. Which approach provides preventive enforcement?
A. AWS Config rule checking rotation status
B. CloudFormation Hook validating secrets configuration
C. IAM policy denying secret creation without rotation
D. SCP restricting Secrets Manager actions
Answer: B
Explanation:
CloudFormation Hooks provide preventive validation during stack operations.
Why A is incorrect: Config rules are detective, not preventive.
Why B is correct: CloudFormation Hook:
Validates AWS::SecretsManager::Secret resources
Checks for RotationSchedule association
Fails stack creation if missing
Preventive control
Why C is incorrect: IAM policies can't inspect resource properties like rotation configuration.
Why D is incorrect: SCPs can't inspect resource properties.
Question 119
A DevOps engineer is implementing drift detection for CloudFormation stacks. They want to be notified when drift is detected. How should this be automated?
A. Schedule drift detection and use EventBridge for notifications
B. Enable continuous drift detection in CloudFormation
C. Use AWS Config to monitor CloudFormation resources
D. Create CloudWatch alarms on CloudFormation metrics
Answer: A
Explanation:
Scheduled drift detection with EventBridge provides automated notifications.
Why B is incorrect: CloudFormation doesn't have built-in continuous drift detection.
Why C is incorrect: Config monitors resource configurations but doesn't detect CloudFormation drift specifically.
Why D is incorrect: CloudFormation doesn't publish drift metrics to CloudWatch.
Question 120
A company uses CloudFormation nested stacks. They want to update only specific child stacks without updating the entire parent stack. Is this possible?
A. Yes, update child stacks directly using their stack ID
B. No, nested stacks can only be updated through parent
C. Yes, use StackSets to update specific stacks
D. Yes, if the child stack was exported
Answer: B
Explanation:
Nested stacks are managed through their parent stack.
Why A is incorrect: While you can technically update a nested stack directly, this is not recommended and can cause state inconsistency.
Why B is correct: Best practice:
Nested stacks should only be updated via parent
Parent maintains the relationship and state
Direct updates cause drift between parent's expected state and actual state
CloudFormation may not handle future parent updates correctly
Why C is incorrect: StackSets are for multi-account deployment, not nested stack management.
Why D is incorrect: Exports don't change how nested stacks should be updated.
Question 121
A DevOps engineer needs to implement infrastructure changes that require zero-downtime for a web application running on EC2 behind an ALB. Which CloudFormation approach should be used?
A. UpdatePolicy with AutoScalingRollingUpdate
B. CodeDeploy blue-green deployment
C. CloudFormation stack update with change set
D. Create new stack, switch DNS, delete old stack
Answer: A
Explanation:
AutoScalingRollingUpdate provides zero-downtime updates for Auto Scaling groups.
Why A is correct: UpdatePolicy with AutoScalingRollingUpdate:
Why B is incorrect: CodeDeploy blue-green is for application deployments, not infrastructure changes.
Why C is incorrect: Standard stack update doesn't guarantee zero-downtime.
Why D is incorrect: Manual process with DNS switching adds operational complexity.
Question 122
A company uses AWS Systems Manager Parameter Store with thousands of parameters. They need to organize parameters hierarchically and retrieve related parameters efficiently. Which feature should be used?
A. Parameter Store tags
B. Parameter Store hierarchies with path prefixes
C. Parameter Store advanced parameters
D. Parameter Store policies
Answer: B
Explanation:
Parameter hierarchies enable organization and bulk retrieval.
Why A is incorrect: Tags help organize but don't provide hierarchical retrieval.
Why B is correct: Hierarchical parameters:
Use path prefixes: /myapp/prod/database/password
Retrieve by path: GetParametersByPath(/myapp/prod/)
Recursive retrieval available
Clear organization structure
Efficient bulk operations
Why C is incorrect: Advanced parameters provide larger size and policies, not organization.
Why D is incorrect: Parameter policies are for TTL and notifications, not organization.
Question 123
A DevOps engineer needs to create a CloudFormation template that installs software on EC2 instances using Chef recipes. Which approach should be used?
A. Use cfn-init with AWS::CloudFormation::Init
B. Use AWS OpsWorks integration
C. Use Systems Manager State Manager with Chef documents
D. All of the above
Answer: D
Explanation:
Multiple approaches support Chef-based configuration.
Why A is partially correct: cfn-init supports files, commands, and packages but limited Chef support.
Why B is partially correct: OpsWorks provides full Chef integration through layers.
Why C is partially correct: State Manager supports Chef (Policy documents with Chef recipe execution).
Why D is correct: All approaches work:
cfn-init: Lightweight, built into CloudFormation
OpsWorks: Full Chef lifecycle management
State Manager: Ongoing configuration enforcement
Choice depends on requirements.
Question 124
A company needs to implement compliance checks for resources that are not supported by AWS Config managed rules. Which approach should be used?
A. Request AWS to add the managed rule
B. Create custom Config rules with Lambda
C. Use AWS Audit Manager instead
D. Implement checks in CloudTrail
Answer: B
Explanation:
Custom Config rules evaluate any resource configuration.
Why A is incorrect: While you can request features, it's not a solution for immediate needs.
Why B is correct: Custom Config rules:
Lambda function performs evaluation
Receives configuration items
Returns compliance status
Works with any AWS resource type
Can implement any compliance logic
Why C is incorrect: Audit Manager uses evidence collection but relies on Config for resource compliance.
Why D is incorrect: CloudTrail logs API calls, not resource compliance.
Question 125
A DevOps engineer is using CloudFormation StackSets with AWS Organizations. They want to automatically deploy stacks to new accounts when they're added to the organization. Which setting enables this?
A. Enable auto-deployment in StackSets
B. Create an EventBridge rule for account creation
C. Use Control Tower Account Factory
D. Configure Organizations with automatic StackSet enrollment
Answer: A
Explanation:
StackSets auto-deployment handles new accounts automatically.
Why A is correct: StackSets auto-deployment:
Enable when creating/updating StackSet
Specify OUs for automatic deployment
New accounts in target OUs get stacks automatically
Supports retain stacks on account leave option
Why B is incorrect: EventBridge could trigger deployment but StackSets handles this natively.
Why C is incorrect: Account Factory creates accounts but StackSets handles deployment.
Why D is incorrect: The setting is in StackSets, not Organizations.
Question 126
A company uses CloudFormation with cross-stack references using Exports and Imports. They find they cannot delete a stack because another stack depends on its export. How should this be resolved?
A. Force delete the stack
B. Remove the import from the dependent stack first
C. Disable the export before deleting
D. Use Stack Policies to override the dependency
Answer: B
Explanation:
Export dependencies must be removed before stack deletion.
Why A is incorrect: Force delete is not available. CloudFormation prevents deletion with active exports.
Why B is correct: Resolution steps:
Identify stacks importing the value (describe-stack-resource-drift or CloudFormation console)
Update importing stacks to remove the !ImportValue
Delete the exporting stack
Alternatively, update importing stacks to use different values.
Why C is incorrect: You can't disable an export while stacks depend on it.
Why D is incorrect: Stack Policies don't control cross-stack dependencies.
Question 127
A DevOps engineer needs to implement a solution where EC2 instances report their configuration compliance status to a central dashboard. Which approach should be used?
A. AWS Config with Config Aggregator
B. AWS Systems Manager Compliance
C. Amazon Inspector with central reporting
D. Both A and B
Answer: D
Explanation:
Both Config and SSM provide compliance reporting.
Why A is partially correct: Config evaluates resource configurations against rules.
Why B is partially correct: SSM Compliance shows:
Patch compliance
State Manager association compliance
Custom compliance data
Why C is incorrect: Inspector is for vulnerability scanning, not general configuration compliance.
A company wants to use CloudFormation to manage resources in multiple AWS accounts and regions. They need centralized control with automatic rollback if deployment fails in any region. Which approach should be used?
A. CloudFormation StackSets with failure tolerance settings
B. CodePipeline with cross-account actions
C. Step Functions orchestrating CloudFormation
D. Custom Lambda function managing stacks
Answer: A
Explanation:
StackSets provide centralized multi-account/region deployment with rollback.
Why A is correct: StackSets features:
Deploy to multiple accounts/regions
Failure tolerance configuration
Automatic rollback on failure
Regional failure tolerance (failures allowed per region)
Account failure tolerance
Maximum concurrent deployments
Why B is incorrect: CodePipeline can do cross-account but doesn't have built-in multi-region rollback coordination.
Why C is incorrect: Step Functions would require significant custom development.
Why D is incorrect: Custom Lambda requires building all functionality StackSets provides.
Question 129
A DevOps engineer is implementing AWS Config remediation. The remediation action should only execute during business hours. How should this be configured?
A. Use EventBridge scheduler with Config rule
B. Configure remediation with SSM Maintenance Window
C. Set up manual remediation and schedule execution
D. Config remediation doesn't support scheduling
Answer: C
Explanation:
Config automatic remediation doesn't have native scheduling.
Why A is incorrect: EventBridge can trigger on Config events but can't selectively block automatic remediation by time.
Why B is incorrect: Config remediation uses SSM Automation but doesn't integrate with Maintenance Windows for scheduling.
Why C is correct: For time-based remediation:
Set remediation to manual mode
Create scheduled process (EventBridge + Lambda) that:
Runs during business hours
Finds non-compliant resources
Triggers remediation for each
Or use SSM Automation with business hours logic
Why D is correct understanding: Automatic remediation runs immediately on detection; scheduling requires workarounds.
Question 130
A company uses CloudFormation and wants to enable developers to see estimated costs before deploying. Which feature should be used?
A. CloudFormation cost estimation in change sets
B. AWS Cost Explorer integration
C. CloudFormation template validation
D. AWS Pricing Calculator API
Answer: A
Explanation:
Change sets can include cost estimates.
Why A is correct: CloudFormation supports cost estimation:
Create change set with --include-nested-stacks (optional)
Console shows estimated monthly cost for resources
Helps decision-making before deployment
Why B is incorrect: Cost Explorer shows actual costs, not estimates for new resources.
Why C is incorrect: Template validation checks syntax, not costs.
Why D is incorrect: While Pricing Calculator could estimate costs, CloudFormation has built-in estimation.
Question 131
A DevOps engineer needs to ensure that all EC2 instances created via CloudFormation are encrypted at rest. Which approach provides preventive enforcement?
A. AWS Config rule checking EBS encryption
B. CloudFormation Hook validating encryption settings
C. Enable EBS encryption by default
D. Both B and C
Answer: D
Explanation:
Multiple approaches ensure encryption.
Why A is incorrect: Config rules are detective, not preventive.
Why B is partially correct: Hooks validate CloudFormation resources before creation.
Why C is partially correct: EBS encryption by default encrypts all new EBS volumes regardless of how they're created.
Why D is correct: Defense in depth:
EBS encryption by default: Catches all EBS volumes
CloudFormation Hook: Explicit validation for CloudFormation deployments
Both together ensure comprehensive coverage.
Question 132
A company uses AWS Organizations with Service Control Policies. They want to allow CloudFormation in all accounts but restrict which resource types can be created. How should this be implemented?
A. Create IAM policies in each account restricting resource types
B. Use SCP with conditions on CloudFormation actions
C. Use CloudFormation Hooks to block resource types
D. SCPs cannot restrict CloudFormation resource types
Answer: D
Explanation:
SCPs cannot restrict specific CloudFormation resource types.
Why A is incorrect: While IAM policies can restrict, they can be overridden by account admins.
Why B is incorrect: SCPs work at the API level (cloudformation:CreateStack) but cannot inspect which resource types are in templates.
Why C is incorrect: Hooks can validate resource types but are not SCP-based.
Why D is correct: SCPs have limitations:
Cannot inspect CloudFormation template contents
Cannot restrict based on resource types being created
Can only allow/deny CloudFormation API actions
For resource type restrictions, use CloudFormation Hooks or IAM policies on the service APIs (e.g., ec2:RunInstances).
Question 133
A DevOps engineer is troubleshooting why SSM Run Command is timing out. The command targets multiple instances but some are not responding. What should be checked?
A. Instance security group inbound rules
B. SSM Agent status and network connectivity
C. CloudWatch Agent configuration
D. IAM user permissions
Answer: B
Explanation:
SSM Agent and networking are the primary troubleshooting areas.
Why A is incorrect: SSM uses outbound connections; inbound rules don't affect SSM.
Why B is correct: Run Command troubleshooting:
SSM Agent running and healthy
Agent can reach SSM endpoints (internet or VPC endpoints)
Instance profile has SSM permissions
No proxy/firewall blocking HTTPS to SSM
Check SSM Fleet Manager or instance SSM status.
Why C is incorrect: CloudWatch Agent is separate from SSM Agent.
Why D is incorrect: User permissions affect who can run commands, not whether instances respond.
Question 134
A company needs to deploy different versions of an application to different environments using the same CloudFormation template. The template should select the correct Lambda function code based on environment. Which approach should be used?
A. Use Mappings for environment-specific S3 paths
B. Use Parameters with S3 bucket and key
C. Use Conditions to create different Lambda functions
D. Both A and B are valid
Answer: D
Explanation:
Both Mappings and Parameters can handle environment-specific code selection.
Why C is incorrect: Creating different Lambda functions adds complexity; better to use same function with different code.
Why D is correct: Both are valid:
Mappings: Built-in, no user input needed
Parameters: Flexible, user-controlled
Question 135
A DevOps engineer needs to implement a solution where CloudFormation stack outputs are automatically stored in SSM Parameter Store for use by other stacks. How should this be implemented?
A. Use CloudFormation Exports instead
B. Create a Custom Resource that writes outputs to Parameter Store
C. Use CloudFormation Registry with custom resource type
D. Both B and C
Answer: D
Explanation:
Custom resources or registered resource types can write to Parameter Store.
Why A is incorrect: Exports work but have limitations (can't update, can't delete if referenced). Parameter Store is more flexible.
Why B is partially correct: Lambda-backed custom resource:
Receives stack outputs
Writes to Parameter Store
Handles create/update/delete
Why C is partially correct: Register a custom resource type in CloudFormation Registry that writes to Parameter Store.
Why D is correct: Both approaches work:
Custom resource: Quick to implement for specific needs
Registry: Reusable across stacks and accounts
Question 136
A company uses AWS Config to monitor compliance. They want to see compliance trends over time. Which feature should be used?
A. AWS Config dashboard
B. AWS Config timeline
C. AWS Security Hub with Config integration
D. AWS Config advanced queries with historical data
Answer: D
Explanation:
Advanced queries can query historical configuration data.
Why A is incorrect: Config dashboard shows current compliance, not trends.
Why B is incorrect: Config timeline shows individual resource configuration history, not aggregate trends.
Why C is incorrect: Security Hub aggregates findings but Config provides the historical data.
Why D is correct: Advanced queries:
Query configuration recorder data
Include historical configurations
Aggregate compliance data over time
Export to S3 for trend analysis
Also, Config conformance pack data can be exported for trending.
Question 137
A DevOps engineer is creating a CloudFormation template with multiple Lambda functions. Each function needs the same environment variables. How should this be implemented efficiently?
A. Define environment variables in each function
B. Use CloudFormation Mappings for environment variables
C. Use !Sub with a local variable block
D. Create reusable YAML anchors (not supported), use Mappings
Answer: B
Explanation:
Mappings centralize repeated values.
Why A is incorrect: Duplicating values in each function creates maintenance burden.
Why A is incorrect: Change sets require manual execution but don't track approvals or integrate with change management.
Why B is correct: CodePipeline with manual approval:
Approval action between stages
Approver identity recorded
Comments can be added
Integration with SNS for notifications
Audit trail in pipeline history
Why C is incorrect: Termination protection prevents deletion but isn't change management.
Why D is incorrect: Service Catalog is for self-service provisioning, not change approval.
Question 139
A DevOps engineer is implementing AWS Systems Manager Patch Manager. They need to create a patch baseline that includes patches from multiple classifications. How should this be configured?
A. Create multiple patch baselines and merge them
B. Configure a single baseline with multiple patch classification rules
C. Use patch groups to combine baselines
D. Patch baselines only support one classification
Answer: B
Explanation:
Patch baselines support multiple classification rules.
Why A is incorrect: Baselines can't be merged; use rules within a baseline.
Why B is correct: Patch baseline configuration:
Multiple approval rules
Each rule can specify:
Patch classifications (Security, Bugfix, etc.)
Severities (Critical, Important, etc.)
Auto-approval delay
Combine multiple rules for comprehensive patching
Why C is incorrect: Patch groups associate instances with baselines but don't combine baselines.
Why D is incorrect: Baselines support multiple classifications through rules.
Question 140
A company uses CloudFormation nested stacks. The deployment fails because a nested stack timeout is exceeded. How can the timeout be increased?
A. Set Timeout property on AWS::CloudFormation::Stack resource
B. Use CreationPolicy with extended timeout
C. Nested stacks use parent stack timeout automatically
D. Increase timeout using AWS CLI when creating parent stack
Answer: D
Explanation:
Stack timeout is set at creation time via CLI/API.
Why A is incorrect: AWS::CloudFormation::Stack resource doesn't have a Timeout property.
Why B is incorrect: CreationPolicy timeout is for resource signal waiting, not overall stack timeout.
Why C is incorrect: Nested stacks have their own timeout but inherit from stack creation parameters.
Why D is correct: Timeout is specified when creating the stack:
AWS CLI: --timeout-in-minutes
Default: 60 minutes
Applies to the entire stack operation including nested stacks
Set appropriate timeout for complex deployments
Question 141
A DevOps engineer needs to implement a solution that automatically updates CloudFormation stack parameters based on external events (e.g., new AMI published). Which approach should be used?
A. EventBridge rule triggering Lambda to update stack
B. CloudFormation Registry with event subscription
C. AWS Config remediation to update parameters
D. SSM Automation runbook triggered by events
Answer: A
Explanation:
EventBridge with Lambda provides event-driven stack updates.
Why A is correct: Pattern:
EventBridge receives event (e.g., EC2 AMI creation)
Lambda function triggered
Lambda updates SSM Parameter with new AMI ID
Lambda triggers CloudFormation stack update
Stacks using dynamic references get new AMI on next update
Why B is incorrect: CloudFormation Registry doesn't have event subscription features.
Why C is incorrect: Config remediation is for compliance, not parameter updates.
Why D is incorrect: SSM Automation could work but Lambda is simpler for this use case.
Question 142
A company uses AWS Service Catalog and wants to track which users launched which products. Which feature provides this capability?
A. Service Catalog provisioned product tags
B. CloudTrail logging of Service Catalog API calls
C. AWS Config tracking of Service Catalog products
D. Both A and B
Answer: D
Explanation:
Multiple mechanisms track Service Catalog usage.
Why A is partially correct: Service Catalog adds tags to provisioned products:
aws:servicecatalog:provisionedProductArn
aws:servicecatalog:productArn
Custom tags from TagOptions
Why B is partially correct: CloudTrail logs:
ProvisionProduct calls
User identity
Product and portfolio IDs
Timestamps
Why C is incorrect: Config tracks resource configurations but not specifically Service Catalog provisioning metadata.
Why D is correct: Combined:
CloudTrail: Who, when, which product
Tags: Identify resources as Service Catalog provisioned
Question 143
A DevOps engineer is implementing CloudFormation drift detection. They want to automatically remediate drift when detected. Which approach should be used?
A. Enable auto-remediation in drift detection settings
B. Use EventBridge to trigger Lambda on drift detection events
C. Configure AWS Config rule for CloudFormation resources
D. Drift detection doesn't support auto-remediation
Answer: B
Explanation:
EventBridge can trigger remediation on drift detection events.
Why A is incorrect: CloudFormation drift detection doesn't have built-in auto-remediation.
Why B is correct: Remediation pattern:
Detect drift (scheduled or manual)
CloudFormation sends event to EventBridge
EventBridge triggers Lambda
Lambda can:
Trigger stack update to reapply template
Alert for manual remediation
Log drift details
Why C is incorrect: Config rules evaluate resource configurations but don't detect CloudFormation drift specifically.
Why D is incorrect: While drift detection doesn't have built-in remediation, it can be implemented via EventBridge.
Question 144
A company needs to implement CloudFormation templates that create resources only in specific Availability Zones. How should this be implemented?
A. Use Mappings with AZ-specific values
B. Use Fn::GetAZs with selection logic
C. Hardcode Availability Zone names
D. Both A and B
Answer: B
Explanation:
Fn::GetAZs retrieves AZs for the current region.
Why A is incorrect: Mappings would need entries for all regions and AZs, complex to maintain.
Why B is correct: Fn::GetAZs approach:
yaml
AvailabilityZone: !Select
- 0
- !GetAZs ''
Returns list of AZs for the region
Use !Select to pick specific AZs
Works across regions automatically
Why C is incorrect: Hardcoding AZ names (us-east-1a) breaks portability.
Why D is incorrect: Fn::GetAZs alone is sufficient and more maintainable.
Question 145
A DevOps engineer is using AWS CDK and wants to ensure constructs follow organizational standards. Which CDK feature should be used?
A. CDK Aspects for validation
B. CDK Context for configuration
C. CDK Bootstrap for standards
D. CDK Pipelines for governance
Answer: A
Explanation:
Aspects provide validation capabilities across the construct tree.
Why A is correct: CDK Aspects:
Implement IAspect interface
Visit all constructs during synthesis
Add validations, annotations, or modifications
Example: Validate all S3 buckets have encryption enabled
Why B is incorrect: Context provides runtime configuration, not validation.
Why C is incorrect: Bootstrap sets up CDK deployment resources, not organizational standards.
Why D is incorrect: CDK Pipelines orchestrates deployment but doesn't enforce standards on constructs.
Question 146
A company uses AWS Systems Manager Session Manager and wants to log all session activity for compliance. Which configuration is required?
A. Enable Session Manager logging to CloudWatch Logs
B. Enable CloudTrail data events for Systems Manager
C. Configure Session Manager preferences with logging
D. Both A and C
Answer: D
Explanation:
Session Manager supports logging to multiple destinations.
Why A is partially correct: CloudWatch Logs captures session data if configured.
Why B is incorrect: CloudTrail logs API calls (StartSession) but not session content.
Why C is partially correct: Session Manager preferences configure:
CloudWatch Logs logging
S3 logging
Encryption settings
Idle timeout
Why D is correct: Complete logging setup:
Configure Session Manager preferences (C)
Enable logging destination (A or S3)
KMS encryption for security
Log group/bucket retention policies
Question 147
A DevOps engineer needs to create a CloudFormation template where the resource logical ID needs to be dynamic based on a parameter. Is this possible?
A. Yes, use !Sub in the logical ID
B. Yes, use a CloudFormation macro to generate logical IDs
C. No, logical IDs must be static in the template
D. Yes, use Mappings to define logical IDs
Answer: B
Explanation:
Macros can dynamically generate template content including logical IDs.
Why A is incorrect: Intrinsic functions cannot be used in logical IDs directly.
Why B is correct: CloudFormation macros:
Process template before resource creation
Can modify any part of the template
Can generate dynamic logical IDs
Use Transform to invoke macro
Why C is partially correct: Without macros, logical IDs must be static.
Why D is incorrect: Mappings provide values, not logical ID names.
Question 148
A company is using AWS Config Aggregator to collect data from multiple accounts. They want to delegate the aggregator administration to a different account. How should this be configured?
A. Register a delegated administrator for Config in Organizations
B. Share the aggregator using AWS RAM
C. Create IAM roles in the delegated account
D. Aggregators cannot be delegated
Answer: A
Explanation:
AWS Organizations supports delegated administrators for Config.
Why A is correct: Delegated administrator:
Management account registers delegated admin
Delegated account can manage Config Aggregators
Maintains separation of duties
Uses Organizations integration
Why B is incorrect: AWS RAM shares resources but Config Aggregator delegation uses Organizations.
Why C is incorrect: IAM roles don't delegate aggregator management.
Why D is incorrect: Delegation is supported via Organizations.
Question 149
A DevOps engineer is implementing a solution where CloudFormation stack updates should only proceed if canary instances pass health checks. Which approach should be used?
A. UpdatePolicy with AutoScalingRollingUpdate and WaitOnResourceSignals
B. CloudFormation rollback triggers with CloudWatch alarms
C. CodeDeploy with canary deployment configuration
D. Both A and B
Answer: D
Explanation:
Multiple approaches provide health check-based update control.
Why A is partially correct: WaitOnResourceSignals:
Updates wait for cfn-signal from each instance
Signal sent after health check passes
Failed signals cause rollback
Why B is partially correct: Rollback triggers:
Monitor CloudWatch alarms during update
Alarm triggers automatic rollback
Can check application metrics
Why C is incorrect: CodeDeploy handles application deployment, not infrastructure updates.
Why D is correct: Combined approach:
WaitOnResourceSignals for instance-level health
Rollback triggers for application-level health
Defense in depth
Question 150
A company uses CloudFormation and wants to implement a policy that all stacks must be deployed through a CI/CD pipeline. Direct console deployments should be blocked. How should this be enforced?
A. Remove cloudformation:* permissions from all users
B. Use IAM policy conditions requiring source IP from pipeline
C. Use IAM policy requiring specific CloudFormation service role
D. Implement SCP blocking console access
Answer: C
Explanation:
Service role requirements ensure deployment through controlled channels.
Why A is incorrect: Removes all CloudFormation access, preventing legitimate pipeline operations.
Why B is incorrect: Pipeline agents might have dynamic IPs; not reliable.
Why C is correct: Service role approach:
Allow cloudformation:* only with service role
Service role only assumable by pipeline role
Console users can't provide service role
Policy condition: cloudformation:RoleArn must be pipeline role
Why D is incorrect: SCPs can't distinguish console vs. API deployments effectively.
Question 151
A DevOps engineer needs to create a CloudFormation template that references secrets from AWS Secrets Manager in a different AWS account. How should this be configured?
A. Use cross-account dynamic references
B. Create a custom resource that retrieves secrets cross-account
Why A is incorrect: Dynamic references work within the same account only.
Why B is correct: Cross-account secret access:
Lambda function with cross-account role assumption
Custom resource in CloudFormation
Lambda retrieves secret from other account
Returns value for use in template
Secret account grants access via resource policy
Why C is incorrect: Replication adds complexity; custom resource is simpler for occasional access.
Why D is correct understanding: CloudFormation dynamic references don't natively support cross-account.
Question 152
A company uses AWS Config and wants to exclude certain resource types from evaluation by all rules. How should this be configured?
A. Modify each Config rule to exclude the resource type
B. Configure the Config Recorder to not record those resource types
C. Create an SCP preventing evaluation
D. Use AWS Config exclusions feature
Answer: B
Explanation:
Config Recorder controls which resources are tracked.
Why A is incorrect: Modifying each rule is not efficient and doesn't prevent recording.
Why B is correct: Config Recorder settings:
Choose specific resource types to record
Unrecorded resources aren't evaluated by rules
Reduces costs for unnecessary resource types
Single configuration for all rules
Why C is incorrect: SCPs can't control Config evaluation.
Why D is incorrect: Config doesn't have a general exclusions feature for rules.
Question 153
A DevOps engineer is implementing CloudFormation StackSets for a multi-account environment. They want to use a delegated administrator account instead of the management account. What must be configured?
A. Register the account as a delegated administrator for CloudFormation StackSets
B. Create cross-account roles manually
C. Enable Organizations trusted access for CloudFormation StackSets
Why A is partially correct: The account must be registered as delegated admin.
Why B is incorrect: Service-managed permissions handle role creation automatically.
Why C is partially correct: Trusted access must be enabled for StackSets.
Why D is correct: Complete setup:
Enable trusted access for CloudFormation StackSets in Organizations
Register delegated administrator account
Delegated account can now manage StackSets
Management account retains ability to deregister.
Question 154
A company uses AWS Systems Manager Automation and needs to implement a runbook that pauses for human approval before continuing. Which action should be used?
A. aws:pause
B. aws:approve
C. aws:waitForApproval
D. aws:manual
Answer: B
Explanation:
aws:approve pauses automation for manual approval.
Why A is incorrect: aws:pause pauses for a duration, not for approval.
Why B is correct: aws:approve action:
Pauses automation execution
Sends notifications (SNS)
Waits for approve/reject response
Supports timeout
Multiple approvers supported
Why C is incorrect: Not a valid SSM Automation action.
Why D is incorrect: Not a valid SSM Automation action.
Question 155
A DevOps engineer needs to ensure that all CloudFormation stacks in production have termination protection enabled. Which approach provides preventive enforcement?
A. AWS Config rule checking termination protection
B. CloudFormation Hook validating stack settings
C. IAM policy requiring termination protection
D. SCP blocking stack deletion
Answer: C
Explanation:
IAM can enforce termination protection on stack creation.
Why A is incorrect: Config rules are detective, not preventive.
Why B is incorrect: CloudFormation Hooks validate resources in templates, not stack-level settings like termination protection.
Stacks must be created with termination protection.
Why D is incorrect: Blocking deletion is different from requiring termination protection on creation.
Question 156
A company uses CloudFormation and wants to implement a naming convention for all resources created. Which approach should be used?
A. Use CloudFormation resource naming properties
B. Let CloudFormation auto-generate names with stack name prefix
C. Create a CloudFormation macro that adds name tags
D. All of the above
Answer: D
Explanation:
Multiple approaches support naming conventions.
Why A is partially correct: Explicitly set Name properties where supported.
Why B is partially correct: CloudFormation auto-generates names like: stackname-logicalid-randomsuffix
Why C is partially correct: Macros can enforce naming by modifying resources.
Why D is correct: Best practices:
Use auto-generated names for uniqueness
Add Name tags for readability
Macros for organization-wide enforcement
Combine approaches as needed
Question 157
A DevOps engineer is using AWS CDK and needs to deploy the same stack to multiple stages (dev, staging, prod) with different configurations. Which CDK pattern should be used?
A. CDK Stacks with environment-specific props
B. CDK Pipelines with multiple stages
C. CDK Context for environment selection
D. All of the above
Answer: D
Explanation:
CDK supports multiple patterns for multi-stage deployments.
Why A is partially correct: Pass different props for each environment:
typescript
new MyStack(app, 'DevStack', { environment: 'dev' });
new MyStack(app, 'ProdStack', { environment: 'prod' });
Why B is partially correct: CDK Pipelines:
Define stages for each environment
Automatic deployment progression
Manual approvals between stages
Why C is partially correct: Context values per environment:
bash
cdk deploy -c environment=prod
Why D is correct: All patterns are valid; choice depends on requirements.
Question 158
A company needs to track configuration changes to CloudFormation stacks themselves (not just the resources). Which service provides this?
A. AWS CloudTrail
B. AWS Config with stack recording
C. CloudFormation Stack Events
D. Both A and B
Answer: D
Explanation:
Multiple services track stack changes.
Why A is partially correct: CloudTrail logs:
CreateStack, UpdateStack, DeleteStack calls
Parameter values (if not NoEcho)
Who made changes
Why B is partially correct: AWS Config:
Records AWS::CloudFormation::Stack as resource type
Configuration changes tracked
Configuration timeline
Why C is incorrect: Stack Events show operation details but not historical comparison.
Why D is correct: Combined:
CloudTrail: API-level audit (who, when)
Config: Configuration change history (what changed)
Question 159
A DevOps engineer is implementing AWS Config remediation using SSM Automation. The remediation document needs parameters that vary per resource. How should this be configured?
A. Hardcode parameters in the automation document
B. Use resource-specific parameter mappings in Config remediation
C. Pass dynamic parameter values from Config rule evaluation
D. Config remediation doesn't support dynamic parameters
Why A is incorrect: Hardcoded parameters don't allow resource-specific values.
Why B is correct: Config remediation parameters:
Static values (same for all resources)
ResourceId (automatically passed)
ResourceType (automatically passed)
Resource-specific using AWS::Config::RemediationConfiguration parameters
Can reference resource ID and other attributes in automation document.
Why C is incorrect: Config rules evaluate compliance; parameters are configured in remediation configuration.
Why D is incorrect: Dynamic parameters are supported.
Question 160
A company uses CloudFormation with nested stacks. They want to reuse the same nested stack template across multiple parent stacks. How should the template be managed?
A. Store the template in S3 and reference the S3 URL in each parent
B. Copy the template content into each parent stack
C. Use CloudFormation Modules instead of nested stacks
D. Both A and C are valid approaches
Answer: D
Explanation:
Both S3-hosted templates and Modules support reuse.
Why A is partially correct: S3 template hosting:
Upload template to S3
Reference URL in AWS::CloudFormation::Stack
Version using S3 versioning
Single source of truth
Why B is incorrect: Copying creates maintenance issues and drift.
Why C is partially correct: CloudFormation Modules:
Register reusable templates
Use like native resource types
Better abstraction than nested stacks
Why D is correct: Both approaches work:
S3 templates: Simple, widely used
Modules: Better reuse semantics, versioning
Question 161
A DevOps engineer needs to implement a solution that automatically responds to Systems Manager Automation execution failures. Which approach should be used?
A. Configure onFailure in the automation document
B. Use EventBridge rules for Automation events
C. Enable CloudWatch Alarms on Automation metrics
D. Both A and B
Answer: D
Explanation:
Multiple mechanisms handle automation failures.
Why A is partially correct: onFailure in automation:
Specify action on failure: Abort, Continue, or step:stepName
Document-level handling
Why B is partially correct: EventBridge receives:
Automation execution state changes
Can trigger Lambda, SNS, etc.
External notification/remediation
Why C is incorrect: SSM Automation doesn't have standard CloudWatch metrics for failures.
Why D is correct: Combined approach:
onFailure: Internal failure handling
EventBridge: External notification and escalation
Question 162
A company wants to use AWS Service Catalog to enforce that all provisioned products use a specific VPC. Which constraint type should be used?
A. Launch constraint
B. Template constraint
C. Notification constraint
D. Resource constraint
Answer: B
Explanation:
Template constraints restrict parameter values.
Why A is incorrect: Launch constraints specify the IAM role, not parameter restrictions.
Why B is correct: Template constraints:
Restrict parameter values users can enter
Can specify allowed VPC IDs
Enforce compliance through constraint rules
JSON-based constraint definition
Why C is incorrect: Notification constraints configure SNS notifications.
Why D is incorrect: "Resource constraint" is not a Service Catalog constraint type.
Question 163
A DevOps engineer is using CloudFormation and needs to pass a large amount of configuration data to an EC2 instance. The data exceeds the UserData size limit. What approach should be used?
A. Split configuration across multiple UserData blocks
B. Store configuration in S3 and download in UserData
C. Use cfn-init with Metadata
D. Both B and C
Answer: D
Explanation:
Large configurations require external storage or cfn-init.
Why A is incorrect: UserData can't be split across blocks.
Why B is partially correct: S3 approach:
Store configuration files in S3
UserData downloads files
Use aws cli or curl
No size limit on S3 objects
Why C is partially correct: cfn-init approach:
Use AWS::CloudFormation::Init metadata
Define files, packages, commands
cfn-init retrieves from CloudFormation
Why D is correct: Both approaches work:
S3: Simple, flexible
cfn-init: CloudFormation-native, structured
Question 164
A company uses AWS Config Conformance Packs deployed across an AWS Organization. They want to know which accounts are not compliant. Which approach provides this visibility?
A. View conformance pack status in each account
B. Use AWS Config Aggregator with conformance pack data
C. Check Security Hub for conformance pack findings
Why A is incorrect: Checking each account is not scalable.
Why B is correct: Config Aggregator:
Aggregates compliance data from all accounts
Includes conformance pack status
Shows non-compliant rules and resources
Central dashboard
Why C is incorrect: Security Hub integrates with Config but doesn't show conformance pack status directly.
Why D is incorrect: Organizations doesn't have a compliance view for Config.
Question 165
A DevOps engineer is implementing a CloudFormation template with a custom resource. The custom resource Lambda function takes longer than 30 minutes to complete. What should be done?
A. Increase the Lambda timeout to accommodate
B. Use async custom resource pattern
C. Custom resources can't exceed Lambda timeout
D. Both A and B might be needed
Answer: D
Explanation:
Long-running custom resources require special handling.
Why A is partially correct: Lambda timeout is max 15 minutes, which may not be enough.
Why B is partially correct: Async pattern:
Lambda returns quickly with IN_PROGRESS
Background process continues work
Sends cfn-response when complete
Uses response URL from event
Why C is incorrect: Async patterns can exceed Lambda timeout.
Why D is correct: Long-running custom resources:
Use maximum Lambda timeout (15 min)
For longer tasks, use async pattern
Or use Step Functions for orchestration
Question 166
A company wants to ensure that AWS Systems Manager Run Command is only executed by authorized users and all commands are logged. Which configuration should be implemented?
A. IAM policies restricting Run Command and CloudTrail logging
B. Session Manager logging configuration
C. Run Command output logging to S3
D. Both A and C
Answer: D
Explanation:
Comprehensive Run Command governance requires IAM and logging.
Why A is partially correct: IAM controls who can run commands; CloudTrail logs API calls.
Why B is incorrect: Session Manager logging is for interactive sessions, not Run Command.
Why C is partially correct: Run Command output logging:
Configure S3 bucket for output
Full command output captured
Audit trail of what was executed
Why D is correct: Complete solution:
IAM: Authorization control
CloudTrail: Who ran what command (API level)
S3 output logs: What output was produced
Question 167
A DevOps engineer needs to create a CloudFormation template that creates different numbers of EC2 instances based on environment. Development needs 1 instance, production needs 4. Which approach should be used?
A. Use Count property on EC2 resource
B. Use CloudFormation Mappings with instance count
C. Use AutoScaling Group with variable DesiredCapacity
D. Duplicate EC2 resources with Conditions
Answer: C
Explanation:
Auto Scaling Groups provide variable instance counts.
Why A is incorrect: CloudFormation EC2 resources don't have a Count property.
Why B is incorrect: Mappings provide values but can't create variable numbers of resources.
Why D is incorrect: Duplicating resources with conditions is not scalable.
Question 168
A company uses AWS Config and needs to implement a custom rule that evaluates resource configurations using data from an external system. Which approach should be used?
A. Custom Config rule with Lambda that calls external API
B. AWS Config external evaluation mode
C. Push evaluations to Config from external system
D. Both A and C
Answer: D
Explanation:
Config supports both pull and push evaluation patterns.
Why A is partially correct: Lambda-based custom rule:
Lambda receives configuration item
Lambda calls external API for additional data
Returns compliance status
Why B is incorrect: There's no "external evaluation mode" in Config.
Why C is partially correct: External evaluation:
Use PutEvaluations API
External system determines compliance
Pushes evaluations to Config
Why D is correct: Both patterns work:
Lambda custom rule: Event-driven, AWS-managed
External push: Flexibility for complex systems
Question 169
A DevOps engineer is implementing CloudFormation drift detection for critical stacks. They want drift to be detected and reported automatically on a schedule. How should this be implemented?
A. Use CloudFormation built-in scheduled drift detection
B. Create EventBridge scheduled rule to trigger drift detection
C. Use AWS Config to monitor stack resources
D. Implement Lambda that periodically checks drift
Answer: B
Explanation:
EventBridge provides scheduling for drift detection.
Why A is incorrect: CloudFormation doesn't have built-in scheduled drift detection.
Why B is correct: Implementation pattern:
EventBridge scheduled rule (e.g., daily)
Target: Lambda function or Step Functions
Lambda calls detect-stack-drift
Wait for detection, then check results
Alert on drift detected
Why C is incorrect: Config tracks individual resource configurations but doesn't compare against CloudFormation templates.
Why D is similar to B: Lambda needs a trigger; EventBridge provides the schedule.
Question 170
A company uses AWS Control Tower and needs to customize the Account Factory to include additional resources when creating new accounts. Which approach should be used?
A. Modify Control Tower Account Factory templates
B. Use Customizations for AWS Control Tower (CfCT)
C. Create a separate StackSet for additional resources
D. Both B and C
Answer: D
Explanation:
Control Tower can be extended with customizations or StackSets.
Why A is incorrect: Account Factory templates shouldn't be directly modified.
Why B is partially correct: Customizations for Control Tower:
Extends Account Factory
Runs on account creation lifecycle events
Deploys additional CloudFormation templates
Why C is partially correct: StackSets with auto-deployment:
Deploy to OUs automatically
New accounts get stacks
Why D is correct: Both approaches work:
CfCT: Integrated with Control Tower lifecycle
StackSets: Independent, simpler setup
Question 171
A DevOps engineer needs to create a CloudFormation template that passes sensitive data to EC2 instances securely. The data should not be visible in the template or stack outputs. Which approach should be used?
A. Use NoEcho parameters
B. Use SSM SecureString with dynamic references
C. Use Secrets Manager with dynamic references
D. Both B and C
Answer: D
Explanation:
Dynamic references to secure storage protect sensitive data.
Why A is incorrect: NoEcho hides from display but values are still in CloudFormation.
Why B is partially correct: SSM SecureString:
Store sensitive data encrypted
Reference with {{resolve:ssm-secure:parameter-name}}
Value never in template
Why C is partially correct: Secrets Manager:
Store secrets with rotation
Reference with {{resolve:secretsmanager:secret-id}}
Value never in template
Why D is correct: Both approaches keep sensitive data out of CloudFormation:
SSM SecureString: Cost-effective
Secrets Manager: Rotation support
Question 172
A company is using AWS Systems Manager Patch Manager and wants to test patches on a subset of instances before deploying to all instances. Which feature supports this?
A. Patch baselines with approval delays
B. Patch groups with staged deployment
C. Maintenance Windows with phased targeting
D. All of the above
Answer: D
Explanation:
Multiple Patch Manager features support staged patching.
Why A is partially correct: Approval delays:
Delay patch approval by X days
Test baseline can have shorter delay
Prod baseline has longer delay
Why B is partially correct: Patch groups:
Assign instances to groups
Different groups use different baselines
Deploy to test group first
Why C is partially correct: Maintenance Windows:
Different windows for different groups
Stage deployment by window timing
Why D is correct: Combined strategies:
Patch groups for instance grouping
Maintenance Windows for timing
Baselines for approval rules
Question 173
A DevOps engineer is using CloudFormation and needs to create a template that includes resources that depend on the output of a Lambda function execution. Which approach should be used?
A. Use !GetAtt on the Lambda function
B. Create a custom resource backed by the Lambda function
C. Use Lambda invocation as a CloudFormation action
D. Reference Lambda outputs directly
Answer: B
Explanation:
Custom resources execute Lambda during stack operations.
Why A is incorrect: GetAtt on Lambda returns function attributes (Arn, etc.), not execution results.
Why B is correct: Custom resource pattern:
Define custom resource with Lambda ServiceToken
Lambda executes during stack create/update/delete
Lambda returns data in response
Other resources use !GetAtt CustomResource.Attribute
Why C is incorrect: CloudFormation doesn't have Lambda invocation actions.
Why D is incorrect: Lambda functions don't have outputs in CloudFormation.
Question 174
A company uses AWS Config and needs to aggregate compliance data from multiple Organizations. How should this be configured?
A. Create an aggregator for each Organization
B. Config aggregators can only aggregate within one Organization
C. Use AWS RAM to share aggregator across Organizations
D. Create a central account aggregator with individual account authorization
A DevOps engineer is implementing CloudFormation and needs to ensure that stack outputs are accessible to other stacks in different regions. How should this be implemented?
A. Use CloudFormation Exports
B. Store outputs in SSM Parameter Store and access cross-region
C. Use CloudFormation cross-region references
D. Exports don't work cross-region; use Parameter Store
Answer: D
Explanation:
CloudFormation Exports are region-specific.
Why A is incorrect: CloudFormation Exports only work within the same region.
Why B is correct approach: Parameter Store approach:
Stack writes outputs to Parameter Store
Other regions read from Parameter Store
Global parameters or replicated parameters
Why C is incorrect: CloudFormation doesn't have cross-region reference syntax.
Why D is correct: For cross-region sharing:
Store outputs in Parameter Store
Stacks in other regions reference via dynamic references
Or use custom resources to read cross-region
Question 176
A company uses AWS Service Catalog and wants to track all changes made to portfolios and products. Which approach should be used?
A. Enable CloudTrail for Service Catalog
B. Use AWS Config to track Service Catalog resources
C. Enable Service Catalog logging
D. Both A and B
Answer: D
Explanation:
Complete tracking requires CloudTrail and Config.
Why A is partially correct: CloudTrail logs:
API calls (CreateProduct, UpdatePortfolio, etc.)
Who made changes
When changes occurred
Why B is partially correct: AWS Config:
Records Service Catalog resource configurations
Tracks configuration changes over time
Timeline view
Why C is incorrect: Service Catalog doesn't have separate logging; uses CloudTrail.
Why D is correct: Combined:
CloudTrail: API audit trail
Config: Configuration change tracking
Question 177
A DevOps engineer needs to implement a CloudFormation template that creates resources only if they don't already exist. How should this be handled?
A. Use Conditions with parameter indicating resource existence
B. CloudFormation automatically handles existing resources
C. Use resource import functionality
D. Create a custom resource to check existence before creation
Answer: C
Explanation:
Resource import brings existing resources under CloudFormation management.
Why A is incorrect: Requires external logic to determine existence and pass parameter.
Why B is incorrect: CloudFormation fails if it tries to create a resource that already exists with the same name.
Why C is correct: Resource import:
For existing resources, use import operation
Template describes the resource
CloudFormation adopts without creating
Best practice for brownfield environments
Why D is incorrect: Complex and doesn't provide the management integration that import does.
Question 178
A company is using AWS Systems Manager and needs to run Ansible playbooks on managed instances. Which SSM feature should be used?
A. Run Command with AWS-RunAnsiblePlaybook document
B. State Manager with Ansible association
C. Automation with Ansible steps
D. Both A and B
Answer: D
Explanation:
SSM supports Ansible through multiple mechanisms.
Why A is partially correct: Run Command:
AWS-RunAnsiblePlaybook document
One-time or scheduled execution
Targets multiple instances
Why B is partially correct: State Manager:
Associates Ansible document with instances
Ensures configuration compliance
Runs on schedule
Why C is incorrect: Automation is for workflows, not direct Ansible execution.
Why D is correct: Both work:
Run Command: Ad-hoc execution
State Manager: Ongoing configuration enforcement
Question 179
A DevOps engineer is creating a CloudFormation template and needs to use the same value in multiple places. The value is a complex ARN. What is the BEST approach?
A. Repeat the ARN in each location
B. Use a Parameter with the ARN value
C. Define a local reference using YAML anchors
D. CloudFormation doesn't support local variables; use Parameters or custom resources
Answer: D
Explanation:
CloudFormation doesn't support local variables but has alternatives.
Why A is incorrect: Repetition creates maintenance issues and errors.
Why B is correct approach: Parameters can define reusable values:
Default value for the ARN
Reference with !Ref
Why C is incorrect: CloudFormation doesn't support YAML anchors for values.
Why D is correct: Options for reuse:
Parameters with defaults
Mappings for lookup values
Custom resources for computed values
!Sub with AWS resources for ARNs
Question 180
A company needs to ensure that all AWS accounts in their Organization have AWS Config enabled with the same configuration. Which approach should be used?
A. Manually enable Config in each account
B. Use AWS Organizations to deploy Config
C. Deploy Config using CloudFormation StackSets
D. Enable Config through Control Tower
Answer: C
Explanation:
StackSets provide consistent Config deployment.
Why A is incorrect: Manual deployment is not scalable and error-prone.
Why B is incorrect: Organizations doesn't directly deploy Config.
Why C is correct: StackSets approach:
Create Config deployment template
Deploy via StackSets to all accounts
Auto-deployment for new accounts
Consistent configuration
Why D is partially correct: Control Tower enables Config but with Control Tower's configuration. For custom Config setup, StackSets provides more control.
Question 181
A DevOps engineer needs to implement a solution where CloudFormation stack creation fails if certain resources cannot be created. How should this be configured?
A. Use DependsOn to ensure order
B. This is the default behavior; no configuration needed
C. Enable strict mode in stack settings
D. Use CreationPolicy on all resources
Answer: B
Explanation:
CloudFormation fails and rolls back on resource creation failure by default.
Why A is incorrect: DependsOn controls order but not failure behavior.
Why B is correct: Default behavior:
If any resource fails to create, stack creation fails
Automatic rollback of created resources
No special configuration needed
Why C is incorrect: There's no "strict mode" in CloudFormation.
Why D is incorrect: CreationPolicy is for waiting for signals, not for failure behavior.
Question 182
A company uses AWS Systems Manager Parameter Store and needs to be notified before parameters expire. Which feature should be configured?
A. Parameter Store notifications
B. Advanced parameters with parameter policies
C. CloudWatch Events for Parameter Store
D. AWS Config rules for parameter expiration
Answer: B
Explanation:
Parameter policies on advanced parameters provide expiration notifications.
Why A is incorrect: "Parameter Store notifications" is not a feature name.
Why B is correct: Parameter policies (advanced parameters):
Expiration policy with notification days
EventBridge events before expiration
NoChangeNotification for unchanged parameters
Automatic actions on expiration
Why C is incorrect: CloudWatch Events (EventBridge) receives the notifications but the source is parameter policies.
Why D is incorrect: Config rules evaluate compliance but don't provide expiration notifications.
Question 183
A DevOps engineer is implementing CloudFormation with modular templates. They want to share common resources (VPC, subnets) between application stacks without tight coupling. Which approach should be used?
A. Nested stacks with shared parent
B. Exports from infrastructure stack with Imports in application stacks
C. Parameter Store with infrastructure values
D. Both B and C
Answer: D
Explanation:
Multiple approaches support loose coupling.
Why A is incorrect: Nested stacks create tight coupling; shared parent updates affect all.
Why B is partially correct: Exports/Imports:
Infrastructure stack exports VPC, subnet IDs
Application stacks import values
Loose coupling but can't update exports if imported
Why C is partially correct: Parameter Store:
Infrastructure stack writes to Parameter Store
Application stacks read via dynamic references
Full flexibility, no export lock issues
Why D is correct: Both work with tradeoffs:
Exports: Native, dependency tracking
Parameter Store: More flexible, no lock issues
Question 184
A company uses AWS Config and needs to implement organization-wide compliance with automatic remediation. Which components are needed? (Select TWO)
A. AWS Config Organization Rules
B. AWS Config Remediation Actions
C. AWS Organizations SCP
D. CloudFormation StackSets
E. AWS Security Hub
Answer: A and B
Explanation:
Organization-wide compliance requires organization rules and remediation.
Why A is correct: Organization Rules:
Deploy rules across all accounts
Consistent compliance evaluation
Central management
Why B is correct: Remediation Actions:
Automatic or manual remediation
SSM Automation documents
Applied per rule
Why C is incorrect: SCPs restrict actions but don't provide compliance evaluation.
Why D is incorrect: StackSets deploy infrastructure but Config has native Organization Rules.
Why E is incorrect: Security Hub aggregates findings but doesn't provide Config remediation.
Question 185
A DevOps engineer is using CloudFormation to create EC2 instances with a specific configuration. The configuration script occasionally fails. How should the template be configured to handle transient failures?
A. Add retries in the configuration script
B. Use cfn-signal with failure handling
C. Configure CloudFormation to retry resource creation
Why B is incorrect: Hardcoding breaks reusability.
Why C is incorrect: Parameters are unnecessary; pseudo parameter provides this.
Why D is incorrect: Pseudo parameters work in tag values.
Question 187
A DevOps engineer is implementing AWS Config and needs to evaluate resources immediately when they're created, not just on schedule. Which evaluation trigger should be configured?
A. Periodic evaluation
B. Configuration change trigger
C. Manual trigger
D. EventBridge trigger
Answer: B
Explanation:
Configuration change trigger evaluates on resource changes.
Why A is incorrect: Periodic evaluation runs on schedule, not immediately.
Why B is correct: Configuration change trigger:
Evaluates when resource is created, updated, or deleted
Immediate compliance evaluation
Catches non-compliance at creation time
Why C is incorrect: Manual triggers require explicit invocation.
Why D is incorrect: Config rules are triggered by Config, not EventBridge directly.
Question 188
A company uses CloudFormation StackSets and needs to prevent stack instances from being deleted in specific accounts. Which feature should be used?
A. StackSet termination protection
B. Stack instance override with retain settings
C. SCP preventing DeleteStackInstances
D. Protected accounts configuration
Answer: B
Explanation:
Stack instance overrides can prevent deletion.
Why A is incorrect: Termination protection is for individual stacks, not StackSet instances.
Why B is correct: Stack instance settings:
Use StackInstancesGroup with overrides
Set RetainStacksOnAccountRemoval
Prevents deletion when removing from StackSet
Why C is incorrect: SCPs could block the action but overrides are the proper mechanism.
Why D is incorrect: "Protected accounts" is not a StackSet feature.
Question 189
A DevOps engineer needs to implement a CloudFormation solution that updates DNS records in Route 53 after an Application Load Balancer is created. Which approach should be used?
A. Use Route 53 resource with !GetAtt from ALB
B. Create a custom resource that updates Route 53
C. Route 53 alias record with ALB target
D. Both A and C
Answer: D
Explanation:
Route 53 resources can reference ALB attributes directly.
Why A is partially correct: CloudFormation Route 53 records:
Use !GetAtt ALB.DNSName
Use !GetAtt ALB.CanonicalHostedZoneID
Create records directly in template
Why B is incorrect: Custom resources add complexity when native resources work.
Why C is partially correct: Alias records:
Direct integration with ALB
No IP address needed
Automatic updates
Why D is correct: Both work:
AWS::Route53::RecordSet with alias to ALB
Uses GetAtt for ALB attributes
Question 190
A company uses AWS Systems Manager and needs to manage instances in multiple AWS accounts from a central account. Which feature enables this?
A. Cross-account IAM roles with SSM
B. SSM Resource Data Sync across accounts
C. AWS Organizations with SSM delegated administrator
Why A is incorrect: Timeline shows configuration changes over time, not relationships.
Why B is correct: Resource relationships:
Config console shows related resources
Visual relationship diagram
Shows connections (EC2 to VPC, to security groups, etc.)
Click-through navigation
Why C is incorrect: Advanced queries return data but not visual relationships.
Why D is incorrect: SSM Inventory collects instance data, not resource relationships.
Question 193
A DevOps engineer needs to implement a solution where CloudFormation stack updates are tested in a separate environment before production. Which approach should be used?
A. Use change sets to preview changes
B. Implement a separate test stack updated first
C. Use CloudFormation Stack Policies to protect production
D. All of the above
Answer: D
Explanation:
Multiple approaches provide safe update practices.
Why A is partially correct: Change sets:
Preview changes before execution
Review impact
Why B is partially correct: Separate test stack:
Apply changes to test first
Verify behavior
Then apply to production
Why C is partially correct: Stack Policies:
Protect critical production resources
Prevent accidental destructive updates
Why D is correct: Combined approach:
Test in lower environment first
Review change set in production
Stack policies as safety net
Question 194
A company uses AWS Service Catalog and needs to automate the process of updating products when new template versions are available. Which approach should be used?
A. Manually update products in Service Catalog
B. Use CodePipeline to update Service Catalog products
C. Service Catalog auto-updates from S3 template changes
D. Use AWS Service Catalog Sync with code repositories
Answer: B
Explanation:
CodePipeline can automate Service Catalog product updates.
Why A is incorrect: Manual updates are not automation.
Why B is correct: CodePipeline approach:
Source: CodeCommit with template
Action: Service Catalog deployment action
Updates product version automatically
Full CI/CD for infrastructure products
Why C is incorrect: Service Catalog doesn't auto-update from S3 template changes.
Why D is incorrect: While Service Catalog can sync with repos in some configurations, CodePipeline provides complete CI/CD.
Question 195
A DevOps engineer is implementing AWS Systems Manager and needs to ensure that all managed instances have the latest Systems Manager Agent. Which approach provides automated updates?
A. Create State Manager association with AWS-UpdateSSMAgent
B. Enable automatic updates in SSM Agent configuration
C. Use Patch Manager to patch SSM Agent
D. Both A and B
Answer: A
Explanation:
State Manager maintains SSM Agent version.
Why A is correct: State Manager association:
AWS-UpdateSSMAgent document
Schedule (daily, weekly)
Automatic updates applied
Compliance tracking
Why B is incorrect: SSM Agent doesn't have a global automatic update setting that's configurable.
Why C is incorrect: Patch Manager handles OS patches, not SSM Agent updates.
Why D is incorrect: Only State Manager approach (A) is the correct method.
Question 196
A company uses CloudFormation and needs to pass complex configuration data (nested objects) as a parameter. What is the correct approach?
A. Use AWS::CloudFormation::Stack parameters with nested objects
B. Pass JSON string as parameter and parse in template
C. CloudFormation parameters don't support complex objects; use other methods
D. Use CommaDelimitedList parameter type
Answer: C
Explanation:
CloudFormation parameters are limited to simple types.
Why A is incorrect: Stack parameters don't support nested objects.
Why B is incorrect: CloudFormation can't parse JSON parameter values natively.
Why C is correct: Alternatives for complex data:
Store in SSM Parameter Store and reference
Use Mappings for structured data
Multiple parameters for individual values
Custom resources to process complex data
Why D is incorrect: CommaDelimitedList is for lists of strings, not complex objects.
Question 197
A DevOps engineer is implementing AWS Config conformance packs and needs to pass different parameter values to the same pack in different accounts. How should this be configured?
A. Create different conformance packs for each account
B. Use conformance pack input parameters with account-specific values
C. Conformance packs don't support per-account parameters
D. Use AWS Organizations to push account-specific configurations
Answer: B
Explanation:
Conformance pack input parameters can vary per deployment.
Why A is incorrect: Creating different packs adds maintenance overhead.
Why B is correct: Conformance pack parameters:
Define parameters in pack template
Specify values per deployment
Different values per account/region
Centralized pack, flexible configuration
Why C is incorrect: Conformance packs support input parameters.
Why D is incorrect: Organizations deploys packs but parameters are part of the pack deployment.
Question 198
A company uses CloudFormation and wants to implement blue-green deployment for their infrastructure. Which approach should be used?
A. CloudFormation UpdatePolicy with replacement
B. Create parallel stacks and switch traffic
C. Use CloudFormation change sets for blue-green
D. CloudFormation doesn't support infrastructure blue-green
Why A is incorrect: UpdatePolicy handles rolling updates within a stack, not blue-green.
Why B is correct: Blue-green infrastructure:
Create new stack (green)
Test green environment
Switch traffic (DNS, ALB rules)
Decommission old stack (blue)
CodePipeline can orchestrate this
Why C is incorrect: Change sets preview changes but don't create parallel environments.
Why D is incorrect: Blue-green can be implemented with parallel stacks.
Question 199
A DevOps engineer needs to create a CloudFormation template that includes a wait condition for resources in different stacks. How should this be implemented?
A. Use WaitCondition with cross-stack references
B. WaitConditions can only work within a single stack
C. Use custom resources to implement cross-stack waits
Why A is incorrect: WaitConditions can't receive signals from resources in other stacks.
Why B is correct: WaitConditions are stack-scoped:
WaitConditionHandle provides URL
Resources in the same stack send signals
Can't work across stacks natively
Why C is correct: Custom resource approach:
Lambda polls for condition in other stack
Returns when condition met
Enables cross-stack coordination
Why D is correct: Both statements are accurate.
Question 200
A company is implementing a comprehensive DevOps strategy using AWS services for infrastructure as code. They need configuration management, compliance monitoring, and automated remediation. Which combination of services provides this capability?
A. CloudFormation for IaC, Config for compliance, SSM for remediation
B. Terraform for IaC, CloudWatch for compliance, Lambda for remediation
C. CDK for IaC, Security Hub for compliance, Step Functions for remediation
D. All options could work, but A is the AWS-native approach
Answer: D
Explanation:
Multiple approaches can achieve the goal, but AWS-native services integrate best.
Why A is partially correct: AWS-native approach:
CloudFormation/CDK: Infrastructure as Code
AWS Config: Compliance monitoring and rules
SSM Automation: Remediation actions
Tight integration between services
Why B is partially correct: Third-party IaC with AWS services:
Terraform for IaC
CloudWatch for monitoring
Lambda for custom remediation
Why C is partially correct: Alternative approach:
CDK (compiles to CloudFormation)
Security Hub aggregates compliance
Step Functions for complex workflows
Why D is correct: All approaches can work:
Choice depends on team skills and requirements
AWS-native (A) provides deepest integration
Exam typically favors AWS-native solutions
📚 Summary: Key Points for Domain 1
Key Takeaways for Domain 2:
CloudFormation is foundational - Know intrinsic functions (!Ref, !GetAtt, !Sub, !FindInMap), helper scripts (cfn-init, cfn-signal), deployment strategies (UpdatePolicy, CreationPolicy), and advanced features (StackSets, Hooks, Registry).
Systems Manager is comprehensive - Understand all SSM capabilities: Parameter Store vs. Secrets Manager, Run Command vs. Automation, State Manager, Patch Manager, and Session Manager.
AWS Config for compliance - Know managed rules, custom rules, remediation actions, conformance packs, and aggregators.
Multi-account strategies - Understand Organizations, SCPs, Control Tower, StackSets, and delegated administrators.
Integration patterns - Know how services work together: Config + SSM for remediation, CloudFormation + SSM for configuration, EventBridge for automation triggers.
Security integration - Understand how IaC integrates with IAM, KMS, Secrets Manager, and Security Hub.