Skip to content

Answers & explanations

Practice Set 2: every answer explained.

All 25 questions from this set, with the correct answer marked and a full explanation of why it is right — and why each plausible alternative is not. 5 of them are multi-answer, which the AWS DevOps Engineer exam uses heavily.Read it as a study sheet, or take the set under timed conditions first and come back.

Every question here is original, written for this site to match the style and difficulty of the real exam. None are reproduced from an actual exam — that would breach the certification agreement and would not teach you anything.

  1. Q1

    A media company runs a four-stage AWS CodePipeline pipeline named prod-encoder with Source, Build, Test, and Deploy stages. The on-call team wants an Amazon SNS notification the moment any stage of that specific pipeline fails. Notifications about action-level retries or about other pipelines in the account would create noise and must not fire.

    Which Amazon EventBridge event pattern should the DevOps engineer use?

    • A{ "source": ["aws.codepipeline"], "detail-type": ["CodePipeline Pipeline Execution State Change"], "detail": { "state": ["FAILED"] } }
    • B{ "source": ["aws.codepipeline"], "detail-type": ["CodePipeline Stage Execution State Change"], "detail": { "state": ["FAILED"], "pipeline": ["prod-encoder"] } }Correct
    • C{ "source": ["aws.codepipeline"], "detail-type": ["CodePipeline Action Execution State Change"], "detail": { "state": ["FAILED"], "pipeline": ["prod-encoder"] } }
    • D{ "source": ["aws.codebuild"], "detail-type": ["CodeBuild Build State Change"], "detail": { "build-status": ["FAILED"], "project-name": ["prod-encoder"] } }

    Why B

    CodePipeline emits three distinct event granularities — pipeline, stage, and action. The requirement is a stage-level failure for one named pipeline, so the pattern must combine the "CodePipeline Stage Execution State Change" detail-type with both a FAILED state and a pipeline filter. The pipeline-execution pattern is the wrong granularity and, because it omits the pipeline field, it would also match failures from every other pipeline in the account. The action-execution pattern fires once per failing action, which is exactly the retry-level noise the team wants to avoid. The CodeBuild pattern only observes the build project and would stay silent when the Test or Deploy stage fails.

  2. Q2

    A team deploys a payments service to an Amazon EC2 Auto Scaling group with AWS CodeDeploy. Occasionally a release passes its lifecycle hooks but drives the service’s 5xx error rate up minutes later. The team wants CodeDeploy to revert to the last known good revision automatically, without an engineer running a command.

    Which statement about CodeDeploy automatic rollback is correct?

    • AAutomatic rollback can be configured to trigger when a deployment fails or when a specified Amazon CloudWatch alarm enters the ALARM state.Correct
    • BAutomatic rollback is available only for in-place deployments to EC2 instances; on-premises instances and blue/green deployments must be rolled back manually.
    • CAutomatic rollback is driven by the deployment group’s Amazon SNS triggers — CodeDeploy rolls back whenever a subscriber fails to acknowledge the notification.
    • DCodeDeploy has no automatic rollback capability; the team must redeploy the previous revision from the console or the AWS CLI.

    Why A

    A CodeDeploy deployment group can roll back automatically on deployment failure, when a specified CloudWatch alarm threshold is met, or when a deployment is stopped — the first two are the checkboxes exposed in the console. Wiring a 5xx-rate alarm into the deployment group covers exactly the case described here, where the deployment itself succeeds but the service degrades afterwards. The claim that rollback is limited to in-place EC2 deployments is wrong — on-premises instances and blue/green deployments support it as well. SNS triggers are notification-only and have no acknowledgement semantics that could drive a rollback. And the option asserting that no automatic rollback exists contradicts the advanced settings on every deployment group.

  3. Q3

    A DevOps engineer is writing a buildspec.yml for an AWS CodeBuild project that builds a container image and pushes it to a private Amazon ECR repository. The buildspec defines the pre_build, build, and post_build phases.

    Which command belongs in the pre_build phase?

    • Adocker build -t $REPOSITORY_URI:$IMAGE_TAG -f docker/Dockerfile.production .
    • Baws ecr get-login-password | docker login --username AWS --password-stdin $REGISTRY_URICorrect
    • Cdocker tag $REPOSITORY_URI:$IMAGE_TAG $REGISTRY_URI/$REPOSITORY_NAME:latest
    • Ddocker push $REPOSITORY_URI:$IMAGE_TAG && docker push $REPOSITORY_URI:latest

    Why B

    The pre_build phase is for preparation that the build itself depends on — authenticating to the registry, resolving the repository URI, and computing the image tag. Retrieving an ECR authorization token and piping it into docker login is the canonical pre_build step. Building the image is the work of the build phase, and tagging it can only happen after the image exists, so it belongs to build as well. Pushing the image must wait until the build has produced and tagged it, which places it in post_build.

  4. Q4

    A company already stores every application image in Amazon ECR and runs the workload on an Amazon ECS cluster. The DevOps team wants a pipeline that starts when a new image is pushed to the repository and then rolls that image out to the ECS service using a blue/green strategy with a validation window before traffic shifts. The team wants the fastest path to a working pipeline using managed services.

    Which implementation meets these requirements with the least effort?

    • ARun a Jenkins server on Amazon EC2 with a job that polls the ECR repository and shifts traffic between two ECS services by calling the AWS CLI.
    • BBuild an AWS CodePipeline pipeline with an Amazon ECR source stage, an AWS CodeBuild stage that rebuilds the image, and an AWS CloudFormation deploy stage that replaces the ECS service.
    • CBuild a CodePipeline pipeline with an Amazon ECR source stage and an Amazon ECS (Blue/Green) deploy action backed by an AWS CodeDeploy deployment group.Correct
    • DCreate an AWS CodeDeploy application and deployment group that watches the ECR repository directly and deploys each new image to the ECS cluster.

    Why C

    CodePipeline has a native ECR source action and a native Amazon ECS (Blue/Green) deploy action that delegates the traffic shift to CodeDeploy, giving you the validation window and automatic rollback without custom work. Amazon ECS has since added its own built-in blue/green deployment strategy that does not involve CodeDeploy at all, and it is now the simpler starting point for greenfield services — but of the four approaches offered here, the CodeDeploy-backed pipeline action is the one that meets the requirement. Adding a CodeBuild stage to rebuild an image that already exists is wasted work, and driving the ECS service through CloudFormation gives up the managed blue/green traffic shifting. CodeDeploy alone cannot form a pipeline — it has no source stage and will not react to an ECR push on its own. Self-managing Jenkins and hand-rolling the traffic shift is the most operational overhead of the four, not the least.

  5. Q5

    An AWS CodePipeline pipeline deploys infrastructure through an AWS CloudFormation deploy action whose action mode is "Create or update a stack". After a template error silently replaced a production database, leadership asked that a human be able to inspect exactly which resources a deployment would add, modify, or delete before anything is applied.

    How should the DevOps engineer restructure the pipeline?

    • AChange the action mode to "Create or replace a change set", add a manual approval, then execute the change set in a later action.Correct
    • BKeep the existing action mode and attach a stack policy that denies updates to the production database resources in the stack.
    • CChange the action mode to "Delete a stack" and add a later stage that recreates the stack from the new template.
    • DReplace the CloudFormation deploy action with an AWS CodeDeploy action so that failed updates roll back automatically.

    Why A

    A change set is CloudFormation’s preview mechanism: the CHANGE_SET_REPLACE action mode computes the diff without touching resources, a manual approval action pauses the pipeline for a human to read it, and a second action with the CHANGE_SET_EXECUTE mode applies it once approved. A stack policy can block specific updates but shows nobody what a deployment intends to do, so it prevents rather than reveals. Deleting and recreating the stack destroys data and causes a long outage. CodeDeploy deploys application revisions to compute targets and cannot manage CloudFormation stacks at all.

  6. Q6

    A retailer runs a customer-facing application on AWS Elastic Beanstalk and wants to release several times per day with no downtime. If a release misbehaves, the team must be able to return to the previous version within seconds rather than waiting for a redeployment.

    Which approach meets these requirements?

    • AEnable rolling updates on the existing environment and set a pause time long enough for the application to start on each batch.
    • BDeploy the new version to a second Elastic Beanstalk environment, verify it, then swap the environment CNAMEs.Correct
    • CEnable immutable updates on the existing environment so that a fresh Auto Scaling group is launched for every deployment.
    • DDeploy the new version to a second environment and configure the original environment to return an HTTP 301 redirect to the new environment’s URL.

    Why B

    Swapping environment CNAMEs is Elastic Beanstalk’s blue/green pattern. The new version is fully warmed and validated in its own environment before any customer reaches it, and rolling back is simply a second swap, which takes effect as soon as DNS resolves again. Rolling updates and immutable updates both replace instances inside the live environment, so recovering from a bad release means deploying the old version again rather than flipping a switch. Redirecting the old environment with a 301 changes the URL customers see and browsers cache permanent redirects aggressively, which makes the rollback unreliable.

  7. Q7

    A development team deploys to AWS Elastic Beanstalk dozens of times a day. Deployments recently began failing with an error stating that the application version quota, which applies across all applications in the Region, has been reached. The team wants old versions and their S3 source bundles cleaned up automatically without anyone remembering to do it.

    What should the DevOps engineer configure?

    • AAn Amazon EventBridge scheduled rule that invokes an AWS Lambda function to call delete-application-version each night.
    • BAn application version lifecycle policy that removes versions by age or by count, optionally deleting their source bundles.Correct
    • CAn AWS Config rule that flags applications exceeding the version limit and notifies the team through Amazon SNS.
    • DAn Amazon S3 lifecycle rule on the Elastic Beanstalk bucket that expires source bundles after 30 days.

    Why B

    Elastic Beanstalk has a purpose-built application version lifecycle policy that deletes versions once they exceed a maximum count or age. Deleting the source bundle from S3 is a separate opt-in setting on that policy — by default Beanstalk leaves the bundle in place to avoid data loss. The policy is native, requires no code, and never removes a version that is currently deployed to an environment or to one terminated within the last ten weeks. A scheduled Lambda function achieves a similar result but adds code, permissions, and failure modes for something the platform already does. An AWS Config rule only reports on the condition and would still leave the team to clean up by hand. An S3 lifecycle rule deletes the bundle objects but leaves the application version records in place, so the version limit is still reached.

  8. Q8

    During an outage last month, engineers edited security group rules and an RDS parameter group directly in the console to restore service. Those stacks are managed by AWS CloudFormation, and the platform team now wants a report of every resource whose live configuration no longer matches the template that produced it.

    Which CloudFormation capability produces that report?

    • ADrift detection, which compares live resources against their template configuration.Correct
    • BChange sets, which compute the effect of a proposed template update.
    • CStack policies, which control the resources an update is allowed to change.
    • DRollback triggers, which monitor CloudWatch alarms while a stack update is in progress.

    Why A

    Drift detection is the feature for out-of-band changes that already happened: it inspects each supported resource, compares it with the properties CloudFormation expects, and reports each one as IN_SYNC or MODIFIED with the exact property differences. That is precisely the console-edit scenario described. A change set looks forward rather than backward, previewing what a proposed update would do to a stack that is assumed to be in its expected state. A stack policy is a guardrail that permits or denies updates and reports nothing. Rollback triggers watch CloudWatch alarms during an in-progress update and can abort it, which does not help once the update has long finished.

  9. Q9

    A CloudFormation template provisions an Amazon RDS database instance and an application server that reads its connection details at boot. Stack creation intermittently fails because the application server starts before the database is available.

    How should the DevOps engineer guarantee the ordering?

    • AMove the database resource above the application server resource in the Resources section, since CloudFormation creates resources in document order.
    • BNest the database resource inside the application server resource so that it is created as a child.
    • CAdd a Wait Condition with a timeout longer than the database creation time and no other configuration.
    • DAdd a DependsOn attribute to the application server resource that names the database resource.Correct

    Why D

    DependsOn is the explicit ordering mechanism — CloudFormation will not begin creating the application server until the database has reached CREATE_COMPLETE. Position in the template is irrelevant because CloudFormation parallelizes creation and derives ordering only from references and DependsOn, so reordering the Resources section changes nothing. CloudFormation resources are flat; there is no parent-child nesting of one resource inside another. A bare WaitCondition with a long timeout only makes the stack sit and wait — without a signal from the application it eventually fails, and it still does not sequence the two resources.

  10. Q10Choose 2

    A CloudFormation stack deploys an Amazon EC2 instance that installs and configures a web server through a UserData script. The stack reports CREATE_COMPLETE as soon as the instance is running, even when the web server later fails to start, so the pipeline’s next stage proceeds against a broken environment.

    Which two actions together ensure the stack reports CREATE_COMPLETE only after the software is confirmed running? (Select TWO.)

    • AAttach a stack policy stating that all resources must be running before the status changes.
    • BAdd an Auto Scaling lifecycle hook to mark the instance configuration as complete.
    • CAttach a CreationPolicy to the EC2 instance resource with a ResourceSignal timeout.Correct
    • DSet DeletionPolicy to Retain on the EC2 instance so that a failed configuration is preserved.
    • ECall cfn-signal at the end of the bootstrap script to report success or failure back to CloudFormation.Correct

    Why C and E

    A CreationPolicy with a ResourceSignal tells CloudFormation to hold the resource in CREATE_IN_PROGRESS until it receives the expected number of success signals or the timeout expires, and the cfn-signal helper script sends that signal from the end of the bootstrap. The two work only as a pair — the policy without the signal times out, and the signal without the policy is discarded. A stack policy governs which resources an update may change and has no bearing on creation status. Auto Scaling lifecycle hooks apply to instances launched by an Auto Scaling group, not to a standalone instance resource. A DeletionPolicy only controls what happens when a resource is removed.

  11. Q11Choose 2

    A DevOps engineer is adding an AWS::CloudFormation::CustomResource to a template to provision a component that CloudFormation does not natively support. The resource type requires a ServiceToken property that tells CloudFormation where to send the create, update, and delete requests.

    Which two endpoints can the ServiceToken property reference? (Select TWO.)

    • AAn Amazon SNS topic ARNCorrect
    • BAn Amazon SQS queue ARN
    • CAn Amazon EventBridge rule ARN
    • DAn AWS Step Functions state machine name
    • EAn AWS Lambda function ARNCorrect

    Why A and E

    CloudFormation custom resources support exactly two provider types: an SNS topic, which fans the request out to whatever is subscribed, and a Lambda function, which is by far the more common choice. Both are supplied as ARNs. An SQS queue, an EventBridge rule, and a Step Functions state machine are not valid ServiceToken targets. The failure is not a template validation error — ServiceToken is typed as a plain string, so the template parses and the stack operation fails later, when CloudFormation cannot deliver the request to the target and the custom resource times out. A state machine name rather than an ARN would be invalid regardless, since ServiceToken always takes an ARN.

  12. Q12

    A CloudFormation template accepts a database master password as an input parameter. A security review found that anyone with permission to describe the stack can read the password in plaintext from the console, the API, and the stack events.

    What is the minimal change that masks the value in those places?

    • AAdd a Hidden attribute to the parameter definition.
    • BSet the Metadata attribute of the stack to mark the parameter as sensitive.
    • CSet the NoEcho attribute to true on the parameter.Correct
    • DAdd a Password property to the resource that consumes the parameter.

    Why C

    NoEcho is the parameter attribute built for this: when it is true, CloudFormation returns the value as a row of asterisks in the console, in describe-stacks responses, and in stack events. There is no Hidden parameter attribute and no generic Password resource property in CloudFormation — both would fail template validation. The stack Metadata section is free-form documentation that CloudFormation never interprets, so marking a parameter sensitive there changes nothing. NoEcho masks display only; for real secret management, reference AWS Secrets Manager with a dynamic reference so the value never enters the template at all.

  13. Q13

    Application servers occasionally fill their log volume and stop serving traffic. A CloudWatch alarm already fires on low disk space. The team wants the runbook step that truncates and archives the logs to run by itself on the affected instance, with an auditable record of each remediation, and no inbound SSH access.

    Which design meets these requirements?

    • ARoute the alarm to an Amazon SNS topic that pages the on-call engineer to run the steps by hand.
    • BSchedule a cron job on every instance that truncates the logs each hour regardless of disk state.
    • CRoute the alarm to an AWS Lambda function that opens an SSH session to the instance and runs the commands.
    • DRoute the alarm to an Amazon EventBridge rule that starts a Systems Manager Automation runbook on the instance.Correct

    Why D

    Systems Manager Automation is the managed runbook engine, and EventBridge is what turns an alarm state change into an invocation. Systems Manager reaches the instance through the SSM Agent rather than an inbound port, so no SSH ingress is needed, and every execution is recorded with its steps, parameters, and output. Paging a human meets the audit requirement but not the automation one, and it is slow at three in the morning. An hourly cron job ignores the alarm entirely, so it either runs when nothing is wrong or waits up to an hour when something is. Having Lambda open an SSH session reintroduces the inbound access the requirement rules out and means managing keys and network paths by hand.

  14. Q14

    A company uses Amazon Route 53 in front of several applications. One team performs blue/green releases by cutting all traffic between two identical stacks. Another team performs canary releases by sending a small percentage of traffic to a new stack and increasing it gradually. A third application must fail over to a standby stack in a second Region when the primary becomes unhealthy.

    Which combination of Route 53 routing policies supports all three patterns?

    • ALatency for blue/green, Simple for canary, Weighted for disaster recovery
    • BSimple for blue/green, Weighted for canary, Latency for disaster recovery
    • CWeighted for blue/green, Weighted for canary, Failover for disaster recoveryCorrect
    • DWeighted for blue/green, Latency for canary, Failover for disaster recovery

    Why C

    Weighted routing covers both release patterns: a blue/green cutover is a weighted record set flipped from 100/0 to 0/100, and a canary is the same mechanism moved in small increments. Failover routing is the policy designed for active-passive disaster recovery, promoting the standby record only when the primary’s health check fails. Latency routing sends users to the Region with the best response time, which the operator cannot control, making it unsuitable for a deliberate release cutover. Simple routing offers no traffic split at all, so it cannot express a canary.

  15. Q15Choose 2

    A startup runs a production web tier on Amazon EC2 behind an Application Load Balancer with an Amazon RDS database, all in a single Region. The business has asked the DevOps engineer to design a disaster recovery plan. No DR requirements have been documented yet.

    Which two questions should the engineer answer first in order to choose an appropriate DR strategy? (Select TWO.)

    • AWhich EC2 instance types should the recovery environment use?
    • BWhat are the recovery time objective and the recovery point objective for the workload?Correct
    • CWhat budget is available for the disaster recovery environment?Correct
    • DWhich database engine should the recovery environment run?
    • EWhich load balancer type should the recovery environment use?

    Why B and C

    RTO and RPO define how quickly the business must be serving traffic again and how much data it can afford to lose; those two numbers are what separate backup and restore from pilot light, warm standby, and multi-site active-active. Budget is the other primary input, because each step up that ladder costs materially more to keep running. Instance types, database engine, and load balancer type are downstream implementation details that follow from the strategy — and in most designs they simply mirror what production already uses, so answering them first tells the engineer nothing about which strategy to pick.

  16. Q16

    AWS CloudTrail is enabled in a company’s account with a single trail that delivers logs to an Amazon S3 bucket in ap-south-1, the Region where nearly all workloads run. An auditor raised the concern that a Regional failure could make the audit history unavailable exactly when it is most needed.

    Which action addresses the concern most directly?

    • AEnable server-side encryption with AWS KMS on the trail’s S3 bucket.
    • BReconfigure the trail in the CloudTrail console to deliver to a second S3 bucket in another Region.
    • CEnable S3 Cross-Region Replication on the trail’s bucket so objects are copied to a bucket in another Region.Correct
    • DWrite an AWS Lambda function that reads the trail’s bucket on a schedule and copies new log files to a bucket in another Region.

    Why C

    S3 Cross-Region Replication copies each log file to a bucket in another Region automatically as it is delivered, which keeps the audit history readable if the original Region becomes unavailable. Encrypting the bucket with KMS protects confidentiality but does nothing for availability. A CloudTrail trail delivers to exactly one S3 bucket, so there is no second destination to configure in the console. A scheduled Lambda copier could work but reimplements a native S3 feature, adds code and IAM permissions to maintain, and leaves a replication gap between runs.

  17. Q17

    An Auto Scaling group behind an Application Load Balancer is oversized during off-peak hours. The team wants the group to remove an instance automatically whenever aggregate CPU utilization across the group stays below 30 percent.

    How should the DevOps engineer implement this?

    • ACreate a CloudWatch alarm that publishes to an Amazon SQS queue, and have the queue remove an instance from the group.
    • BCreate a CloudWatch alarm that notifies the Application Load Balancer so that it deregisters and terminates an instance.
    • CCreate a CloudWatch alarm that notifies the operations team through Amazon SNS so that an engineer can terminate an instance.
    • DCreate a CloudWatch alarm on the group’s aggregated CPU and attach it to a scaling policy that decreases desired capacity.Correct

    Why D

    Scaling in is driven by a CloudWatch alarm on the group’s aggregated metric wired to an Auto Scaling scaling policy, which lowers desired capacity and lets the group terminate an instance according to its termination policy. A complete design also needs a matching scale-out policy, since a scale-in policy alone would shrink the group and never grow it back. An SQS queue is a message buffer and cannot act on an Auto Scaling group. The load balancer routes and health-checks traffic; it never changes group capacity. Paging a human works but is manual, slow, and not the automation the requirement asks for.

  18. Q18Choose 2

    A company is migrating an application from on-premises servers to Amazon EC2. The vendor license is bound to physical sockets and cores and requires that the software run on hardware the company can identify. Finance also wants a running report of how much of the license entitlement is currently consumed, so that the pipeline can stop launching instances before the limit is breached.

    Which two actions should the DevOps engineer take? (Select TWO.)

    • ARecord vCPU consumption in an Amazon DynamoDB table that a pipeline step reads and writes on each launch.
    • BRun the application on EC2 Dedicated Hosts so that the workload is bound to identifiable physical servers.Correct
    • CPurchase Reserved Instances and associate Elastic IP addresses with them so that the instances remain on the same hardware.
    • DCreate a license configuration in AWS License Manager with the appropriate license type and rules, and query consumption with list-usage-for-license-configuration.Correct
    • ECreate an AWS Config rule that counts running EC2 instances and compares the total against the license limit.

    Why B and D

    Dedicated Hosts expose the underlying physical server, including its sockets and cores, which is what a socket- or core-bound license needs. License Manager is the service purpose-built for the reporting half: a license configuration encodes the entitlement and its rules, it tracks consumption as instances launch, and a CLI call returns current usage that a pipeline step can gate on. The two services are formally coupled — AWS requires Dedicated Hosts when the counting type is Cores or Sockets. Maintaining a DynamoDB ledger reimplements that tracking by hand and drifts the moment an instance is launched outside the pipeline. Reserved Instances are a billing construct and Elastic IPs are network addresses — neither pins a workload to particular hardware. An AWS Config rule counting instances misses the point when the license is measured in sockets or cores rather than instance count.

  19. Q19

    Users report intermittent errors from a web application running on a fleet of Amazon EC2 instances behind a load balancer. Each instance writes its web server error log to local disk. Engineers currently diagnose issues by connecting to instances one at a time, which is slow and fails entirely when an instance has already been replaced.

    What should the DevOps engineer implement to diagnose the errors quickly?

    • AShip the error logs to Amazon CloudWatch Logs with the CloudWatch agent, then search them with Logs Insights and metric filters.Correct
    • BInstall the CloudWatch agent to ship the error logs to Amazon CloudWatch Logs, then export them to a third-party graphing tool for analysis.
    • CConfigure the application to send every error directly to an AWS Lambda function for processing.
    • DConfigure the application to send every error to AWS Config so that the errors are recorded with the resource configuration history.

    Why A

    Centralizing the logs in CloudWatch Logs solves the disappearing-instance problem, and metric filters plus Logs Insights let the team search across the whole fleet and turn recurring error patterns into metrics and alarms without leaving AWS. Forwarding those same logs to an external tool adds a dependency and cost for capability CloudWatch already provides. Invoking a Lambda function per error builds a custom log pipeline with no search interface and no retention story. AWS Config records resource configuration changes and has no concept of application logs at all.

  20. Q20

    A DevOps engineer is asked to produce a report of client IP addresses and request latencies for an Application Load Balancer. The engineer checks the S3 bucket the team expected the logs to be in and finds no objects at all.

    What is the most likely explanation?

    • AThe engineer lacks the IAM permissions required to read load balancer logs.
    • BAccess logging is disabled by default and must be enabled on the load balancer.Correct
    • CThe Auto Scaling group is not forwarding the required log data to the load balancer.
    • DThe EC2 instances are not forwarding the required log data to the load balancer.

    Why B

    Elastic Load Balancing access logging is optional and off by default. Until it is enabled and pointed at a bucket with a policy that lets the service write to it, no objects are ever delivered — which matches the completely empty bucket. Missing IAM permissions would produce an access denied error rather than an empty listing. The remaining two options describe a data flow that does not exist: the load balancer writes access logs from its own observation of the connections it handles, so neither the Auto Scaling group nor the registered instances send it anything to log.

  21. Q21

    An ecommerce company runs EC2 instances in five AWS Regions. The operations team wants a single view of CPU, memory, and request metrics across all five Regions so that on-call engineers do not have to switch Regions during an incident.

    How can this be achieved with Amazon CloudWatch?

    • ACreate a separate CloudWatch dashboard in each Region and open them side by side.
    • BRegister the instances running in the other Regions with CloudWatch in the primary Region.
    • CCreate a single CloudWatch dashboard with widgets that reference metrics from each Region.Correct
    • DThis is not possible; CloudWatch metrics can only be visualized within the Region that produced them.

    Why C

    A CloudWatch dashboard widget can source its metrics from any Region, so one dashboard can present all five side by side and give on-call a single pane of glass. Building one dashboard per Region is the manual workaround the requirement is explicitly trying to eliminate. There is no mechanism for registering an instance with CloudWatch in a different Region — metrics are published to the Region the resource runs in. And the claim that cross-Region visualization is impossible is simply false; only the storage of metrics is Regional, not their display.

  22. Q22

    A Java application in production shows sporadic CPU spikes and rising latency, and the team also wants to reduce the instance cost of running it. The DevOps engineer has decided to use Amazon CodeGuru Profiler.

    How should the engineer use the service to find and fix the bottlenecks?

    • AEnable CodeGuru Profiler anomaly detection so that it automatically rolls back the deployment when CPU utilization spikes.
    • BEnable heap utilization visualization in CodeGuru Profiler to perform real-time memory allocation analysis and locate memory leaks.
    • CUse Amazon CodeGuru Reviewer to analyze the application at runtime and generate suggestions for optimizing CPU and memory usage.
    • DRun the CodeGuru Profiler agent in the application and use its flame graphs and recommendations to find the methods consuming the most CPU.Correct

    Why D

    CodeGuru Profiler works by running a low-overhead agent inside the live application, aggregating stack traces, and presenting them as a flame graph in which the widest frames are the methods burning the most CPU — alongside recommendations that often translate directly into smaller instances. Profiler can surface anomalies in latency and CPU profiles, but it does not perform deployments and therefore cannot roll one back. Heap analysis is a genuine Profiler feature, but memory is not the reported symptom here; CPU spikes and latency are. CodeGuru Reviewer is a static analysis tool for source code and pull requests and never observes a running process.

  23. Q23Choose 2

    After a new AMI was rolled out to an Auto Scaling group behind an Application Load Balancer, the new instances fail the target group health check and the Auto Scaling group terminates and replaces them in a loop. A DevOps engineer needs to keep one of the failing instances alive and reachable for at least 24 hours to investigate, without stopping the group from serving the rest of the traffic and without reducing health check coverage for the remaining instances.

    Which two methods achieve this? (Select TWO.)

    • ARevert the launch template to the previous AMI ID so that the group stops launching the new instances.
    • BDisable the Elastic Load Balancing health check type on the Auto Scaling group.
    • CPut the instance into the Standby state to remove it temporarily from the Auto Scaling group.Correct
    • DAdd an EC2_INSTANCE_LAUNCHING lifecycle hook and keep recording the lifecycle action heartbeat so the instance remains in the Pending:Wait state.Correct
    • EDecrease the desired capacity of the Auto Scaling group.

    Why C and D

    Standby is the direct answer: Amazon EC2 Auto Scaling does not run health checks on an instance in a standby state, and the instance is deregistered from the target group while it keeps running and stays reachable over SSH or Systems Manager. A launching lifecycle hook is the other route, because it holds a new instance in Pending:Wait before it is ever health-checked. Note the timeout arithmetic: the hook’s heartbeat timeout accepts 30 to 7200 seconds and defaults to 3600, so 24 hours cannot be set on the parameter directly — you reach it by calling RecordLifecycleActionHeartbeat to reset the clock, bounded by a global wait-state limit of 48 hours or 100 times the heartbeat timeout, whichever is smaller. Reverting the AMI removes the very instances the engineer wants to examine. Switching the group’s health check type away from ELB would stop the terminations, but it blinds the group to unhealthy instances fleet-wide, which the requirement rules out. Lowering desired capacity gives no control over which instance is terminated.

  24. Q24

    A security operator in an organization with many organizational units must build an EventBridge rule that fires when an AWS service that an OU has not used in six months is suddenly called. To scope the rule, the operator first needs to know which services each OU has actually used and when they were last accessed.

    What is the quickest way to obtain that information?

    • AOpen each OU in the AWS Organizations console and read the service last accessed information shown there.
    • BCall the AWS Config service through the AWS CLI to retrieve service last accessed information for each organizational unit.
    • CAdd a resource group in AWS Resource Groups for the candidate services and view the last accessed information for the group.
    • DUse IAM access advisor to view service last accessed data for each organizational unit.Correct

    Why D

    Service last accessed data is produced by IAM access advisor, and it can be generated for an organizational unit or the whole organization from the management account, which is precisely the scoping input the operator needs. The AWS Organizations console manages accounts, OUs, and policies; it does not display access advisor data. AWS Config records resource configuration state and compliance, not which principals called which services. Resource Groups collects and tags resources for bulk operations and reports nothing about service usage history.

  25. Q25

    An internal API hosted on Amazon API Gateway must be callable only from the corporate office CIDR ranges and only by two specific AWS accounts. The DevOps engineer has been asked to avoid third-party proxies and to keep the design as simple as possible.

    Which approach meets these requirements?

    • AAttach an API Gateway resource policy allowing the corporate IP ranges and the two AWS accounts, denying everything else.Correct
    • BAttach IAM policies to users and roles in the two accounts, and put AWS WAF in front of the API for additional protection.
    • CEnable API Gateway caching to improve performance and use AWS CloudTrail to monitor and audit access requests.
    • DAttach an API Gateway resource policy that allows the corporate source IP ranges from any AWS account.

    Why A

    An API Gateway resource policy is a policy attached to the API itself and can express both required conditions in one document — an aws:SourceIp condition for the office ranges and an AWS account or role principal for the two permitted accounts. The account half only takes effect when the methods use IAM authorization, since a request must be SigV4-signed for API Gateway to know which account it came from. IAM policies alone govern what identities in those accounts may do and cannot restrict by source IP at the API, and adding AWS WAF brings request filtering but not the account-level restriction. Caching is a performance feature and CloudTrail is an audit trail; neither blocks a request. A resource policy that allows the office ranges from any AWS account enforces only half the requirement, since any AWS account could then call the API from an office address.

Ready to try it without the answers in front of you?