Courseiva

AWS Certified DevOps Engineer Professional DOP-C02 (DOP-C02) — Questions 13511425

1487 questions total · 20pages · All types, answers revealed

Page 18

Page 19 of 20

Page 20
1351
MCQmedium

Refer to the exhibit. The command is run to investigate a potential security incident. The output shows no events. Which of the following is the MOST likely reason?

A.CloudTrail is not enabled to log management events in us-east-1
B.The CloudTrail trail is configured to log only data events
C.The event name is misspelled; it should be "Console Login"
D.The IAM user running the command does not have cloudtrail:LookupEvents permission
AnswerB

A trail can be configured to log only data events, which capture S3 object-level activity, Lambda invocations, and similar resource operations, while excluding management events that record account-level actions like ConsoleLogin. Because the lookup query for ConsoleLogin returns nothing, the trail is evidently not capturing management events. This is the most plausible reason for the missing event, as CloudTrail trails default to logging management events unless explicitly set to data events only.

Why this answer

The output shows no events when looking up ConsoleLogin events. CloudTrail trails can be configured to log management events (like ConsoleLogin) and/or data events. By default, a trail logs management events.

However, if the trail is configured to log only data events, management events are not recorded. Therefore, the most likely reason for no events is that the trail is set to log only data events, as stated in option B.

1352
MCQeasy

A DevOps engineer needs to ensure that all API calls made to AWS are recorded for auditing purposes. Which AWS service should be used?

A.AWS CloudTrail
B.AWS Config
C.Amazon CloudWatch Logs
D.Amazon VPC Flow Logs
AnswerA

AWS CloudTrail is the correct answer because it is the native AWS service designed to record all API activity across your account. Every management event, including calls made by users, roles, or AWS services, is captured with details like the identity of the caller, source IP address, event time, request parameters, and response elements. By creating a trail, you can deliver these audit logs to an S3 bucket for long-term storage and enable CloudTrail Insights to detect anomalous API activity, which directly satisfies the requirement to ensure all API calls are audited.

Why this answer

AWS CloudTrail is the correct service because it records all API calls made to AWS, including the identity of the caller, the time of the call, the source IP address, and the request parameters. This provides a complete audit trail of user activity and API usage, which is essential for auditing, security analysis, and compliance requirements.

Exam trap

The trap here is confusing AWS Config (which tracks resource configuration changes) with CloudTrail (which records API calls), as both are used for auditing but serve fundamentally different purposes.

How to eliminate wrong answers

Option B (AWS Config) is wrong because it evaluates and records resource configuration changes over time, not API calls; it tracks resource state and compliance rules, not the API actions that caused changes. Option C (Amazon CloudWatch Logs) is wrong because it aggregates and stores log data from applications and AWS services, but it does not natively capture API call records; it requires CloudTrail to deliver logs to it. Option D (Amazon VPC Flow Logs) is wrong because it captures IP traffic metadata (source/destination IP, ports, protocol) for network interfaces in a VPC, not the API calls made to AWS services.

1353
MCQmedium

A company uses AWS KMS to encrypt data in S3. The security team requires that the key material be rotated every 90 days. What should be done to meet this requirement?

A.Create a customer managed key and enable automatic yearly rotation.
B.Use an AWS managed key (SSE-S3) and enable rotation.
C.Use a custom key store with imported key material and enable automatic rotation.
D.Create a customer managed key and manually rotate it every 90 days.
AnswerD

Customer managed keys are the only KMS key type that supports manual rotation, allowing you to create a new key and update aliases as needed at any time. By manually rotating every 90 days, the company can enforce its required rotation policy while keeping the same alias or key ID for applications. This gives full control over rotation frequency, unlike automatic rotation which is fixed at yearly.

Why this answer

AWS KMS customer managed keys support manual rotation, which allows you to rotate the key material every 90 days as required. Automatic key rotation for customer managed keys is only available with a minimum rotation period of 365 days (yearly), so it cannot meet a 90-day requirement. Manual rotation creates a new backing key while retaining the old one for decryption of previously encrypted data, ensuring compliance with the 90-day rotation policy.

Exam trap

The trap here is that candidates assume automatic rotation can be configured to any interval, but AWS KMS only supports automatic rotation with a fixed 365-day period for customer managed keys, so a 90-day requirement forces manual rotation.

How to eliminate wrong answers

Option A is wrong because automatic yearly rotation for customer managed keys has a fixed period of 365 days, which cannot be changed to 90 days. Option B is wrong because AWS managed keys (SSE-S3) do not support user-controlled rotation; they are rotated automatically by AWS but the rotation schedule is not configurable and does not meet a specific 90-day requirement. Option C is wrong because a custom key store with imported key material does not support automatic rotation; you must manually re-import new key material to rotate, and automatic rotation is not available for imported keys.

1354
Multi-Selectmedium

A company is building a multi-tier web application on AWS. The application must be resilient to the failure of an entire Availability Zone. The architecture includes an Application Load Balancer (ALB), EC2 instances in an Auto Scaling group, and an Amazon RDS for MySQL database. Which TWO actions should be taken to achieve this resilience? (Choose two.)

Select 2 answers
A.Configure an RDS read replica in a different Availability Zone.
B.Use a Single-AZ RDS for MySQL database to keep costs low.
C.Place all EC2 instances in the same Availability Zone to reduce cross-AZ data transfer costs.
D.Configure the Auto Scaling group to launch EC2 instances in at least two Availability Zones.
E.Deploy the RDS for MySQL database in a Multi-AZ configuration.
AnswersD, E

Distributing instances across AZs provides high availability for the web tier.

Why this answer

Configuring the Auto Scaling group to launch EC2 instances in at least two Availability Zones ensures that if one AZ fails, the remaining AZ(s) can continue serving traffic. This is a fundamental pattern for building AZ-resilient compute tiers. Option E is correct because deploying Amazon RDS for MySQL in a Multi-AZ configuration automatically provisions and maintains a synchronous standby replica in a different AZ, providing automatic failover if the primary DB instance fails, thus ensuring database resilience.

Exam trap

The trap here is that candidates often confuse read replicas (asynchronous, for read scaling) with Multi-AZ deployments (synchronous, for high availability), and mistakenly think placing all resources in one AZ reduces costs without recognizing the critical single point of failure it introduces.

1355
MCQeasy

A company has a legacy application running on an EC2 instance that is not part of an Auto Scaling group. The instance is experiencing a memory leak. The DevOps engineer needs to collect memory metrics to analyze the issue without modifying the application. What should the engineer do?

A.Install the CloudWatch agent on the instance and configure it to collect memory metrics.
B.Use the AWS Management Console to view memory metrics from the EC2 monitoring tab.
C.Use EC2Rescue to generate a memory dump and analyze it.
D.Enable CloudWatch detailed monitoring on the instance.
AnswerA

The default EC2 monitoring only exposes hypervisor-level metrics like CPU, network, and disk I/O; memory utilization is a guest-OS metric that AWS cannot see without an in-guest component. Installing the unified CloudWatch agent (with the `mem_used_percent` and similar metrics in the agent's JSON config) and starting the `amazon-cloudwatch-agent` service enables the agent to publish memory metrics to CloudWatch, making them available for alarms and dashboards. This is required because no amount of instance-level monitoring settings can surface guest-OS memory.

Why this answer

The CloudWatch agent is required to collect custom metrics like memory utilization from an EC2 instance because the standard EC2 monitoring only captures hypervisor-level metrics (CPU, network, disk I/O). By installing and configuring the CloudWatch agent, the engineer can collect memory metrics without modifying the application code, directly addressing the memory leak analysis requirement.

Exam trap

The trap here is that candidates often assume the EC2 monitoring tab or detailed monitoring includes memory metrics, but AWS does not provide OS-level metrics (memory, disk space, swap usage) without the CloudWatch agent.

How to eliminate wrong answers

Option B is wrong because the AWS Management Console EC2 monitoring tab only displays default metrics (CPU, network, disk, status checks) and does not include memory metrics, which require a custom agent. Option C is wrong because EC2Rescue is a tool for troubleshooting and repairing common EC2 issues (e.g., OS boot failures, disk corruption), not for collecting ongoing memory metrics; it can generate a memory dump but that is a one-time snapshot, not a continuous metric stream for trend analysis. Option D is wrong because enabling CloudWatch detailed monitoring only increases the frequency of default metric collection (from 5 minutes to 1 minute) but does not add memory metrics, which are not available at the hypervisor level.

1356
MCQeasy

A company wants to automate patching of EC2 instances running Amazon Linux 2 while ensuring compliance with security policies. Which AWS service should be used?

A.AWS Trusted Advisor
B.Amazon Inspector
C.AWS Config
D.AWS Systems Manager Patch Manager
AnswerD

AWS Systems Manager Patch Manager is a purpose-built capability that automates the process of patching managed instances, whether they are EC2 instances or on-premises servers. It works in tandem with patch baselines, maintenance windows, and rate control to approve, schedule, and install patches, and it also reports patch compliance for the fleet. With the SSM Agent installed, Patch Manager uses a standard SSM document such as AWS-RunPatchBaseline to execute the patch operation, making it the correct choice for automated OS patching.

Why this answer

AWS Systems Manager Patch Manager automates the patching of EC2 instances, including Amazon Linux 2, by using patch baselines to define approved patches and compliance rules. It integrates with maintenance windows and State Manager to schedule and enforce patching, ensuring instances remain compliant with security policies without manual intervention.

Exam trap

The trap here is that candidates often confuse Amazon Inspector (which finds vulnerabilities) with Patch Manager (which fixes them), or assume AWS Config can remediate patches directly, when in reality Config only evaluates compliance and requires a separate automation action (e.g., via Systems Manager Automation) to apply patches.

How to eliminate wrong answers

Option A is wrong because AWS Trusted Advisor is an advisory service that inspects your AWS environment and makes recommendations for cost optimization, performance, security, and fault tolerance, but it does not perform or automate patching of EC2 instances. Option B is wrong because Amazon Inspector is a vulnerability assessment service that scans EC2 instances for software vulnerabilities and unintended network exposure, but it does not apply patches or automate the patching process. Option C is wrong because AWS Config is a service that evaluates and records resource configurations against desired policies, enabling compliance auditing and change tracking, but it cannot directly patch instances or execute remediation actions like applying OS updates.

1357
MCQeasy

A DevOps engineer is tasked with automating the deployment of a microservices architecture. Each service is packaged as a Docker container. The team wants to use AWS CodePipeline and AWS CodeBuild to build Docker images and push them to Amazon ECR, then deploy to Amazon ECS. What should the CodeBuild buildspec file include to push the image to ECR?

A.A call to the AWS CodeDeploy API to push the image.
B.An invocation of the AWS ECS RunTask API.
C.A buildspec phase with 'ecr-push' action.
D.Docker build and docker push commands with AWS CLI to authenticate to ECR.
AnswerD

The correct approach is to authenticate the local Docker daemon to the private ECR registry using 'aws ecr get-login-password' piped to 'docker login', then build your image with 'docker build', tag it with the ECR repository URI, and run 'docker push'. This satisfies ECR's token-based authentication and uploads Docker layers directly to the registry's S3-backed storage. It is the only way among the choices that actually moves image data into ECR.

Why this answer

To push a Docker image to Amazon ECR, the buildspec must first authenticate Docker to the ECR registry using the AWS CLI's `aws ecr get-login-password` command piped to `docker login`, then build the image with `docker build`, tag it with the ECR repository URI, and finally push it with `docker push`. CodeBuild does not have a built-in 'ecr-push' action; it relies on executing these standard Docker and AWS CLI commands in the build phases.

Exam trap

The trap here is that candidates may assume CodeBuild has a native 'ecr-push' action or that ECS APIs are involved in image pushing, when in fact the process relies on standard Docker commands and AWS CLI authentication within the buildspec.

How to eliminate wrong answers

Option A is wrong because the AWS CodeDeploy API is used for deploying applications to EC2, on-premises, or Lambda, not for pushing Docker images to ECR; pushing images is a registry operation, not a deployment action. Option B is wrong because the ECS RunTask API is used to run a standalone task in ECS, not to push images to ECR; pushing images must happen before any ECS task can reference them. Option C is wrong because CodeBuild does not have a built-in 'ecr-push' action or phase; the buildspec phases are 'install', 'pre_build', 'build', 'post_build', and custom commands must be written to perform Docker operations.

1358
Multi-Selecthard

A company runs a microservices architecture on Amazon ECS. They want to ensure that if a service fails, it does not cascade to other services. Which TWO design patterns should they implement?

Select 2 answers
A.Cache-aside pattern
B.Saga pattern
C.Circuit breaker pattern
D.Throttling pattern
E.Bulkhead pattern
AnswersC, E

Circuit breaker pattern monitors calls to a remote service and maintains three states—closed, open, and half-open—progressing to open when failure thresholds are exceeded, at which point subsequent calls fail fast without attempting the network operation. This prevents a failing service from being overwhelmed and stops the same repeated errors from saturating caller resources, thereby breaking the chain of cascading failures and giving the dependency time to recover.

Why this answer

Circuit breaker prevents cascading failures, and bulkheads isolate failures to specific services.

1359
MCQeasy

A security engineer needs to audit who accessed a specific S3 object and from which IP address over the past 30 days. Which AWS service should be used?

A.AWS CloudTrail
B.Amazon CloudWatch Logs
C.Amazon S3 server access logs
D.AWS Config
AnswerC

Amazon S3 server access logs are the native, purpose-built mechanism for auditing who accessed a specific S3 bucket or object. When you enable server access logging on a bucket, S3 writes a log record for every request, including the requester's AWS account ID (or 'Anonymous' for unauthenticated requests), the bucket name, object key, request type (GET, PUT, etc.), response status, and timestamp. These logs are delivered to a target bucket you specify, and they provide the granular object-level history needed to answer 'who accessed this specific object?'. Although delivery is best-effort and logs may arrive asynchronously, they are the canonical source for S3 access-level audits.

Why this answer

S3 server access logs provide detailed records of all requests made to an S3 bucket, including the requester identity (such as the AWS account or IAM user) and the source IP address. These logs can be enabled for a bucket and delivered to a target bucket for analysis. Option A is wrong because AWS CloudTrail, by default, records management events (e.g., bucket creation) but not data events (e.g., GetObject) unless specifically configured.

Option B is wrong because Amazon CloudWatch Logs can store and monitor logs but does not generate access logs for S3. Option D is wrong because AWS Config records resource configuration changes, not access requests.

1360
MCQeasy

A development team uses AWS CodeCommit for source control and AWS CodePipeline for CI/CD. They have configured a CodeBuild project that triggers on pushes to the 'develop' branch. The build runs unit tests and packages the application. However, developers report that the pipeline fails intermittently with a 'BUILD_FAILED' status due to test failures, but the tests pass locally. What is the MOST likely cause of this discrepancy?

A.The CodeBuild project is configured with a VPC that restricts access to external dependency repositories.
B.The CodePipeline has a timeout setting that causes the build to be terminated before tests complete.
C.The CodePipeline is configured with a branch filter that only triggers on the 'main' branch.
D.The CodeBuild project has different environment variables or dependency versions compared to the local environment.
AnswerD

CodeBuild executes in a managed build environment that uses a specified image (e.g., Amazon Linux with a particular JDK, Node.js, or Python version) and its own set of environment variables and pre-installed tool versions, which may differ from the developer's local machine. Dependency resolution without strict lockfiles can pull different minor or patch versions of libraries in CodeBuild than those present locally, leading to behavioral changes that break tests intermittently. Similarly, environment variables such as API endpoints, feature flags, or locale settings can alter application logic at runtime. This environmental divergence is the classic 'works on my machine' problem and directly explains why tests pass locally but intermittently fail in CodeBuild.

Why this answer

The most common cause of tests passing locally but failing in CodeBuild is environment inconsistency. CodeBuild runs in a managed environment with specific runtime versions, environment variables, and dependency caches that may differ from the developer's local machine. This discrepancy can lead to test failures due to different library versions, missing environment variables, or platform-specific behaviors.

Exam trap

The trap here is that candidates may focus on network or timeout issues (options A and B) instead of recognizing that environment inconsistency is the classic cause of 'works on my machine' failures in CI/CD pipelines.

How to eliminate wrong answers

Option A is wrong because while a VPC restriction could cause network issues, it would typically result in build failures due to dependency download errors, not test failures that pass locally. Option B is wrong because a pipeline timeout would terminate the entire build process, not cause specific test failures; the error would be 'BUILD_TIMEOUT' or similar, not 'BUILD_FAILED' with test failures. Option C is wrong because the question states the pipeline triggers on pushes to the 'develop' branch, so a branch filter for 'main' would prevent the pipeline from triggering at all, not cause intermittent failures.

1361
Multi-Selecthard

Which THREE measures can be taken to ensure that EC2 instances are compliant with a security policy that requires all instances to be in a VPC with specific tags? (Select THREE.)

Select 3 answers
A.Use AWS Config rules to detect non-compliant instances.
B.Use EC2 Auto Scaling to launch instances only in the correct VPC.
C.Apply an SCP that denies ec2:RunInstances unless the instance is in the correct VPC.
D.Use a custom AWS Lambda function triggered by CloudTrail to tag instances.
E.Use CloudWatch alarms to monitor instance launches.
AnswersA, C, D

AWS Config rules continuously evaluate EC2 instances against compliance criteria such as mandatory tags or VPC membership. When an instance violates a rule, Config marks it non-compliant and can trigger remediation actions like Lambda functions, but it does not block the initial launch. This makes it a detective control that identifies drift after the fact rather than preventing non-compliant resources from being created.

Why this answer

AWS Config rules can evaluate EC2 instances against a desired configuration, such as being in a VPC with specific tags. By using a custom or managed rule (e.g., 'required-tags' or 'ec2-instance-in-vpc'), you can detect non-compliant instances and trigger remediation actions. This provides continuous monitoring and reporting of compliance status without blocking the launch itself.

Exam trap

The trap here is that candidates confuse detective controls (AWS Config) with preventive controls (SCPs) or assume that monitoring tools like CloudWatch can enforce compliance, when in fact they only alert on operational metrics.

1362
MCQmedium

A company uses AWS CodeCommit as a Git repository. Developers want to enforce that all commits are signed with GPG keys. How can this be achieved?

A.Configure a Git hook in the repository to reject unsigned commits.
B.Use an IAM policy condition to deny pushes if the commit is not signed.
C.Enable the 'Require GPG signatures' option in the CodeCommit repository settings.
D.Ask developers to sign commits locally and use a pre-commit hook.
AnswerD

This is the correct approach. Developers should sign commits locally, and a pre-commit hook can enforce that unsigned commits are rejected before they are made. This provides client-side enforcement, which is the only option available within CodeCommit's constraints.

Why this answer

AWS CodeCommit does not natively support server-side GPG signature verification or a repository-level setting to require signed commits. The most practical way to enforce signed commits is through client-side Git hooks. Option D describes this approach: developers sign commits locally and a pre-commit hook ensures that every commit is signed before it is created.

While not foolproof (developers can bypass the hook), it is the only viable method among the options that aligns with CodeCommit's capabilities. Option A misinterprets 'Git hook in the repository' as a server-side hook, which CodeCommit does not support. Option B is incorrect because IAM policies cannot evaluate commit signature status.

Option C is incorrect because CodeCommit lacks such a native setting.

Exam trap

Candidates often assume that AWS services have the same features as GitHub or GitLab, but CodeCommit does not support server-side GPG signature enforcement or a native toggle. The trap is to think that IAM policies can validate commit signatures, which is not true. The only practical enforcement is through client-side Git hooks.

How to eliminate wrong answers

Option A is wrong because Git hooks are client-side scripts that run in the developer's local repository and cannot be enforced server-side in CodeCommit; they can be bypassed by the developer. Option C is wrong because CodeCommit does not have a 'Require GPG signatures' setting in its repository settings; this feature exists in other Git hosting services like GitHub or GitLab but not in CodeCommit. Option D is wrong because a pre-commit hook is client-side and only runs before the commit is created locally; it does not enforce signing on the remote repository and can be bypassed by the developer.

1363
MCQhard

A company has a critical application running on EC2 instances in an Auto Scaling group across two Availability Zones. The application uses an EBS volume for local caching. The company wants to ensure that if an instance fails, the cache data is not lost and the replacement instance can use it. Which solution meets this requirement?

A.Configure the Auto Scaling group to use a launch template that attaches the same EBS volume to new instances
B.Take periodic EBS snapshots and create a new volume from the snapshot for the replacement instance
C.Use an EBS Multi-Attach volume and attach it to all instances in the Auto Scaling group
D.Use Amazon EFS instead of EBS for the cache
AnswerD

Amazon EFS is the correct choice because it provides a fully managed NFS file system that is regional by default, with mount targets in every AZ to deliver continuous shared access. Cache data written to EFS persists independently of any individual EC2 instance, so when an instance fails and is replaced, the new instance simply mounts the same file system and immediately has the full cache. It also scales automatically and supports concurrent access from many instances, making it the only viable shared, cross-AZ cache service among these options.

Why this answer

Amazon EFS is a regional, shared file system that can be mounted by EC2 instances across multiple Availability Zones. This ensures that cache data persists independently of instance lifecycle, so if an instance fails, a replacement instance can mount the same EFS file system and access the cached data without loss. Option A is incorrect because an EBS volume can only be attached to one instance at a time (except with Multi-Attach, which is limited to the same AZ) and is tied to a specific Availability Zone, making it unsuitable for an Auto Scaling group spanning two AZs.

Additionally, automatically attaching a specific existing volume to new instances is not a standard Auto Scaling feature. Option B is incorrect because periodic snapshots are not real-time; data written between snapshots would be lost, and creating a new volume from a snapshot does not provide continuous access to the latest cache. Option C is incorrect because EBS Multi-Attach volumes can only be attached to instances within the same Availability Zone, so they cannot serve instances in both AZs of the Auto Scaling group.

1364
MCQmedium

A development team is using AWS CodeCommit as a source control repository. They want to automate the creation of a new feature branch whenever a developer creates a new Jira issue with a specific label. Which AWS service should be used to listen for Jira webhooks and trigger the branch creation?

A.Amazon EventBridge to schedule a rule every minute
B.AWS Lambda with Amazon API Gateway to receive the webhook
C.AWS CodePipeline to poll for new Jira issues
D.AWS CodeBuild to run a build when a webhook is received
AnswerB

This is the correct pattern: API Gateway exposes a public HTTPS endpoint that the Jira webhook POSTs to, and API Gateway invokes a Lambda function to process the payload. The Lambda function can then validate the webhook signature, extract branch metadata, and use the AWS CodeCommit SDK (e.g., CreateBranch with the target commit ID) to perform the branch creation in real time. This serverless design gives you a low-latency, exactly-once-ish webhook receiver without needing to run persistent infrastructure.

Why this answer

AWS Lambda with Amazon API Gateway is the correct choice because API Gateway can expose a public HTTPS endpoint that Jira can send webhook POST requests to. The Lambda function then processes the incoming payload, checks for the specific label, and uses the AWS SDK to create a new branch in CodeCommit. This provides a real-time, event-driven integration without polling or scheduled checks.

Exam trap

The trap here is that candidates often confuse AWS services that can receive webhooks (API Gateway + Lambda) with services that only react to internal AWS events (EventBridge) or that require polling (scheduled rules), leading them to choose a polling-based or build-based solution that cannot directly create branches in CodeCommit.

How to eliminate wrong answers

Option A is wrong because Amazon EventBridge scheduled rules run on a fixed interval (e.g., every minute) and cannot natively receive webhooks from external services like Jira; they are designed for internal AWS events or scheduled cron jobs, not real-time HTTP callbacks. Option C is wrong because AWS CodePipeline does not have a built-in capability to poll for Jira issues; it relies on source actions (e.g., CodeCommit, S3) or webhooks for specific services (e.g., GitHub), not arbitrary issue trackers. Option D is wrong because AWS CodeBuild is a build service that runs when triggered by a webhook, but it cannot directly create a branch in CodeCommit; it is designed to execute build commands, not perform repository management actions like branch creation.

1365
MCQhard

Refer to the exhibit. The above buildspec.yml is used in AWS CodeBuild. The build is failing during the 'build' phase with a 'FileNotFoundError: setup.py' error. What is the MOST likely cause?

A.The source code does not contain a setup.py file in the root directory.
B.The unit tests in the post_build phase are failing.
C.The Python version 3.8 is not supported by CodeBuild.
D.The artifacts configuration discarding paths is causing the error.
AnswerA

The build phase executes `python setup.py build`, which requires a `setup.py` file to be present in the current working directory (the root of the source checkout). If the repository lacks this file—for instance, if it uses `pyproject.toml` or is a plain script—the Python interpreter exits with `python: can't open file 'setup.py': [Errno 2] No such file or directory`, causing the build to fail. This error occurs during the build phase, so no later phases are reached.

Why this answer

The error 'FileNotFoundError: setup.py' indicates that the build process is attempting to run a command (likely `python setup.py install` or `pip install -e .`) that requires a `setup.py` file in the root directory of the source code. Since the buildspec.yml does not explicitly override the default build commands, CodeBuild uses the default build command for Python, which expects `setup.py` to be present. Option A is correct because the most likely cause is that the source code repository lacks a `setup.py` file in its root directory, causing the build phase to fail.

Exam trap

The trap here is that candidates may confuse the build phase error with post_build test failures or artifact configuration issues, but the specific 'FileNotFoundError: setup.py' message directly points to a missing source file, not a runtime or configuration problem.

How to eliminate wrong answers

Option B is wrong because the error occurs during the 'build' phase, not the 'post_build' phase; failing unit tests in post_build would not produce a 'FileNotFoundError: setup.py' error. Option C is wrong because Python 3.8 is fully supported by CodeBuild; the error is about a missing file, not an unsupported runtime version. Option D is wrong because the artifacts configuration with `discard-paths` only affects how artifacts are stored after a successful build; it does not cause a missing file error during the build phase.

1366
MCQhard

An organization uses AWS CloudFormation to manage infrastructure. They have a stack that creates an Amazon S3 bucket with a bucket policy that restricts access to a specific IAM role. During a recent security audit, it was discovered that the bucket policy was modified manually via the AWS Management Console, and the change was not reflected in the CloudFormation template. The security team wants to detect and remediate such drift automatically. Which combination of steps should be taken to achieve this?

A.Use AWS CloudTrail to monitor PutBucketPolicy events and send alerts to the security team via Amazon SNS.
B.Create an AWS Config rule to check if the bucket policy matches the desired policy, and use an AWS Lambda function to automatically correct any noncompliant buckets.
C.Configure S3 event notifications to invoke an AWS Lambda function whenever the bucket policy is modified.
D.Enable drift detection on the CloudFormation stack and use Amazon EventBridge to trigger an AWS Lambda function that restores the original bucket policy when drift is detected.
AnswerD

Drift detection compares the live S3 bucket policy against the CloudFormation template and reports resource drift. An EventBridge rule listens for CloudFormation drift-detection status-change events and invokes Lambda, which re-applies the original bucket policy or triggers a stack update to restore the resource. This closes the loop between detecting drift and automatically remediating it.

Why this answer

It directly addresses the requirement to both detect and automatically remediate drift in a CloudFormation-managed S3 bucket policy. CloudFormation drift detection identifies manual changes to the bucket policy, and Amazon EventBridge can trigger an AWS Lambda function that uses the CloudFormation UpdateStack API to restore the original policy from the template, ensuring the infrastructure remains in sync with the IaC definition.

Exam trap

The trap here is that candidates often confuse S3 event notifications (which are for object-level events) with control plane operations like PutBucketPolicy, leading them to choose Option C, or they assume AWS Config alone can remediate drift without understanding that Config does not automatically correct CloudFormation stack resources.

How to eliminate wrong answers

Option A is wrong because AWS CloudTrail monitoring of PutBucketPolicy events only provides detection via alerts; it does not include any automated remediation to restore the original policy. Option B is wrong because an AWS Config rule can detect noncompliant bucket policies, but the suggested Lambda function would need to directly modify the S3 bucket policy, which would create a new drift event and not correct the CloudFormation stack itself, leaving the template out of sync. Option C is wrong because S3 event notifications are triggered by object-level events (e.g., PUT, POST) on the bucket, not by changes to the bucket policy; PutBucketPolicy is a control plane API call, not an S3 event notification trigger.

1367
Multi-Selecteasy

A company is using AWS CloudFormation to deploy infrastructure. The DevOps team wants to receive notifications when a stack creation fails. Which services can be used together to send an email notification on stack failure? (Choose TWO.)

Select 2 answers
A.AWS Lambda
B.Amazon Simple Queue Service (SQS)
C.Amazon Simple Notification Service (SNS)
D.AWS CloudFormation
E.Amazon CloudWatch
AnswersC, D

Amazon SNS is a fully managed pub/sub messaging service that supports multiple subscription protocols, including email (as well as HTTP, Lambda, SQS, etc.). To receive CloudFormation stack event notifications, you create an SNS topic, subscribe an email address to it, and specify the topic ARN in the CloudFormation stack's `NotificationARNs` property. When the stack state changes, CloudFormation publishes the event to the topic, and SNS delivers an email to every confirmed subscriber.

Why this answer

Amazon SNS (Option C) is correct because it can send email notifications to subscribers when a CloudFormation stack creation fails. AWS CloudFormation (Option D) is correct because it can directly publish failure events to an SNS topic via the 'NotificationARNs' parameter in stack creation, enabling automated email alerts without additional services.

Exam trap

The trap here is that candidates might think CloudWatch (Option E) can send emails directly, but CloudWatch only publishes to SNS or other targets; it cannot natively deliver email notifications without SNS.

1368
Multi-Selecthard

A company is using Amazon CloudWatch Synthetics canaries to monitor its web application endpoints. The canaries are failing intermittently with timeout errors. The DevOps team needs to troubleshoot the root cause. Which THREE actions should they take? (Select THREE.)

Select 3 answers
A.Use AWS CloudTrail to review Canary API calls.
B.Increase the canary timeout configuration to allow more time for the endpoint to respond.
C.Check the EC2 instance CPU utilization in the VPC where the canaries run.
D.Review VPC Flow Logs to see if requests are being dropped or denied.
E.Examine the canary logs in CloudWatch Logs for error messages.
AnswersB, D, E

If the timeout is too low, increasing it may resolve false positives.

Why this answer

Options B, D, and E are correct. B: Increasing the canary timeout configuration can resolve timeout errors if the endpoint is slow but still functional. D: Reviewing VPC Flow Logs helps identify network issues such as dropped or denied requests that could cause timeouts.

E: Examining canary logs in CloudWatch Logs provides detailed error messages and execution traces to pinpoint the failure cause. Option A is incorrect because CloudTrail records API calls, not canary execution details; canary logs are in CloudWatch Logs. Option C is incorrect because canaries run in AWS Lambda, not on EC2 instances, so EC2 CPU utilization is irrelevant.

1369
Multi-Selectmedium

Which THREE steps are required to set up a continuous deployment pipeline using AWS CodePipeline that deploys a Docker-based application to Amazon ECS? (Choose three.)

Select 3 answers
A.Create a deploy stage that uses AWS CodeDeploy to deploy to Amazon ECS
B.Create a source stage that uses AWS CodeCommit as the source provider
C.Create a deploy stage that uses Amazon ECS as the deploy provider with an imagedefinitions.json file
D.Create an invoke stage that uses AWS Lambda to update the ECS service
E.Create a build stage that uses AWS CodeBuild to build a Docker image and push it to Amazon ECR
AnswersB, C, E

Creating a source stage with AWS CodeCommit as the source provider is required because the pipeline needs a trigger and a location for the application source code, including the Dockerfile and any build specifications. CodeCommit is the native Git repository service on AWS, and integrating it with CodePipeline allows automatic pipeline execution on every push to the configured branch. This provides version-controlled source securely within AWS, avoiding the need for external credentials or additional network access.

Why this answer

AWS CodePipeline requires a source stage to detect changes in the source code repository. AWS CodeCommit is a fully managed source control service that integrates natively with CodePipeline, allowing automatic pipeline execution when new commits are pushed to the specified branch. This is a fundamental step in establishing a continuous delivery workflow.

Exam trap

The trap here is that candidates often confuse the deploy provider options and incorrectly select AWS CodeDeploy for ECS deployments, not realizing that CodePipeline has a dedicated ECS deploy provider that uses imagedefinitions.json instead.

1370
MCQhard

A company uses AWS Organizations with multiple accounts. The security team wants to restrict the use of specific instance types across all accounts to reduce costs and enforce compliance. Which approach should be used?

A.Use AWS Config rules to detect non-compliant instance types
B.Apply a service control policy (SCP) to the root organizational unit to deny the instance types
C.Create IAM policies in each account to deny the use of the instance types
D.Use AWS CloudFormation templates to enforce instance type selection
AnswerB

SCPs can deny actions across all accounts.

Why this answer

Service control policies (SCPs) in AWS Organizations allow central control over permissions across all accounts, including the ability to deny specific instance types. This prevents any account from launching the restricted instance types. Option A is incorrect because AWS Config rules can only detect non-compliant resources, not prevent their creation.

Option C is incorrect because IAM policies applied within individual accounts can be overridden by account administrators, and managing policies per account is not scalable. Option D is incorrect because AWS CloudFormation templates can enforce instance types only within stacks that use the template, but they do not prevent users from launching instances outside of CloudFormation.

1371
MCQeasy

A company uses Amazon RDS for MySQL as its database. The operations team notices that the database CPU utilization is consistently above 90% during peak hours, causing slow query responses. The team needs to quickly reduce CPU load without changing the application code. Which action should the team take?

A.Enable Multi-AZ deployment.
B.Modify the DB parameter group to increase max_connections.
C.Add a read replica to offload read traffic.
D.Enable Performance Insights and analyze the top queries.
AnswerD

Performance Insights delivers a comprehensive, real-time view of database load, breaking down utilization by waits, SQL statement, and host. By drilling into the 'Top SQL' section, you can pinpoint the exact queries consuming the most CPU, along with statistics such as rows examined and temp tables. This evidence-based approach allows you to optimize indexes or rewrite expensive statements, directly addressing the observed CPU spike.

Why this answer

Enabling Performance Insights allows the team to identify the specific queries that are consuming CPU resources. By analyzing these top queries, the team can take targeted actions such as optimizing queries or adding indexes to reduce CPU load without changing application code. Option A is incorrect because Multi-AZ deployment provides high availability and failover support but does not reduce CPU utilization.

Option B is incorrect because increasing max_connections allows more concurrent connections, which can actually increase CPU load rather than reduce it. Option C is incorrect because adding a read replica offloads read traffic but does not reduce CPU load on the primary instance, and typically requires application changes to route read queries to the replica.

1372
MCQmedium

A company uses AWS Elastic Beanstalk to deploy a web application. They have set up a CI/CD pipeline using AWS CodePipeline. The pipeline has a source stage from GitHub (using the GitHub source action) and a deploy stage that deploys to Elastic Beanstalk. The deployment is configured to use the 'Immutable' deployment policy. Recently, the deployment started failing with the error: 'The environment is in an unhealthy state. The deployment failed.' The developer checks the Elastic Beanstalk environment and sees that the new instances are not passing health checks. The application logs show that the new instances cannot connect to the existing Amazon RDS database. What is the most likely cause?

A.The RDS database is not available because it is being updated during the deployment.
B.The deployment policy should be changed to 'Rolling' to ensure instances are updated in place.
C.The security group attached to the Elastic Beanstalk environment does not allow the new instances to connect to the RDS database.
D.The application code has a bug that causes the health check to fail.
AnswerC

This is correct. When Elastic Beanstalk performs a deployment that replaces instances (such as an immutable or rolling update with a new Auto Scaling group), the new instances are launched with the environment's current security group. If that security group is not explicitly added as an allowed source in the RDS database's security group inbound rules, the new instances will be denied TCP (or PostgreSQL/MySQL) connections, even though the application code and database settings are unchanged. You must authorize the Elastic Beanstalk environment's security group ID (or its attached load balancer's security group) in the RDS security group to allow traffic from the latest instance replacements.

Why this answer

With immutable deployments, Elastic Beanstalk launches new instances in a new Auto Scaling group. These new instances need to be able to connect to the existing RDS database. If the security group attached to the Elastic Beanstalk environment (or the RDS security group) does not allow inbound traffic from the new instances, they will fail to connect, causing health check failures.

Option A is incorrect because the RDS database is existing and not being updated during deployment. Option B is incorrect because changing the deployment policy to 'Rolling' would not resolve the connectivity issue; rather, it might cause downtime. Option D is incorrect because the application code is unchanged, so a bug is unlikely to be introduced by the deployment itself.

1373
MCQhard

A company runs a critical application on EC2 instances behind an Application Load Balancer (ALB). They want to protect against SQL injection and cross-site scripting attacks. Which AWS service should be integrated with the ALB?

A.AWS Network Firewall
B.AWS WAF
C.AWS Shield Advanced
D.Amazon GuardDuty
AnswerB

AWS WAF is the correct choice because it is a fully managed web application firewall that attaches directly to an Application Load Balancer to inspect each incoming HTTP/HTTPS request at the application layer. It can block, allow, or count requests matching conditions such as SQL injection signatures, XSS patterns, IP reputation lists, geo restrictions, and header or body size limits. AWS-managed rule groups, including the OWASP Top 10 rule sets, provide ready-made protection, and WAF integrates natively with ALB to stop malicious traffic before it reaches the EC2 instances.

Why this answer

AWS WAF is a web application firewall that integrates directly with Application Load Balancers to inspect HTTP/HTTPS traffic. It uses managed rule groups to block common attack patterns like SQL injection (e.g., detecting malicious SQL keywords in query strings) and cross-site scripting (e.g., identifying script tags in user input). This makes it the correct choice for protecting web applications at Layer 7.

Exam trap

The trap here is that candidates confuse AWS WAF (Layer 7 application firewall) with AWS Network Firewall (Layer 3/4 stateful firewall) or AWS Shield (DDoS protection), not realizing that only WAF provides the specific rule sets needed for SQL injection and XSS mitigation.

How to eliminate wrong answers

Option A is wrong because AWS Network Firewall operates at Layers 3 and 4 (network and transport) and cannot inspect HTTP payloads for SQL injection or XSS patterns. Option C is wrong because AWS Shield Advanced provides DDoS protection at Layers 3/4 and 7 but does not include web application firewall rules for SQLi/XSS; it focuses on volumetric attack mitigation. Option D is wrong because Amazon GuardDuty is a threat detection service that analyzes VPC flow logs, DNS logs, and CloudTrail events for malicious activity, not inline HTTP request inspection.

1374
MCQmedium

A company is using AWS Lambda to process events from an Amazon SQS queue. The Lambda function is configured with a batch size of 10 and a maximum concurrency of 5. Recently, the function started experiencing high error rates and the SQS queue's ApproximateNumberOfMessagesVisible metric is increasing. The CloudWatch logs show that the function is timing out after 30 seconds. The function makes calls to an external API that sometimes takes more than 30 seconds to respond. The DevOps engineer needs to reduce the backlog and prevent message loss. The engineer is considering the following actions: A) Increase the Lambda function timeout to 60 seconds and increase the SQS visibility timeout to 90 seconds. B) Decrease the batch size to 1 to avoid processing multiple messages at once. C) Increase the Lambda function reserved concurrency to 100 to allow more concurrent executions. D) Use a dead-letter queue to capture messages that fail processing after all retries. Which combination of actions should the engineer take?

A.Use a dead-letter queue to capture messages that fail processing after all retries.
B.Decrease the batch size to 1 to avoid processing multiple messages at once.
C.Increase the Lambda function timeout to 60 seconds and increase the SQS visibility timeout to 90 seconds.
D.Increase the Lambda function reserved concurrency to 100 to allow more concurrent executions.
AnswerC

This is correct because an SQS-triggered Lambda invocation has a maximum execution window set by the function timeout, and the SQS visibility timeout controls when unacknowledged messages become visible again for redelivery. If the function timeout is too short, valid work gets aborted, and if the visibility timeout is shorter than the processing time, the message is re-delivered before the first attempt finishes, causing duplicate work and retries that inflate the backlog. Setting the visibility timeout to 90 seconds (longer than the 60-second function timeout) ensures the message stays hidden until the Lambda function either succeeds or itself times out, giving the function the full time it needs.

Why this answer

The correct action because increasing the Lambda function timeout to 60 seconds allows the function to wait longer for the external API, and increasing the SQS visibility timeout to 90 seconds prevents messages from becoming visible again before the function completes. This reduces unnecessary retries and helps clear the backlog. Option A (DLQ) is useful for capturing failed messages but does not address the timeout issue.

Option B (decrease batch size) reduces throughput and worsens the backlog. Option D (increase concurrency) may lead to more timeouts if the function still cannot complete within the existing timeout.

1375
MCQhard

A DevOps engineer is troubleshooting an AWS Lambda function that processes messages from an Amazon SQS queue. The function is configured with a reserved concurrency of 5 and a batch size of 10. The SQS queue has a visibility timeout of 30 seconds, and the Lambda function typically completes processing each batch in 10 seconds. Recently, the engineer noticed that messages are repeatedly processed, causing duplicates. The CloudWatch Logs show that the function is experiencing throttling errors. What is the MOST likely cause of the duplicate processing?

A.Lambda is throttling the function, and the visibility timeout expires before the function can process the messages.
B.The SQS queue's dead-letter queue (DLQ) is not configured, causing messages to be reprocessed.
C.The function's batch size is too large, causing timeouts.
D.The function's reserved concurrency is too high, causing overloading.
AnswerA

Lambda has a concurrency limit (account, region, or reserved concurrency). When the event source mapping polls SQS and receives messages but the service can't obtain a concurrency slot to invoke the function, those messages stay 'in flight' with the SQS visibility timer running. If the visibility timeout is shorter than the time spent throttled, SQS makes the messages visible again and the poller can receive them a second time — so the same message is processed after the function eventually runs, creating apparent duplicates. This matches the symptom of repeated processing rather than a poison-pill failure or configuration error.

Why this answer

When Lambda throttles due to reserved concurrency of 5, it cannot process all incoming messages. SQS does not delete messages after sending them to Lambda; Lambda must explicitly delete them after processing. If throttling occurs frequently, messages remain in the queue while Lambda retries, but if the visibility timeout of 30 seconds expires before a successful invocation processes the batch, the messages become visible to other consumers or the same consumer, leading to duplicate processing.

The typical completion time of 10 seconds per batch is much shorter than the visibility timeout, but throttling delays processing beyond 30 seconds, causing the visibility timeout to expire. Option B is incorrect because a dead-letter queue stores messages that fail repeatedly, but it does not cause duplicates. Option C is incorrect because the batch size of 10 is within the maximum allowed, and the function completes in 10 seconds, so timeout is not the issue.

Option D is incorrect because a higher reserved concurrency would reduce throttling, not cause duplicates.

1376
MCQmedium

A company uses AWS CloudFormation to manage infrastructure. The DevOps engineer wants to implement a CI/CD pipeline that builds and tests a CloudFormation template and then deploys it across multiple AWS accounts. Which combination of services should the engineer use?

A.Use CodeBuild to run cfn-lint and then use AWS Lambda to deploy stacks across accounts.
B.Use CodePipeline with separate CodeBuild projects for validation and CloudFormation deployment actions assuming IAM roles in target accounts.
C.Use CodePipeline with CodeDeploy to deploy CloudFormation stacks across accounts.
D.Use CodePipeline with a single CodeBuild project to run cfn-lint and deploy to all accounts.
AnswerB

CodePipeline natively orchestrates cross-account deployments through its CloudFormation action, which can be configured with a role ARN to assume in each target account. A dedicated CodeBuild project running cfn-lint performs static validation in an isolated build stage, while subsequent CloudFormation deployment actions use that assumed role to create or update stacks per account. This separation allows you to add manual approvals, run parallel deployments, and reuse the same artifact across accounts without embedding cloud logic in a single script.

Why this answer

It uses CodePipeline to orchestrate the CI/CD workflow, with separate CodeBuild projects for template validation (e.g., cfn-lint) and deployment actions that assume IAM roles in target accounts. This design ensures cross-account access via role assumption, which is the recommended pattern for multi-account deployments, and separates validation from deployment for better control and rollback.

Exam trap

The trap here is that candidates often confuse CodeDeploy with CloudFormation deployment actions, or assume that a single CodeBuild project can handle cross-account deployments without understanding the need for IAM role assumption and pipeline-level orchestration.

How to eliminate wrong answers

Option A is wrong because using Lambda to deploy stacks across accounts lacks the orchestration, rollback, and approval capabilities of CodePipeline, and it does not natively support cross-account IAM role assumption for deployment. Option C is wrong because CodeDeploy is designed for deploying applications (e.g., EC2, Lambda, ECS) and does not have native actions to deploy CloudFormation stacks; CloudFormation deployment actions in CodePipeline are separate. Option D is wrong because a single CodeBuild project that both validates and deploys to all accounts violates the principle of least privilege and separation of concerns, and CodeBuild cannot natively assume IAM roles in multiple target accounts without complex scripting, whereas CodePipeline actions can directly assume roles.

1377
MCQeasy

A developer wants to automate the testing of a serverless application built with AWS Lambda and Amazon API Gateway. Which AWS service is best suited for running integration tests as part of a CI/CD pipeline?

A.AWS CodeDeploy
B.AWS CodeBuild
C.Amazon CloudWatch
D.AWS CloudFormation
AnswerB

AWS CodeBuild is a fully managed continuous integration service that compiles code, runs test suites, and produces build artifacts in a scalable, ephemeral environment. Its buildspec configuration can install dependencies, execute unit and integration tests against a serverless app (using frameworks like Jest or Mocha), and publish test reports to AWS services. CodeBuild integrates naturally with AWS CodePipeline, making it the correct choice for automating testing of a serverless application.

Why this answer

AWS CodeBuild is best suited for running integration tests as part of a CI/CD pipeline because it is a fully managed continuous integration service that can compile source code, run tests, and produce software packages. For a serverless application using Lambda and API Gateway, CodeBuild can execute integration tests against deployed API endpoints, validate Lambda function responses, and integrate seamlessly with other AWS developer tools like CodePipeline. It supports custom build environments and can run test frameworks (e.g., Postman/Newman, Jest) directly in the pipeline.

Exam trap

The trap here is that candidates often confuse AWS CodeBuild with AWS CodeDeploy, assuming that deployment services inherently include testing capabilities, but CodeDeploy only handles the deployment process and does not execute test scripts or validate application behavior.

How to eliminate wrong answers

Option A is wrong because AWS CodeDeploy is a deployment service that automates code deployments to compute services like EC2, Lambda, or ECS, but it does not have built-in capabilities to run integration tests or execute test scripts as part of a CI/CD pipeline. Option C is wrong because Amazon CloudWatch is a monitoring and observability service for logs, metrics, and alarms; it cannot run integration tests or execute code, making it unsuitable for automated testing in a pipeline. Option D is wrong because AWS CloudFormation is an Infrastructure as Code (IaC) service used to provision and manage AWS resources; while it can deploy the serverless application, it lacks the ability to execute integration tests or validate application behavior after deployment.

1378
MCQhard

A company uses AWS CloudTrail to log all API calls across multiple accounts in AWS Organizations. The DevOps team wants to detect and alert on any IAM user who creates an access key and then uses it to make API calls within 24 hours, as this may indicate a compromised account. Which combination of actions should be taken to achieve this with minimal latency?

A.Use Amazon Athena to query CloudTrail logs in S3 every hour and send alerts for matches.
B.Create an Amazon EventBridge rule that matches CreateAccessKey and any subsequent API call from the same user within 24 hours.
C.Stream CloudTrail logs to CloudWatch Logs and create a metric filter to detect the pattern, then set an alarm.
D.Enable S3 Event Notifications on the CloudTrail S3 bucket to invoke a Lambda function that processes new log files and checks for the pattern.
AnswerD

S3 Event Notifications on the CloudTrail bucket fire for each new log file object, invoking a Lambda function within seconds of delivery, which is near real time because CloudTrail delivers log files roughly every 5 minutes. The Lambda function can decompress the gzipped JSON, parse all API records, and use a DynamoDB table to record when a user creates an access key, then check subsequent calls in the same or later log files against that table to identify a match within 24 hours. This event-driven architecture minimizes latency compared to polling and supports the stateful correlation needed to detect the suspicious pattern accurately.

Why this answer

CloudTrail delivers logs to S3 within about 15 minutes; using S3 Events to trigger a Lambda that analyzes the logs in near-real-time allows detection within the 24-hour window. Option A is wrong because CloudWatch Logs Insights queries are not real-time and require logs to be streamed to CloudWatch Logs, which adds latency. Option B is wrong because Athena is not real-time.

Option C is wrong because EventBridge can detect API calls but cannot correlate the creation of a key with its subsequent use in a single rule; it would require complex pattern matching.

1379
Multi-Selectmedium

Which TWO actions should a DevOps engineer take to prevent an S3 bucket from being publicly accessible? (Choose two.)

Select 2 answers
A.Enable S3 Versioning on the bucket.
B.Enable S3 Block Public Access at the bucket level.
C.Enable S3 Server Access Logging.
D.Configure a bucket policy that explicitly denies anonymous access.
E.Configure a lifecycle policy to delete objects.
AnswersB, D

Amazon S3 Block Public Access provides a bucket-level setting that, when enabled, overrides all other public-access grants by ignoring bucket policies and object ACLs that allow public access, including those that grant access to `*`. This control is evaluated at the edge before any policy or ACL decision and is not overridable by explicit allow statements, making it a highly effective preventative measure. Because it is a native access control, enabling it immediately blocks both existing and future public exposure without requiring you to rewrite the bucket policy.

Why this answer

Enabling S3 Block Public Access at the bucket level provides a centralized, override-proof mechanism to prevent any public access to the bucket, regardless of other policies or ACLs. This setting blocks all public access by default, including access granted via bucket policies, access control lists (ACLs), or object-level permissions, and cannot be overridden by any other S3 configuration.

Exam trap

The trap here is that candidates may think enabling S3 Versioning or Server Access Logging can prevent public access, but these features are designed for data protection and auditing, not for access control enforcement.

1380
Multi-Selectmedium

Which TWO actions should a DevOps engineer take to secure a web application running on EC2 instances behind an Application Load Balancer? (Choose two.)

Select 2 answers
A.Configure the EC2 instance security group to allow inbound traffic from 0.0.0.0/0 on port 443.
B.Use a network ACL to allow inbound HTTP/S traffic only from the ALB's subnet.
C.Place the EC2 instances behind an Amazon CloudFront distribution.
D.Enable AWS WAF on the ALB to filter malicious requests.
E.Configure the EC2 instance security group to allow inbound traffic only from the ALB's security group.
AnswersD, E

Attaching AWS WAF to the Application Load Balancer adds a managed Layer 7 firewall that filters incoming HTTP(S) requests before they reach the target group. WAF can block common web exploits such as SQL injection, cross-site scripting (XSS), and excessive request patterns via rate-based rules, and it integrates with AWS Managed Rules for OWASP Top 10 protection. This is a required security action for a publicly exposed web workload because security groups alone only control transport-level access and cannot inspect payloads, and it can be used alongside AWS Shield for DDoS mitigation.

Why this answer

Correct answers are D and E. Option D: AWS WAF on the ALB helps filter out common web exploits. Option E: Configuring the EC2 security group to allow inbound traffic only from the ALB's security group ensures that direct access to instances is blocked, forcing traffic through the ALB.

Option A is incorrect because allowing all inbound traffic (0.0.0.0/0) on port 443 exposes instances directly to the internet, bypassing the ALB. Option B is incorrect: network ACLs are stateless and less granular than security groups; using a NACL to allow traffic from the ALB's subnet is not a recommended practice for instance-level security. Option C is incorrect: placing EC2 instances behind CloudFront is a content delivery optimization, not a security measure to protect the application layer; it does not replace the need for WAF or security group restrictions.

1381
MCQhard

A DevOps engineer is troubleshooting a failed AWS CodeBuild project. The build fails with an error indicating that the IAM role does not have permission to describe Amazon ECR repositories. The role used by CodeBuild has the following policy attached: {"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["ecr:GetAuthorizationToken","ecr:BatchCheckLayerAvailability","ecr:GetDownloadUrlForLayer","ecr:BatchGetImage"],"Resource":"*"}]}. What is the missing permission?

A.ecr:InitiateLayerUpload
B.ecr:GetRepositoryPolicy
C.ecr:ListImages
D.ecr:DescribeRepositories
AnswerD

ecr:DescribeRepositories is the exact IAM action required to call the ECR DescribeRepositories API, which CodeBuild uses to list repositories and retrieve their metadata (repository name, ARN, URI, creation timestamp, and image scanning configuration). If this permission is missing from the CodeBuild service role, any attempt to enumerate or describe repositories will fail with AccessDenied. This is the root cause of the failure in the scenario.

Why this answer

The policy allows several ECR actions but does not include 'ecr:DescribeRepositories'. The error specifically mentions 'describe' which is that action. The other actions are present.

1382
MCQhard

A DevOps team is using this IAM policy to allow a CI/CD pipeline to launch EC2 instances and retrieve parameters. However, the pipeline is failing with an 'AccessDenied' error when trying to create an instance. The pipeline uses a role with this policy attached. What is the most likely cause?

A.The condition StringEquals on InstanceType is incorrectly formatted.
B.The pipeline does not have permission to call ssm:GetParameter because the resource is not specified.
C.The policy does not grant permissions on additional resources required for RunInstances, such as images and network interfaces.
D.The policy must include a 'Resource' for the 'ec2:DescribeInstances' action to be valid.
AnswerC

RunInstances requires permissions on resources like images, security groups, etc., which are not allowed.

Why this answer

The IAM policy likely only grants permissions on the 'ec2:RunInstances' action for the EC2 instance resource (arn:aws:ec2:region:account:instance/*), but creating an EC2 instance also requires permissions on other resources such as Amazon Machine Images (AMI), security groups, network interfaces, subnets, etc. Without explicit permissions on these additional resources, the RunInstances call fails with AccessDenied. Option A is incorrect because the condition syntax does not cause an AccessDenied; it would simply not match if poorly formatted.

Option B is incorrect because the ssm:GetParameter action is allowed by the policy if it includes a resource specification, but the failure is on RunInstances, not SSM. Option D is incorrect because DescribeInstances does not require a Resource specification in the policy; the policy syntax is valid.

1383
MCQhard

A company uses AWS CloudFormation to manage infrastructure as code. The security team requires that all changes to CloudFormation stacks be reviewed and approved before execution. The team has enabled StackSets to deploy stacks across multiple accounts. A junior developer accidentally runs a stack update that modifies a production security group, opening SSH access to 0.0.0.0/0. The security team wants to prevent this type of incident in the future. They need a solution that enforces a mandatory approval workflow for all stack updates, while still allowing automated deployments from approved CI/CD pipelines. Which solution meets these requirements?

A.Use CloudFormation change sets and require that they be manually executed by a senior engineer.
B.Create an IAM policy that denies cloudformation:UpdateStack unless the request is made using a specific service role with a path /ci-cp/, and configure the CI/CD pipeline to assume that role.
C.Attach a resource-based policy to the stack that denies updates from any principal that does not have a specific tag.
D.Enable termination protection on all production stacks and require MFA for stack updates.
AnswerB

This is correct because it embeds the approval workflow into IAM itself, making it impossible to bypass via the AWS Management Console or CLI. The IAM policy denies cloudformation:UpdateStack for all principals except when the request is made by a service role with the path /ci-cp/, which can be enforced using the aws:PrincipalPath condition key. The CI/CD pipeline assumes that dedicated service role, so only code changes that pass through the pipeline can trigger stack updates. This combines an explicit Deny with a positive condition, eliminating any dependence on manual discipline and ensuring that junior users without that role cannot update stacks even if they have broad IAM permissions.

Why this answer

By creating an IAM policy that denies cloudformation:UpdateStack unless the request comes from a specific service role with a path /ci-cp/, and configuring the CI/CD pipeline to assume that role, you ensure that only approved automated pipelines can perform stack updates. This enforces mandatory approval because the CI/CD pipeline itself can include a manual approval step before assuming the role. Option A is incorrect: change sets with manual execution by a senior engineer still require manual intervention, but the junior developer could potentially execute the change set if they have the execute permission; also, it does not prevent the developer from directly running an update.

Option C is incorrect: resource-based policies on stacks are not supported in CloudFormation; stacks do not have resource-based policies. Option D is incorrect: termination protection prevents deletion, not updates; MFA protects the user's credentials but does not prevent the user from making unauthorized updates if they have the permissions.

1384
Multi-Selecthard

A company has a multi-account AWS organization. The security team needs to detect and respond to security incidents across all accounts centrally. Which THREE services should the team use together? (Choose three.)

Select 3 answers
A.AWS Security Hub
B.Amazon Inspector
C.Amazon Macie
D.Amazon GuardDuty
E.Amazon Detective
AnswersA, D, E

AWS Security Hub is the correct answer because it is designed as a multi-account, multi-region aggregation service that centralizes security findings from AWS services and partner products. It enables a delegated administrator to view a consolidated security posture across the entire AWS Organizations hierarchy, evaluate compliance against standards like CIS and NIST, and automate responses via custom actions and AWS Config rules.

Why this answer

AWS Security Hub (Option A) centrally aggregates and prioritizes security findings from multiple AWS services and accounts, enabling cross-account visibility. Amazon GuardDuty (Option D) provides intelligent threat detection across accounts by analyzing VPC Flow Logs, DNS logs, and CloudTrail events. Amazon Detective (Option E) simplifies security investigation by automatically analyzing and correlating events from GuardDuty, Security Hub, and other sources.

Together, these three services form a comprehensive incident detection and response solution. Option B (Inspector) is for vulnerability assessments, not incident response, and Option C (Macie) is for data classification, making them incorrect for this use case.

1385
MCQhard

A company runs a web application on Amazon EC2 instances behind an Application Load Balancer (ALB). The application experiences intermittent 503 errors. The engineer suspects the ALB is returning these errors because the target instances are unhealthy. Which metric should the engineer monitor to confirm this suspicion?

A.RequestCount
B.UnhealthyHostCount
C.HealthyHostCount
D.TargetResponseTime
AnswerC

HealthyHostCount directly reflects the number of targets that are passing the configured health checks. For a target group with EC2 instances, it is the authoritative CloudWatch metric for monitoring target health; when all instances fail, this value drops to zero, leaving the ALB with no registered and healthy targets to serve traffic, which causes it to return HTTP 503 Service Unavailable. Therefore, it is the correct metric to identify the described incident.

Why this answer

The ALB publishes 'HealthyHostCount' metric showing the number of healthy targets. When this count drops to zero, the ALB cannot forward requests and returns 503 errors. Option A (RequestCount) is incorrect because it measures total requests, not health.

Option B (UnhealthyHostCount) is a valid metric but does not directly confirm the suspicion that targets are unhealthy; a decreasing HealthyHostCount is more direct. Option D (TargetResponseTime) measures latency, not health status.

1386
MCQmedium

A DevOps engineer notices that a CodePipeline execution fails at the deploy stage when deploying a Lambda function using AWS CloudFormation. The error message indicates that the stack update failed because the Lambda function's code is too large. What is the most likely cause?

A.The IAM role used by CloudFormation does not have sufficient permissions to update the Lambda function.
B.The CloudFormation template exceeds the maximum size limit for templates.
C.The artifact stored in the pipeline's S3 bucket exceeds the maximum allowed size for CodePipeline artifacts.
D.The Lambda function deployment package exceeds the maximum allowed size for Lambda.
AnswerD

Lambda enforces hard quotas on deployment package size: 50 MB for a direct .zip upload, 250 MB for a .zip uploaded from an S3 bucket, and 250 MB for the uncompressed size including layers. In a CodePipeline/CloudFormation deployment, the Lambda code is staged in S3 and then referenced by CloudFormation; if that package exceeds Lambda's 250 MB uncompressed limit, the underlying API call returns a RequestEntityTooLargeException, which exactly matches the size-related failure observed.

Why this answer

The error message explicitly states that the Lambda function's code is too large, which directly points to the Lambda deployment package exceeding the maximum allowed size. AWS Lambda has a hard limit of 50 MB for zipped direct uploads (or 250 MB for container images), and CloudFormation will fail the stack update if the package exceeds this limit during a deploy stage.

Exam trap

The trap here is that candidates may confuse CodePipeline artifact size limits (which are much larger) with Lambda deployment package size limits, or incorrectly attribute the failure to CloudFormation template size limits or IAM permissions, when the error message directly indicates the Lambda code size is the issue.

How to eliminate wrong answers

Option A is wrong because insufficient IAM permissions would produce an 'access denied' or 'unauthorized' error, not a 'code is too large' error. Option B is wrong because CloudFormation template size limits (1 MB for templates, 51,200 bytes for parameters) are unrelated to the Lambda function code size; the error is about the function's code, not the template. Option C is wrong because CodePipeline artifact size limits (default 2 GB per artifact) are much larger than Lambda's code size limit, and the error message specifically mentions the Lambda function's code, not the pipeline artifact.

1387
Multi-Selectmedium

Which TWO actions can be used to improve the security of a CI/CD pipeline that uses AWS CodePipeline? (Choose two.)

Select 2 answers
A.Enable encryption for artifacts stored in the pipeline's S3 bucket.
B.Use cross-account actions with appropriate IAM roles to limit access.
C.Configure the source action to poll for changes instead of using webhooks.
D.Store secrets in the pipeline environment variables in plain text.
E.Use a single IAM role for all pipeline actions to simplify permissions.
AnswersA, B

By enabling default encryption on the S3 bucket used as CodePipeline's artifact store—or specifying an AWS KMS customer-managed key in the pipeline settings—all build outputs and source artifacts are encrypted at rest with either SSE-S3 or SSE-KMS. This protects sensitive data from unauthorized direct access to the bucket, even if the bucket policy or ACL is misconfigured. Using KMS adds an additional layer of control by letting you restrict which roles can decrypt artifacts and enabling CloudTrail auditing of all decrypt operations.

Why this answer

AWS CodePipeline stores artifacts in an S3 bucket, and enabling default encryption (SSE-S3 or SSE-KMS) ensures that all objects at rest are encrypted, protecting sensitive build outputs and source code from unauthorized access if the bucket is compromised. This is a fundamental security best practice for data at rest in any CI/CD pipeline.

Exam trap

The trap here is that candidates often confuse 'simplifying permissions' (Option E) with security best practices, but the DOP-C02 exam emphasizes least privilege and role separation over convenience.

1388
Multi-Selectmedium

A company has a CI/CD pipeline that builds a Docker image and pushes it to Amazon ECR. The build step uses AWS CodeBuild. The engineer wants to ensure that the ECR repository has a lifecycle policy to expire untagged images after 14 days. Which TWO actions are required? (Choose 2.)

Select 2 answers
A.Use the docker tag command to tag images with a timestamp.
B.Create an ECR lifecycle policy for the repository.
C.Add a lifecycle policy rule in the buildspec.yml file.
D.Configure the lifecycle policy in the CodeBuild project settings.
E.Define a rule that expires untagged images after 14 days.
AnswersB, E

Creating an ECR lifecycle policy is the correct action because it automatically applies expiration rules to images in the chosen repository. Lifecycle policies evaluate images based on criteria like tag status and age, then expire matching images for you. They are managed through the ECR service (console, CLI, or SDK), not through the CI/CD build steps, and are the standard mechanism for controlling image retention and storage costs.

Why this answer

ECR lifecycle policies are configured at the repository level, not in CodeBuild or buildspec files. Option E is correct because the rule must specifically target untagged images and set an expiration of 14 days using the `expire` action with `sinceImagePushed` and `countType` set to `sinceImagePushed` and `countNumber` set to 14. Together, these two actions ensure the lifecycle policy exists and contains the correct rule to expire untagged images after 14 days.

Exam trap

The trap here is that candidates confuse where lifecycle policies are configured (ECR repository level) with where build steps are defined (CodeBuild or buildspec), leading them to incorrectly select options that involve CodeBuild or buildspec modifications.

1389
MCQmedium

A company is deploying a web application on AWS and needs to ensure that all traffic to the application is encrypted in transit. The application runs behind an Application Load Balancer (ALB). Which configuration should be used to enforce HTTPS-only access?

A.Configure the web server on the EC2 instances to only respond to HTTPS requests.
B.Create an HTTPS listener on the ALB and configure a redirect rule from HTTP to HTTPS.
C.Configure the security group of the ALB to only allow inbound HTTPS traffic.
D.Use AWS CloudFront with a custom SSL certificate and set the viewer protocol policy to Redirect HTTP to HTTPS.
AnswerB

Create an HTTPS listener on the ALB and configure a redirect rule from HTTP to HTTPS. This is the correct pattern because ALB listeners combine a protocol/port with rule actions: the HTTP (port 80) listener can have a rule that returns a 301/302 redirect to the same path on the HTTPS listener (port 443). This enforces HTTPS at the access point, automatically upgrades clients, and leaves web servers free to handle only HTTP/HTTPS as needed, typically with TLS terminated at the ALB.

Why this answer

An ALB can be configured with an HTTPS listener and a redirect rule that sends HTTP traffic to HTTPS, enforcing encrypted transit at the load balancer level. Option A is incorrect because configuring the web server to only respond to HTTPS does not prevent HTTP traffic from reaching the ALB; the ALB would still accept HTTP. Option C is incorrect because security groups filter traffic based on ports and IP addresses but cannot redirect HTTP to HTTPS; they only allow or deny traffic.

Option D is incorrect because while CloudFront can redirect HTTP to HTTPS, the question asks for a configuration on the ALB itself, not an additional service.

1390
MCQhard

A company uses AWS CloudFormation to deploy a multi-tier application. The stack includes an RDS DB instance with Multi-AZ enabled. The database experiences a failover during maintenance. The application reports connection errors for several minutes. What is the MOST likely cause and solution?

A.The RDS failover took longer than expected; increase the Multi-AZ timeout
B.The read replica was promoted incorrectly; recreate the read replica
C.The RDS proxy is misconfigured; disable the proxy for Multi-AZ
D.The application does not implement connection retry logic; implement exponential backoff and retry
AnswerD

During an RDS Multi-AZ failover, the existing TCP connections to the primary instance are forcibly closed, and the database endpoint's DNS CNAME is updated to point to the new primary. If the application does not implement connection retry with exponential backoff, it will never re-establish those dropped connections, causing an outage even after the failover completes. Retry logic with backoff and jitter is the standard, required practice for any production application using RDS, especially when combined with a connection pool or RDS Proxy.

Why this answer

The application experiences connection errors during an RDS Multi-AZ failover because it does not implement connection retry logic. The failover typically completes within 60 seconds, but any active connections are dropped. Without retry logic, the application fails to reconnect.

Implementing exponential backoff and retry allows the application to handle transient failures. Option A is wrong because there is no configurable Multi-AZ timeout; failover time is not adjustable. Option B is wrong because Multi-AZ uses a standby instance, not a read replica; read replicas are for read scaling.

Option C is wrong because an RDS proxy does not eliminate the need for retry logic; misconfiguration is not the primary issue.

1391
MCQeasy

A team uses AWS CodeDeploy to deploy a web application to an Auto Scaling group. The deployment strategy is Blue/Green. During a recent deployment, the new instances passed all health checks, but traffic was not routed to them. What is the most likely reason?

A.The target group associated with the Auto Scaling group is not properly configured to route traffic.
B.The deployment group is not configured to use a load balancer.
C.The Auto Scaling group's lifecycle hook failed to signal readiness.
D.The CodeDeploy agent on the new instances is not installed.
AnswerA

The target group tied to the Auto Scaling group acts as the traffic-routing endpoint for the load balancer. If its health check path, port, or timeout settings are misconfigured—or if it is not attached to the appropriate listener rule—the newly deployed instances will be registered but immediately marked unhealthy and deregistered, so no user traffic reaches them. CodeDeploy itself successfully completes its scripts, but the deployment outcome appears as a routing failure, not an instance-level failure.

Why this answer

In a Blue/Green deployment with CodeDeploy and an Auto Scaling group, traffic routing is handled by a load balancer target group. If the target group is not properly configured to route traffic to the new instances (e.g., missing or incorrect listener rules, deregistration delay, or health check thresholds), the instances may pass health checks but never receive traffic. This is the most likely cause because the deployment succeeded in provisioning and validating the new instances, but the load balancer did not forward requests to them.

Exam trap

The trap here is that candidates often assume health check success guarantees traffic routing, but in AWS, health checks only verify instance readiness; traffic routing depends on separate load balancer listener rules and target group associations.

How to eliminate wrong answers

Option B is wrong because if the deployment group were not configured to use a load balancer, CodeDeploy would not attempt to route traffic via a load balancer at all; the issue described is that traffic was not routed, implying a load balancer is present but misconfigured. Option C is wrong because a lifecycle hook failure would prevent the instance from completing its launch or termination process, typically causing the instance to remain in a 'Pending:Wait' state and fail health checks, not pass them. Option D is wrong because if the CodeDeploy agent were not installed, the deployment would fail during the Install phase on the new instances, and they would not pass health checks or reach the 'Succeeded' state.

1392
MCQmedium

An organization uses AWS Systems Manager to manage its EC2 instances. After a security incident, the security team wants to ensure that all future API calls to Systems Manager are logged and monitored. What is the MOST efficient way to achieve this?

A.Enable S3 server access logging on the Systems Manager log bucket
B.Enable AWS CloudTrail for the Systems Manager service
C.Install the CloudWatch Logs agent on each instance to capture Systems Manager logs
D.Create an AWS Config rule to monitor Systems Manager usage
AnswerB

AWS CloudTrail is the authoritative service for auditing API calls, and it natively records Systems Manager management events such as SendCommand, RunCommand, and StartSession. When a trail is enabled (or via the default event history), each event includes the IAM principal, source IP address, event time, request parameters, and response elements, yielding a complete 'who did what' record. This is precisely what is needed to audit and govern SSM usage across an EC2 fleet.

Why this answer

Enabling CloudTrail for Systems Manager logs all API calls made to the Systems Manager service. Option A is incorrect because S3 server access logging only logs access to S3 buckets, not Systems Manager API calls. Option C is incorrect because the CloudWatch Logs agent captures instance logs, not API calls to Systems Manager.

Option D is incorrect because AWS Config rules track configuration changes, not API calls. Therefore, CloudTrail is the most efficient way to log and monitor all future API calls to Systems Manager.

1393
Multi-Selectmedium

A DevOps engineer is creating an AWS Elastic Beanstalk environment and needs to ensure that configuration changes are tracked and can be reverted. Which THREE steps should the engineer take to achieve this? (Choose THREE.)

Select 3 answers
A.Enable configuration drift detection using AWS Config.
B.Use Elastic Beanstalk lifecycle policies to automatically retain old configurations.
C.Store configuration templates in the Elastic Beanstalk console, which automatically keeps version history.
D.Enable enhanced health reporting and detailed CloudWatch metrics.
E.Save configuration versions as saved configurations in Elastic Beanstalk.
AnswersA, D, E

AWS Config can be enabled to record configuration changes to Elastic Beanstalk environments and their underlying AWS resources (such as EC2 instances, security groups, and load balancers). By authoring or using managed Config rules, you can compare the actual environment settings to the desired baseline and receive SNS notifications or trigger SSM remediation when drift is detected. This provides a continuous, auditable change history and alerts you to unauthorised or accidental configuration modifications, allowing you to restore the correct settings quickly.

Why this answer

AWS Config can be used to track configuration changes to Elastic Beanstalk resources (e.g., the underlying EC2 instances, security groups, and load balancers) by recording configuration items and detecting drift from the desired state. This allows the DevOps engineer to audit changes and revert to a compliant configuration if needed.

Exam trap

The trap here is confusing lifecycle policies (which manage application versions) with configuration versioning, and assuming the console automatically retains configuration history when in fact you must explicitly save configurations as versions.

1394
MCQhard

Refer to the exhibit. An IAM policy is attached to an IAM role used by an EC2 instance to manage other EC2 instances. The operations team reports that the instance can start and stop other instances but cannot terminate them. However, they also notice that the instance cannot describe instances in any region other than us-east-1. What is the reason for this behavior?

A.The policy does not include the ec2:DescribeRegions action, which is required to describe instances in other regions.
B.The Allow statement's Resource is set to '*' which only matches instances in the caller's region.
C.The Deny statement for TerminateInstances implicitly denies all other EC2 actions in regions other than us-east-1.
D.The Deny statement only applies to TerminateInstances, but the Allow statement for DescribeInstances is not restricted by region, so the issue must be elsewhere.
AnswerD

The policy shown contains an explicit Allow for ec2:DescribeInstances on Resource '*' and an explicit Deny only for ec2:TerminateInstances; there is no Deny for DescribeInstances and no region condition on the Allow. Under IAM evaluation, an Allow for an action with no matching explicit Deny results in the action being permitted, so DescribeInstances is allowed in any region. Therefore, if a user cannot describe instances outside us-east-1, the policy fragment is not the cause; the problem must stem from another factor such as a service control policy (SCP), a permission boundary, a session policy, or a VPC endpoint policy that restricts the API call.

Why this answer

The policy explicitly allows ec2:DescribeInstances on all resources (*), which includes instances in any region. The Deny statement only applies to TerminateInstances and does not affect DescribeInstances. Therefore, based solely on this policy, the instance should be able to describe instances in any region.

The reported issue must be due to another factor not shown in the exhibit (e.g., a service control policy, a trust policy, or a misconfiguration), making option D the most plausible explanation. Options A, B, and C are incorrect because DescribeInstances is not restricted by region in this policy, and DescribeRegions is not required for describing instances in other regions.

1395
MCQhard

A company is using AWS Elastic Beanstalk with a custom platform. The platform is based on Amazon Linux 2 and includes a pre-installed application. The DevOps team needs to inject environment-specific configuration files into the EC2 instances during deployment. Which approach should be used?

A.Use AWS CloudFormation to update the environment with new configuration
B.Use .ebextensions configuration files in the application source bundle
C.Use EC2 user-data scripts to download configuration from S3
D.Store configuration in AWS Systems Manager Parameter Store and retrieve it in the application
AnswerB

Files placed in the .ebextensions directory of your application source bundle are processed automatically by Elastic Beanstalk during each deployment lifecycle. A .config file in this directory can use the 'files' key to write configuration content directly to absolute paths on the instance, and it can also run commands or container_commands in sequence with deployment events. Because these configuration files are part of the versioned source bundle, they are associated with a specific application version and are re-applied consistently whenever that version is deployed, making this the correct way to inject a configuration file into each instance during deployment.

Why this answer

Ebextensions configuration files are the native mechanism in Elastic Beanstalk to inject environment-specific configuration into EC2 instances during deployment. These YAML or JSON files, placed in the .ebextensions directory of the application source bundle, are processed by the Elastic Beanstalk platform engine to execute commands, create files, or modify configuration before the application starts, ensuring the custom platform receives the necessary environment-specific settings.

Exam trap

The trap here is that candidates often confuse runtime parameter retrieval (Option D) with deployment-time file injection, or assume that user-data scripts (Option C) are sufficient for ongoing deployments, failing to recognize that Elastic Beanstalk's .ebextensions are specifically designed for this purpose and integrate seamlessly with the platform's lifecycle.

How to eliminate wrong answers

Option A is wrong because AWS CloudFormation is used to manage the Elastic Beanstalk environment's infrastructure (e.g., resources like load balancers or scaling policies), not to inject configuration files into individual EC2 instances during deployment; it operates at the infrastructure layer, not the instance configuration layer. Option C is wrong because EC2 user-data scripts run only once at instance launch and are not integrated with Elastic Beanstalk's deployment lifecycle hooks, making them unreliable for injecting configuration during updates or rolling deployments where instances are reused. Option D is wrong because while Systems Manager Parameter Store can store configuration values, it requires the application code to explicitly retrieve them at runtime, which does not satisfy the requirement to inject configuration files into the EC2 instances during deployment; the question specifies injecting files, not runtime parameter access.

1396
MCQhard

A company has a CI/CD pipeline using AWS CodePipeline and AWS CodeBuild. The build stage runs unit tests and produces a JUnit report. The pipeline includes a test action that publishes results to an S3 bucket. Recently, the pipeline started failing with the error: 'The action could not be started because the artifact bucket policy is misconfigured.' What is the most likely cause?

A.The S3 bucket has Amazon S3 Transfer Acceleration enabled, which is not supported by CodePipeline.
B.The KMS key used to encrypt the bucket objects has been rotated, causing the pipeline to lose access.
C.The artifact bucket is in a different AWS Region than the pipeline, and cross-region replication is not enabled.
D.The artifact bucket's bucket policy does not grant the necessary permissions to the CodePipeline service role.
AnswerD

The CodePipeline service role must be explicitly listed as a principal in the artifact bucket's bucket policy with permissions like s3:GetObject, s3:PutObject, and s3:ListBucket. If the bucket policy is missing or uses the wrong role ARN, the pipeline gets an AccessDenied error when trying to read or write artifacts. This is the correct root cause because CodePipeline validates bucket access via the bucket policy and the attached IAM role policies.

Why this answer

AWS CodePipeline requires the artifact bucket's bucket policy to grant the CodePipeline service role (or the pipeline's assumed role) permissions to perform actions like s3:GetObject, s3:PutObject, and s3:GetBucketVersioning. When the bucket policy is misconfigured—for example, missing a principal or action—the pipeline's test action cannot start, resulting in the specific error message. This is a common IAM/permissions issue rather than a regional or encryption key problem.

Exam trap

The trap here is that candidates often assume the error is due to KMS key rotation or cross-region issues, but the specific wording 'artifact bucket policy is misconfigured' directly points to an IAM/bucket policy permission problem, not encryption or replication settings.

How to eliminate wrong answers

Option A is wrong because Amazon S3 Transfer Acceleration is fully compatible with CodePipeline; it only affects data transfer speed and does not cause a 'bucket policy misconfigured' error. Option B is wrong because while KMS key rotation can cause access issues if the pipeline's role lacks kms:Decrypt permissions on the new key, the error message explicitly mentions 'artifact bucket policy is misconfigured,' not a KMS-related error. Option C is wrong because cross-region replication is not required for CodePipeline to access an artifact bucket in a different region; CodePipeline can use cross-region actions with proper bucket policies and service roles, and the error is about policy misconfiguration, not replication.

1397
MCQmedium

A company wants to centralize audit logs from multiple AWS accounts into a single S3 bucket. The logs must be encrypted at rest and access should be limited to the security team. Which solution is MOST secure and scalable?

A.Use an IAM role in each account that grants write access to the central bucket, and use S3 default encryption.
B.Configure each account to write logs to its own S3 bucket, then replicate to a central bucket using S3 Cross-Region Replication.
C.Create a central S3 bucket with a bucket policy that requires encryption (aws:SecureTransport and SSE-KMS) and restricts access to a security team IAM role.
D.Use Amazon CloudWatch Logs in each account and export logs to a central S3 bucket using a Lambda function.
AnswerC

A central S3 bucket with a bucket policy that enforces HTTPS (aws:SecureTransport) and SSE-KMS via conditions like s3:x-amz-server-side-encryption, while restricting writes to specific CloudTrail principals/accounts and reads to a security team IAM role, provides a defense-in-depth approach. This pattern forces all log deliveries to be encrypted at rest with KMS keys you control and creates an auditable, centralized logging endpoint, which is the AWS-recommended way to aggregate CloudTrail logs.

Why this answer

The most secure and scalable solution is to create a central S3 bucket with a bucket policy that requires encryption (both aws:SecureTransport and SSE-KMS) and restricts access to a security team IAM role. This approach ensures that logs are encrypted in transit and at rest using KMS, which provides centralized key management and audit. Option A is less secure because using IAM roles in each account with S3 default encryption does not enforce encryption at rest and relies on per-account permissions, which is harder to manage at scale.

Option B involves cross-region replication, which adds latency and cost, and does not enforce encryption at rest by default. Option D uses CloudWatch Logs and Lambda, which is more complex and does not guarantee encryption at rest in transit without additional configuration, and is less scalable than a direct S3 approach.

1398
MCQhard

A company uses AWS Lambda functions behind an Amazon API Gateway REST API. During an incident, the API returns 502 Bad Gateway errors. The Lambda function logs show no errors. What is the most likely cause?

A.The Lambda function is throwing an unhandled exception
B.The Lambda function is returning a response that exceeds the API Gateway payload size limit
C.The API Gateway has reached its maximum concurrency limit
D.The Lambda function is timing out and API Gateway is not handling the timeout correctly
AnswerB

API Gateway imposes a hard 10 MB payload size limit for REST API responses (and 4 MB for HTTP APIs). When a Lambda function returns a response exceeding this threshold, API Gateway cannot process it and returns a 502 Bad Gateway error to the client, with no error logged from the Lambda side because the function already completed successfully. This is the classic 'silent' 502 cause and matches the symptoms in the question.

Why this answer

When an API Gateway REST API returns 502 Bad Gateway errors but the Lambda function logs show no errors, the most likely cause is that the Lambda function is returning a response that exceeds the API Gateway payload size limit. API Gateway has a maximum payload size of 10 MB for REST APIs, and if the Lambda function returns a response larger than this, API Gateway will reject it and return a 502 error without the Lambda function itself throwing an exception or logging an error.

Exam trap

AWS often tests the distinction between different HTTP status codes (502 vs 504 vs 429) and the specific conditions under which each is returned, leading candidates to incorrectly attribute 502 errors to Lambda timeouts or API Gateway throttling instead of payload size limits.

How to eliminate wrong answers

Option A is wrong because an unhandled exception in the Lambda function would cause the function to fail and log an error in Amazon CloudWatch Logs, but the question states that the Lambda function logs show no errors. Option C is wrong because API Gateway does not have a maximum concurrency limit; it scales automatically, and reaching a concurrency limit would result in 429 Too Many Requests errors, not 502 Bad Gateway errors. Option D is wrong because if the Lambda function were timing out, the Lambda service would log a timeout error in CloudWatch Logs, and API Gateway would typically return a 504 Gateway Timeout error, not a 502 Bad Gateway error.

1399
MCQmedium

A company wants to monitor network traffic to and from its VPC for security analysis. It needs to capture IP traffic information, including accepted and rejected connection attempts, and store the data in S3 for long-term analysis. Which AWS service should be used?

A.Amazon CloudWatch Logs
B.Amazon VPC Flow Logs
C.Amazon GuardDuty
D.AWS CloudTrail
AnswerB

Amazon VPC Flow Logs is the native service that captures IP traffic metadata for network interfaces in a VPC, including source and destination IPs, ports, protocol, and packet/byte counts for both accepted and rejected traffic. These logs can be published to Amazon S3 or CloudWatch Logs for long-term retention and analysis with services like Athena. As a result, VPC Flow Logs provides the flow-level visibility needed to monitor network traffic to and from a VPC.

Why this answer

VPC Flow Logs capture network traffic metadata and can be published to S3. Option A is wrong because CloudWatch Logs is for application logs, not network flows. Option C is wrong because GuardDuty is a threat detection service, not a log source.

Option D is wrong because CloudTrail tracks API calls.

1400
Multi-Selectmedium

A company uses AWS CloudFormation to manage infrastructure. An engineer notices that a stack update has failed, leaving the stack in a ROLLBACK_IN_PROGRESS state. Which TWO actions should the engineer take to investigate and resolve the issue?

Select 2 answers
A.Manually stop the rollback and continue with the update
B.Re-launch the stack with the same template
C.View the stack events in the CloudFormation console to see the specific error message
D.Delete the stack and re-launch it
E.Review the change set that was applied during the update
AnswersC, E

Reviewing the stack events in the CloudFormation console is the recommended first step because each event logs the status of every resource operation, and a failed resource includes a StatusReason field with the specific error message returned by the underlying AWS service. These event details reveal the root cause, such as an invalid property value, insufficient IAM permissions, or a resource limit exceeded, enabling you to make a targeted fix. This is the most direct and authoritative source of troubleshooting information for a failed stack operation.

Why this answer

When a CloudFormation stack update fails and enters ROLLBACK_IN_PROGRESS, the engineer should first view the stack events (option C) to identify the specific error message that caused the failure. This provides insight into what went wrong. Then, reviewing the change set (option E) helps understand the intended changes and diagnose the issue.

Option A is incorrect because manually stopping the rollback is not a standard action and could leave resources in an inconsistent state. Option B is incorrect because re-launching the stack with the same template would likely repeat the same error without addressing the root cause. Option D is incorrect because deleting and re-launching the stack would lose existing resources and is an extreme measure not needed for investigation.

1401
Multi-Selecteasy

A DevOps team wants to manage EC2 instance configurations using AWS Systems Manager. Which THREE capabilities of Systems Manager can be used to ensure instances are in a desired state? (Choose THREE.)

Select 3 answers
A.Run Command
B.OpsCenter
C.Parameter Store
D.Patch Manager
E.State Manager
AnswersA, D, E

Run Command is a Systems Manager capability that lets you execute shell scripts or PowerShell commands on one or more EC2 instances via the SSM Agent, without the need for SSH/RDP or opening inbound ports. By invoking documents like AWS-RunShellScript or AWS-RunPowerShellScript, you can directly enforce configuration settings, install software, or remediate configuration drift on demand. It supports rate control, error thresholds, and IAM-based permission scoping, making it a direct and flexible mechanism for enforcing instance configuration.

Why this answer

Run Command (A) is correct because it allows you to remotely and securely execute scripts or commands across EC2 instances without needing SSH or RDP, using an SSM document (SSM Document) that defines the desired configuration actions. This capability directly enforces a desired state by running idempotent scripts on demand or on a schedule.

Exam trap

The trap here is confusing Parameter Store (a data store) with a configuration management tool, or thinking OpsCenter (an operations dashboard) can enforce state, when only Run Command, State Manager, and Patch Manager directly execute actions to achieve and maintain a desired configuration.

1402
Multi-Selectmedium

Which TWO options are valid ways to trigger an AWS CodePipeline execution automatically?

Select 2 answers
A.Create an Amazon CloudWatch Events rule that starts the pipeline on a schedule.
B.Configure an Amazon S3 event notification to invoke the pipeline.
C.Use a git push to the repository via SSH.
D.Set up a manual approval step in the pipeline.
E.Enable AWS CodeBuild to start the pipeline after a build.
AnswersA, B

AWS EventBridge (CloudWatch Events) can be configured with a cron or rate expression to invoke the StartPipelineExecution API action on CodePipeline as a rule target. This provides a fully managed, scheduled trigger for pipelines, commonly used for nightly builds, recurring data syncs, or regular compliance scans. It is a legitimate automated trigger that does not require any external activity, making it ideal for time-based initiation.

Why this answer

Amazon CloudWatch Events (now Amazon EventBridge) can be configured with a cron or rate expression to trigger an AWS CodePipeline execution on a schedule. This is a native integration that directly starts the pipeline without requiring additional compute resources or custom code.

Exam trap

The trap here is that candidates may confuse a git push (which requires a configured webhook) with a direct trigger, or assume that a manual approval step or CodeBuild can initiate the pipeline, when in fact they are actions within the pipeline or require an external event source.

1403
MCQhard

A company uses AWS CodePipeline to deploy a web application. The pipeline uses artifacts stored in an S3 bucket. The Security team requires that all artifacts be encrypted in transit and at rest, and that the pipeline only access the bucket using a specific VPC endpoint. Which configuration meets these requirements?

A.Configure an IAM role for CodePipeline with a policy that allows s3:GetObject and s3:PutObject, and attach a bucket policy that allows only that role
B.Create a VPC endpoint for S3 and attach a bucket policy that denies access unless aws:SourceVpce matches the endpoint and aws:SecureTransport is true, and use S3 default encryption
C.Use an S3 bucket with a lifecycle policy to expire old artifacts
D.Enable S3 block public access and use SSE-S3 encryption on the bucket
AnswerB

This is the correct solution because it combines three complementary layers. The VPC endpoint for S3 (a gateway endpoint) ensures that all traffic to the bucket originates from within the company's VPC, and the bucket policy denies any request unless the aws:SourceVpce condition matches that endpoint, effectively blocking public internet access. The aws:SecureTransport condition forces all requests to use HTTPS, protecting data in transit from eavesdropping and man-in-the-middle attacks. Finally, enabling S3 default encryption (SSE-S3) ensures that artifact objects are encrypted at rest, so even if an object is somehow copied outside the bucket, its contents remain unintelligible without the encryption key. Together these controls satisfy both transit and at-rest encryption while restricting the attack surface to the VPC.

Why this answer

To enforce encryption in transit and at rest and restrict to a VPC endpoint, you must configure a bucket policy that denies access unless the request uses HTTPS (for transit) and server-side encryption (for at rest), and aws:SourceVpce condition. IAM roles alone cannot enforce VPC endpoint restriction.

1404
MCQhard

A DevOps team manages a multi-account AWS environment using AWS Organizations. They need to enforce a mandatory tag (e.g., 'CostCenter') on all resources created across accounts. Which combination of services should be used to automatically remediate non-compliant resources?

A.AWS Service Control Policies (SCPs) to deny creation of resources without the tag.
B.AWS CloudTrail to detect non-compliant resource creation and send notifications.
C.AWS Config rules with automatic remediation using AWS Systems Manager Automation or Lambda.
D.AWS Resource Groups & Tag Editor to manually add tags to non-compliant resources.
AnswerC

AWS Config rules continuously evaluate resource configurations, including tags, against your desired policy and can trigger automatic remediation when a resource is non-compliant. Remediation actions are implemented through AWS Systems Manager Automation runbooks, such as AWS-TagEC2Instance to add the required tag or AWS-StopEC2Instance to stop the resource, or through a custom Lambda function. This provides a fully automated, auditable corrective control that detects and fixes tag non-compliance at scale without manual intervention.

Why this answer

AWS Config rules can evaluate resources for mandatory tags and trigger automatic remediation actions, such as AWS Systems Manager Automation or AWS Lambda functions, to add the missing tag. Option A is incorrect because SCPs only deny actions at the account level, but they do not remediate existing non-compliant resources or enforce tags on resources created outside the SCP scope. Option B is incorrect because CloudTrail only logs API calls and cannot automatically remediate non-compliant resources.

Option D is incorrect because Tag Editor is a manual tool and does not provide automated enforcement or remediation.

1405
MCQmedium

A company is running a microservices application on Amazon ECS with AWS Fargate. The operations team needs to monitor application performance and troubleshoot slow API responses. They currently use Amazon CloudWatch Logs for container logs and have enabled Container Insights. However, they are unable to see detailed latency breakdowns per API endpoint. Which solution would provide the most granular visibility into API performance?

A.Enable detailed CloudWatch metrics for ECS and Fargate, including CPU and memory.
B.Enable CloudWatch Logs Insights to query API logs for slow requests.
C.Use AWS X-Ray to instrument the application and collect trace data.
D.Deploy the AWS Distro for OpenTelemetry collector on each task to send metrics to CloudWatch.
E.Set up VPC Flow Logs to analyze network latency between services.
AnswerC

AWS X-Ray provides end-to-end tracing with segment details, allowing you to see latency per API endpoint and downstream dependencies.

Why this answer

AWS X-Ray provides end-to-end tracing of requests as they travel through microservices, capturing detailed latency breakdowns per API endpoint, including downstream calls, database queries, and external HTTP requests. This gives the operations team the granular visibility needed to pinpoint exactly where slow responses occur, unlike aggregated metrics or log-based queries.

Exam trap

The trap here is that candidates confuse infrastructure-level metrics (CPU, memory, network) or log-based querying with the distributed tracing capability needed to break down latency per API endpoint, overlooking that only X-Ray provides end-to-end trace segments with sub-millisecond timing per service call.

How to eliminate wrong answers

Option A is wrong because enabling detailed CloudWatch metrics for ECS and Fargate (CPU, memory, network) provides infrastructure-level metrics, not per-endpoint latency breakdowns. Option B is wrong because CloudWatch Logs Insights can query logs for slow requests but cannot trace a single request across multiple services or show the latency contributed by each downstream call. Option D is wrong because the AWS Distro for OpenTelemetry collector sends metrics and traces to CloudWatch, but without X-Ray integration or trace sampling, it does not provide the per-endpoint latency breakdowns that X-Ray's service map and trace segments offer.

Option E is wrong because VPC Flow Logs capture network-level metadata (packet headers, timestamps) and can indicate network latency between ENIs, but they cannot reveal application-level latency per API endpoint or trace a request through microservices.

1406
MCQeasy

A company wants to ensure that all API calls made within its AWS account are logged for auditing purposes. Which AWS service should be enabled to meet this requirement?

A.AWS Config
B.AWS CloudTrail
C.Amazon CloudWatch Logs
D.VPC Flow Logs
AnswerB

AWS CloudTrail is the native auditing service that records every API call made in the account, including calls from the console, SDKs, CLI, and other AWS services. Each event captures the identity of the caller, source IP, time, request and response elements, and the specific action invoked. This makes CloudTrail the correct and only service in this list that directly provides a complete API call history for auditing.

Why this answer

AWS CloudTrail is the service that records API activity in an AWS account, making it the correct choice. Option A is incorrect because AWS Config tracks resource configuration changes, not API calls. Option C is incorrect because CloudWatch Logs is for log storage and monitoring, not for recording API calls.

Option D is incorrect because VPC Flow Logs capture network traffic, not API calls.

1407
MCQmedium

A company requires that all access to their S3 buckets be encrypted in transit. Which configuration achieves this?

A.Use CloudFront with the bucket as origin and enforce HTTPS only between viewer and CloudFront.
B.Enable default encryption on the bucket.
C.Use a bucket policy that denies requests when aws:SecureTransport is false.
D.Set the bucket policy to require SSE-KMS.
AnswerC

Correctly enforces HTTPS by denying non-secure transport.

Why this answer

Using a bucket policy with a condition that denies requests when `aws:SecureTransport` is `false` explicitly enforces encryption in transit for all access to the S3 bucket. This policy ensures that any HTTP (non-TLS) request is denied, while HTTPS requests are allowed, meeting the requirement that all access be encrypted in transit.

Exam trap

The trap here is confusing encryption in transit with encryption at rest; candidates often pick options like default encryption or SSE-KMS, which only address data at rest, not the requirement for HTTPS enforcement.

How to eliminate wrong answers

Option A is wrong because it only enforces HTTPS between the viewer and CloudFront, but the connection between CloudFront and the S3 origin can still be HTTP unless an additional policy or setting enforces HTTPS there, leaving a gap in transit encryption. Option B is wrong because default encryption on the bucket only encrypts data at rest (server-side encryption), not in transit; it does not enforce HTTPS for client connections. Option D is wrong because requiring SSE-KMS enforces encryption at rest using AWS KMS keys, but it does not control whether the data is transmitted over HTTPS or HTTP; transit encryption is a separate concern.

1408
MCQeasy

A DevOps engineer is creating an AWS CloudFormation template to deploy a stack that includes an Amazon EC2 instance. The instance needs to be launched in a specific subnet. How should the engineer reference the subnet ID in the template?

A.Hardcode the subnet ID in the template.
B.Use a mapping (Mappings) to define the subnet ID based on the stack name.
C.Define a parameter (Parameters) of type AWS::EC2::Subnet::Id and reference it.
D.Use the Fn::GetAtt function to retrieve the subnet ID from a VPC resource.
AnswerC

Defining a parameter of type AWS::EC2::Subnet::Id lets the caller supply the actual subnet at stack creation or update, and CloudFormation validates that the value is a real subnet ID. Referencing it via Ref keeps the template portable across environments, and the parameter appears in the console or CLI for clear input.

Why this answer

Defining a parameter of type `AWS::EC2::Subnet::Id` allows the CloudFormation template to accept a subnet ID as input at stack creation or update time, making the template reusable across different environments without modification. This approach follows infrastructure-as-code best practices by avoiding hardcoded values and enabling parameterized deployments.

Exam trap

The trap here is that candidates often confuse Fn::GetAtt with the ability to retrieve any resource attribute from any stack, but Fn::GetAtt only works for resources defined in the same template and cannot fetch a subnet ID from an existing VPC resource unless that VPC resource itself outputs the subnet ID.

How to eliminate wrong answers

Option A is wrong because hardcoding the subnet ID makes the template environment-specific and non-portable, violating the principle of reusable infrastructure-as-code. Option B is wrong because Mappings are used to define static lookup tables based on keys like region or environment, not to dynamically accept user-provided subnet IDs; the stack name is not a reliable key for subnet selection. Option D is wrong because Fn::GetAtt retrieves attributes from resources defined within the same template, but if the VPC and subnet are not created in the same stack, there is no resource to reference; even if they were, Fn::GetAtt on a VPC resource returns VPC-level attributes (e.g., VpcId), not a subnet ID.

1409
Multi-Selectmedium

A DevOps engineer is designing an incident response plan for a multi-region application. The application runs on EC2 instances behind an Application Load Balancer (ALB) and uses Amazon RDS for MySQL with Multi-AZ. Which TWO actions should the engineer include to ensure high availability and fast failover during a regional incident?

Select 2 answers
A.Set up an Amazon RDS read replica in a second region and promote it during failover.
B.Create an Auto Scaling group that can launch instances in multiple regions.
C.Deploy an Application Load Balancer that spans both regions.
D.Configure Amazon RDS Multi-AZ in a second region.
E.Use Amazon Route 53 with health checks to fail over DNS to a secondary region.
AnswersA, E

For a true cross-region disaster recovery, an Amazon RDS read replica in a second region can be promoted to a standalone primary instance during failover. The replica is typically created with asynchronous replication, so some data loss may occur, but it provides a writable database endpoint in the secondary region. This is a standard DR pattern for maintaining business continuity.

Why this answer

Options A and E are correct. Amazon RDS read replicas can be created in a different region and promoted to a standalone primary instance during a regional incident, providing a disaster recovery solution. Amazon Route 53 with health checks can automatically fail over DNS traffic to a secondary region by routing to a healthy endpoint.

Option B is incorrect because Auto Scaling groups are regional and cannot launch instances across multiple regions directly; you would need separate Auto Scaling groups per region. Option C is incorrect because an Application Load Balancer is regional and cannot span regions; you would need separate ALBs in each region and Route 53 to route traffic. Option D is incorrect because Multi-AZ RDS replicates synchronously within a single region only; for cross-region disaster recovery, you need a read replica or a separate Multi-AZ deployment in the other region, not Multi-AZ in a second region (Multi-AZ in a second region is not a standard feature; you would need a separate RDS instance).

1410
MCQmedium

A company uses AWS CloudFormation to deploy a multi-tier application. The template includes a parameter for the instance type of EC2 instances. The DevOps team wants to restrict the allowed values to a specific set of instance types. Which CloudFormation section should be used?

A.Outputs
B.Parameters with AllowedValues
C.Conditions
D.Mappings
AnswerB

Parameters with AllowedValues is the correct mechanism because it defines an input variable whose acceptable values are explicitly enumerated at template authoring time. When the stack is created or updated, CloudFormation validates any supplied value against that list and rejects the operation if the value is not present. This provides a controlled menu of environment-specific options (e.g., Dev, Staging, Prod) or instance types, ensuring the multi-tier app is deployed with a valid, pre-approved configuration.

Why this answer

The Parameters section in AWS CloudFormation allows you to define input values that can be supplied at stack creation or update time. By specifying an AllowedValues constraint on a parameter, you restrict the user to select only from a predefined list of instance types, which enforces compliance and prevents misconfiguration. This is the correct mechanism for limiting instance type choices in a CloudFormation template.

Exam trap

The trap here is that candidates may confuse Mappings (which are static lookups) with parameter constraints, thinking they can restrict input values via a mapping, but Mappings only retrieve pre-defined data and do not enforce input validation.

How to eliminate wrong answers

Option A is wrong because the Outputs section declares values that are returned after the stack is created, such as resource IDs or endpoints; it does not accept or restrict input values. Option C is wrong because Conditions control whether certain resources or properties are created based on logical expressions (e.g., environment type), but they cannot restrict the allowed values of a parameter. Option D is wrong because Mappings provide a static lookup table (e.g., mapping region to AMI ID) and are used to retrieve values based on keys, not to constrain user-supplied parameter inputs.

1411
MCQeasy

A DevOps engineer notices that an EC2 instance running a web application is unresponsive. CloudWatch alarms are not triggering. What is the FIRST step the engineer should take to diagnose the issue?

A.Terminate the instance and launch a new one from the latest AMI.
B.Review the EC2 instance system log and CloudWatch Logs for error messages.
C.Restart the EC2 instance immediately to restore service.
D.Create a new CloudWatch alarm with a lower threshold to get alerted quicker next time.
AnswerB

The EC2 system log (console output) is a hypervisor-accessible snapshot of the instance's serial port, capturing kernel panics, OOM killer events, and boot-time failures that may be invisible from inside the OS. Pairing that with CloudWatch Logs—where the CloudWatch agent streams Apache, Nginx, or custom application errors—gives you a non-disruptive, evidence-based starting point to pinpoint whether the web service stopped due to memory exhaustion, a crashed process, or an external dependency. These sources are available via the EC2 console or the get-console-output CLI call and require no downtime, making them the correct first step for diagnosis.

Why this answer

When an EC2 instance is unresponsive but CloudWatch alarms are not triggering, the first diagnostic step is to check the instance system log (console output) and CloudWatch Logs for error messages. This approach follows the principle of gathering evidence before taking action, as the logs may reveal application crashes, kernel panics, or resource exhaustion that caused the unresponsiveness without breaching CloudWatch alarm thresholds.

Exam trap

The trap here is that candidates often jump to immediate remediation (restart or replace) instead of following the incident response process of first gathering diagnostic data from logs and system output.

How to eliminate wrong answers

Option A is wrong because terminating the instance destroys forensic evidence and prevents root cause analysis; the correct first step is to diagnose, not destroy. Option C is wrong because restarting the instance without investigation may temporarily restore service but loses volatile diagnostic data (e.g., memory dumps, process states) and does not address the underlying issue. Option D is wrong because creating a new alarm with a lower threshold does not help diagnose the current unresponsive instance; it only changes future alerting behavior and does not provide any immediate diagnostic information.

1412
MCQmedium

A company uses AWS Elastic Beanstalk for a web application. The DevOps engineer needs to ensure that environment configuration changes (e.g., instance type, environment variables) are version-controlled and can be rolled back quickly. Which approach should they use?

A.Use Elastic Beanstalk saved configurations stored in source control.
B.Manually update the environment configuration through the Elastic Beanstalk console.
C.Use the AWS CLI to apply configuration changes from a script.
D.Use AWS CloudFormation to manage the Elastic Beanstalk environment.
AnswerA

Elastic Beanstalk saved configurations are YAML files that capture the environment's option settings, environment variables, and platform configuration. You can store these files in source control, which gives you versioned, auditable, and reproducible configuration snapshots. When you need to roll back a problematic change, you can apply an older saved configuration via the EB CLI or console, restoring the exact previous runtime settings without re-provisioning infrastructure.

Why this answer

Elastic Beanstalk saved configurations allow you to export environment settings (e.g., instance type, environment variables) as a YAML or JSON file that can be stored in a version control system like Git. This enables you to recreate environments with identical settings and roll back to a previous configuration by deploying an older saved configuration file, providing a version-controlled, auditable, and reversible change management process.

Exam trap

The trap here is that candidates often assume AWS CloudFormation is always the best choice for infrastructure version control, but the question specifically tests knowledge of Elastic Beanstalk's native saved configuration feature, which is simpler and more direct for environment-level configuration rollbacks without requiring a separate orchestration service.

How to eliminate wrong answers

Option B is wrong because manually updating the environment configuration through the Elastic Beanstalk console is not version-controlled, lacks auditability, and cannot be easily rolled back without manually re-entering previous settings. Option C is wrong because using the AWS CLI to apply configuration changes from a script, while automatable, does not inherently provide version control or a structured rollback mechanism unless the script itself is stored in source control and carefully managed; it lacks the built-in saved configuration abstraction that Elastic Beanstalk offers for environment-level settings. Option D is wrong because while AWS CloudFormation can manage Elastic Beanstalk environments, it introduces additional complexity and overhead for simple environment configuration changes, and the question specifically asks for an approach that uses Elastic Beanstalk's native capabilities for version-controlled configuration and quick rollback, which saved configurations directly address.

1413
MCQhard

A company uses Amazon RDS for MySQL with Multi-AZ deployment. During an incident, the primary DB instance becomes unreachable. The failover to the standby instance succeeds, but application connections are failing with 'Access denied for user'. What is the most likely cause?

A.The DNS CNAME for the RDS endpoint has not propagated to the application's DNS resolver
B.The standby instance has a different storage configuration than the primary
C.The application is using the old master user credentials that were changed on the primary but not replicated to the standby
D.The security group for the RDS instance does not allow inbound traffic from the application's new IP address
AnswerC

Credentials are not replicated across Multi-AZ; they must be the same.

Why this answer

The most likely cause is that the application is using credentials that were changed on the primary but not replicated to the standby. In RDS Multi-AZ, changes made via the RDS console or API (e.g., modifying the master password) are automatically replicated, but direct SQL modifications (e.g., ALTER USER) are not. After failover, the standby becomes the new primary with the old credentials, causing 'Access denied for user' errors.

Option A is incorrect because DNS CNAME propagation delays cause connection timeouts, not authentication failures. Option B is incorrect because storage configuration differences do not affect authentication. Option D is incorrect because the security group remains associated with the RDS instance and the application's IP address does not change during failover.

1414
MCQmedium

A company is running a web application on Amazon EC2 instances behind an Application Load Balancer. The application is experiencing intermittent errors. The DevOps engineer needs to identify if the errors are caused by the application or the underlying infrastructure. Which solution provides the MOST detailed visibility into the application's behavior?

A.Enable VPC Flow Logs and analyze traffic patterns
B.Enable AWS CloudTrail and monitor for API errors
C.Instrument the application with AWS X-Ray SDK and analyze traces
D.Enable detailed CloudWatch metrics on the EC2 instances and ALB
AnswerC

Instrumenting the application with the X-Ray SDK adds tracing headers to each incoming HTTP request and tracks the request as it flows through the EC2-hosted application and any downstream calls to databases or other services. X-Ray segments and subsegments capture the exact service, operation, and any exceptions or faults that occur, enabling a trace map that pinpoints the failing component or code path. This gives per-request context and error stack traces needed to resolve application-level errors definitively.

Why this answer

AWS X-Ray provides end-to-end tracing of requests as they travel through the application, allowing the engineer to pinpoint where errors occur. Option A is wrong because CloudWatch metrics only show aggregate data, not per-request details. Option B is wrong because VPC Flow Logs capture network traffic metadata, not application-level errors.

Option D is wrong because CloudTrail records API calls, not application errors.

1415
MCQhard

A company uses AWS Secrets Manager to rotate secrets for an RDS database. The rotation Lambda function fails with a timeout error. Which configuration change is MOST likely to resolve the issue?

A.Increase the Lambda function timeout.
B.Increase the Lambda function memory.
C.Place the Lambda function in the same VPC as the RDS instance.
D.Configure the Lambda function to retry on failure.
AnswerA

The Lambda rotation function must perform multiple sequential operations—connect to the RDS database, run an ALTER USER statement, and call UpdateSecret to store the new password—all of which can exceed the default 3-second timeout, especially during cold starts or slow network conditions. Increasing the function timeout directly prevents the execution from being terminated mid-rotation, allowing the full workflow to complete before Secrets Manager marks the step as failed. This is the correct fix because timeout errors indicate the function is being killed before finishing, not that it lacks compute resources or network access.

Why this answer

The Lambda function is timing out during the secret rotation process, which involves connecting to the RDS database, generating a new password, and updating the secret. Increasing the Lambda function timeout directly addresses the symptom by allowing more time for the rotation to complete, especially if the database response is slow or the network latency is high. This is the most direct fix for a timeout error, as the default Lambda timeout (3 seconds) is often insufficient for database operations.

Exam trap

The trap here is that candidates may confuse a timeout error with a connectivity error and incorrectly choose to place the Lambda in the same VPC, overlooking that the function must already be in the VPC to even attempt the rotation.

How to eliminate wrong answers

Option B is wrong because increasing memory can improve CPU performance but does not extend the maximum execution duration; timeout errors are resolved by increasing the timeout value, not memory. Option C is wrong because the Lambda function must already be in the same VPC as the RDS instance to connect to it; if it were not, the error would be a connection timeout or access denied, not a generic timeout. Option D is wrong because retrying on failure would only re-execute the same failing code, which would still timeout again; it does not address the root cause of insufficient execution time.

1416
MCQeasy

The exhibit shows a CloudFormation stack event. The stack creation failed with 'Resource creation cancelled'. What is the most likely reason for this cancellation?

A.The stack template contains a syntax error.
B.The IAM role used for stack operations lacks permissions.
C.A stack creation timeout was reached.
D.The stack was manually cancelled by a user or an automation script.
AnswerD

When a user clicks the 'Cancel' button in the CloudFormation console, or an automation script invokes DeleteStack during a creation operation, CloudFormation aborts pending resource creation and emits a 'Resource creation cancelled' event for each in-progress resource. The stack then transitions to ROLLBACK_IN_PROGRESS, destroying any resources that were successfully created before the cancellation. This event reason directly matches the manual or scripted interruption described in the correct answer.

Why this answer

The 'Resource creation cancelled' event in a CloudFormation stack creation indicates that the operation was explicitly halted by a user or an automation script (e.g., via the AWS CLI, Console, or SDK). This is distinct from a timeout or permission error, which would produce different error messages such as 'Resource creation timed out' or 'API: cloudformation:CreateStack Access Denied'.

Exam trap

The trap here is that candidates confuse 'cancelled' with 'timeout' or 'permission failure', but CloudFormation uses distinct error messages for each—'cancelled' always implies an explicit user or automation action, not a system-driven failure.

How to eliminate wrong answers

Option A is wrong because a syntax error in the template would cause a 'Template validation error' or 'Template format error' at the start of stack creation, not a 'Resource creation cancelled' event after resources have begun provisioning. Option B is wrong because insufficient IAM permissions would result in an 'Access Denied' or 'Authorization failure' error for specific API calls, not a cancellation of the entire stack creation. Option C is wrong because a stack creation timeout would produce a 'Resource creation timed out' or 'Stack creation failed due to timeout' message, not a cancellation event.

1417
MCQeasy

A company uses Amazon Route 53 for DNS and wants to ensure high availability for a web application hosted on two EC2 instances in different Availability Zones. The application uses an Application Load Balancer. What is the simplest way to achieve resilience if one Availability Zone becomes unavailable?

A.Launch both instances in the same Availability Zone.
B.Place the instances in different Availability Zones behind the ALB.
C.Configure Route 53 latency-based routing to each instance.
D.Configure Route 53 failover routing with health checks pointing to each instance.
AnswerB

An Application Load Balancer is a regional, layer-7 service that can route traffic to healthy targets across multiple Availability Zones. By placing EC2 instances in different AZs and registering them in the ALB's target group, the ALB automatically performs health checks and reroutes traffic away from unhealthy instances or entirely failed AZs. This design ensures that if one AZ becomes unavailable, the ALB continues to serve requests using instances in the other AZ. The combination of cross-zone load balancing and health-based target removal makes this the industry-standard resilient architecture.

Why this answer

Placing EC2 instances in different Availability Zones behind an Application Load Balancer (ALB) is the simplest and most effective way to achieve high availability. The ALB automatically distributes traffic across healthy targets in multiple AZs, and if one AZ becomes unavailable, the ALB stops routing requests to instances in that AZ, ensuring continued service from the remaining AZ.

Exam trap

The trap here is that candidates overcomplicate the solution by choosing DNS-level failover (Option D) when the ALB already provides built-in cross-AZ failover, making the simpler architecture the correct answer.

How to eliminate wrong answers

Option A is wrong because launching both instances in the same Availability Zone creates a single point of failure; if that AZ goes down, the application becomes completely unavailable. Option C is wrong because Route 53 latency-based routing directs traffic based on lowest latency, not availability; it does not automatically failover when an AZ becomes unavailable, and it requires additional health check configuration to be effective. Option D is wrong because Route 53 failover routing with health checks is more complex than necessary; the ALB already provides health checks and automatic failover across AZs, making this an overly complicated solution that adds unnecessary DNS-level complexity.

1418
MCQeasy

A company uses AWS CloudFormation to manage infrastructure. During an incident, a stack update fails with the error 'The following resource(s) failed to create: [AWS::RDS::DBInstance]'. Which AWS service should the engineer use to view detailed error messages for the failed resource creation?

A.AWS Config timeline
B.AWS CloudFormation console Events tab
C.AWS Service Catalog
D.AWS CloudTrail event history
AnswerB

The CloudFormation console Events tab lists every operation performed on a stack in chronological order, one per resource action, including statuses like CREATE_FAILED and UPDATE_FAILED. For each failed event, the Status Reason field contains the exact error message returned by the underlying service, such as an IAM permission issue or a missing S3 bucket. This is the authoritative source for diagnosing stack deployment problems.

Why this answer

The correct option is B: the CloudFormation console Events tab displays detailed error messages for each resource event, including creation failures. This is the most direct way to view error details for failed resource creation. Option A (AWS Config timeline) is used for configuration history and compliance, not for resource creation errors.

Option C (AWS Service Catalog) manages product portfolios and provisioning, not stack troubleshooting. Option D (AWS CloudTrail event history) records API calls but does not surface CloudFormation-specific resource-level error messages.

1419
MCQhard

Refer to the exhibit. A DevOps engineer is troubleshooting an issue where an IAM user is unable to stop an EC2 instance with the tag 'Environment: Development'. The attached IAM policy is shown. Which statement explains the failure?

A.The Deny statement condition incorrectly uses StringNotEquals, which denies all instances except those with the Production tag.
B.The Deny statement includes ec2:StopInstances implicitly because stop is a termination action.
C.The Allow statement only grants ec2:DescribeInstances, not start/stop.
D.The policy does not prevent stopping instances with the Development tag; the failure must be caused by another policy or service control policy.
AnswerC

The policy's only explicit Allow is ec2:DescribeInstances; because ec2:StopInstances is a separate action in the IAM action namespace, no permission is granted to perform a stop. When the user calls StopInstances, IAM finds no allow and defaults to an implicit deny, so the API request fails. The Deny statement on RunInstances does not counteract this, so the missing start/stop Allow is precisely the cause.

Why this answer

The IAM policy in the exhibit only grants ec2:DescribeInstances and explicitly denies ec2:RunInstances with a condition. It does not include an Allow for ec2:StopInstances. By default, IAM denies any action that is not explicitly allowed.

Therefore, the user lacks permission to stop instances, including the Development-tagged instance. Option C correctly identifies this as the reason for the failure. Option D is incorrect because the policy itself denies stop implicitly due to the missing Allow; it is not necessary to invoke another policy or SCP.

Exam trap

The trap here is that candidates misread the Deny statement's action (ec2:RunInstances) and condition (StringNotEquals) as applying to stopping instances, when in fact it only affects launching instances, leading them to incorrectly select Option A or B without noticing the action mismatch.

How to eliminate wrong answers

Option A is wrong because the Deny statement uses ec2:RunInstances, not ec2:StopInstances, and the StringNotEquals condition applies to launching instances, not stopping them; it does not deny stopping Development instances. Option B is wrong because the Deny statement explicitly lists ec2:RunInstances, and AWS IAM does not implicitly include ec2:StopInstances under termination actions; stop and terminate are separate actions. Option C is wrong because while the Allow statement only grants ec2:DescribeInstances, the question asks why the user cannot stop the instance; the lack of an explicit allow for ec2:StopInstances would cause a default implicit deny, but the policy itself does not prevent stopping—the failure must be from another policy or SCP, as the provided policy does not deny stop actions.

1420
MCQhard

A DevOps engineer is troubleshooting why an AWS Lambda function is not writing logs to the CloudWatch Logs log group 'MyAppLogs'. The Lambda function's execution role includes the IAM policy shown in the exhibit. What is the MOST likely reason the logs are not being written?

A.The log group is in a different AWS Region.
B.The policy does not grant permission to create the log group or put log events to the log group itself.
C.The policy has an incorrect action name.
D.The policy is missing the 'logs:CreateLogGroup' action.
AnswerB

Correct. The policy grants actions only on log streams, missing permissions on the log group itself.

Why this answer

The Lambda function's execution role policy allows actions like logs:CreateLogGroup and logs:PutLogEvents on log streams within the log group (e.g., arn:aws:logs:region:account-id:log-group:MyAppLogs:log-stream:*), but does not grant permission to create the log group itself or put log events directly to the log group resource (arn:aws:logs:region:account-id:log-group:MyAppLogs). For Lambda to write logs to CloudWatch, it needs logs:CreateLogGroup on the log group ARN (if the group does not exist) and logs:PutLogEvents on the log group ARN itself. Without these specific permissions, the logs cannot be written.

Option A is incorrect because the region is irrelevant; the issue is with permissions. Option C is incorrect because the action names are valid. Option D is incorrect because the policy does include logs:CreateLogGroup, but it’s the resource specification that is insufficient.

1421
MCQhard

A DevOps engineer is designing a deployment pipeline for a microservices application on Amazon ECS. The team wants to use blue/green deployments with automatic rollback if CloudWatch alarms are triggered during the deployment. Which combination of services and configurations should the engineer use?

A.Use AWS CodeDeploy with a blue/green deployment configuration on the ECS service, and configure automatic rollback when CloudWatch alarms are breached.
B.Use AWS CloudFormation with a ChangeSet and a custom rollback Lambda function triggered by CloudWatch alarms.
C.Use AWS CodeBuild to run a build that creates a new task definition, then update the ECS service manually, and use CloudWatch alarms to trigger a rollback via a Lambda function.
D.Use Amazon ECS service auto scaling with step scaling policies based on CloudWatch alarms.
AnswerA

CodeDeploy supports blue/green deployments on ECS with automatic rollback based on alarms.

Why this answer

AWS CodeDeploy natively supports blue/green deployments on Amazon ECS services, and you can configure automatic rollback when CloudWatch alarms are triggered, meeting the team's requirements. Option B is incorrect because CloudFormation ChangeSets do not provide native blue/green deployment with automatic rollback based on alarms; custom Lambda functions add complexity. Option C is incorrect because CodeBuild is used for building artifacts, not deploying; manually updating the ECS service and using a Lambda for rollback is not a streamlined solution.

Option D is incorrect because ECS service auto scaling handles scaling based on demand, not deployment strategies like blue/green.

1422
Multi-Selecteasy

A DevOps engineer is troubleshooting a performance issue with an Amazon RDS for MySQL database. The engineer suspects that slow queries are causing high CPU utilization. Which TWO actions can the engineer take to identify the slow queries?

Select 2 answers
A.Create an RDS event subscription for 'low storage' events.
B.Monitor the 'CPUUtilization' metric in CloudWatch.
C.Enable the slow query log and publish it to CloudWatch Logs.
D.Enable Performance Insights to visualize database load and identify top SQL statements.
E.Enable Enhanced Monitoring to view process list and SQL queries.
AnswersC, D

Enabling the RDS slow query log captures every SQL statement whose execution exceeds the configured long_query_time threshold, recording details like query text, execution duration, rows examined, and timestamps. By publishing these log events to CloudWatch Logs, you gain a searchable, historical record that can be queried with CloudWatch Logs Insights to filter for the slowest statements, identify patterns, and correlate with other metrics. This directly exposes the exact SQL causing performance issues, making it a definitive diagnostic method for slow query analysis.

Why this answer

Enable the slow query log and publish it to CloudWatch Logs (Option C) allows you to capture and analyze slow SQL queries. Performance Insights (Option D) provides a dashboard to visualize database load and identify the top SQL statements causing performance issues. Option A is incorrect because event subscriptions for low storage notify about storage events, not slow queries.

Option B is incorrect because monitoring CPUUtilization only indicates high CPU usage but does not identify specific slow queries. Option E is incorrect because Enhanced Monitoring provides OS-level metrics like CPU and memory, not the actual SQL queries.

1423
MCQeasy

A Lambda function is timing out. The log above shows a recent invocation. What is the most likely cause?

A.The function is running out of memory.
B.The function is being invoked too frequently.
C.The function is experiencing a cold start.
D.The function timeout is set too low.
AnswerD

The correct diagnosis is that the function's timeout setting is too low. The 3000 ms Duration exactly matches the default Lambda timeout of 3 seconds, and the 'Task timed out' error means Lambda terminated the handler at its configured limit. Raising the timeout, after reviewing the code for inefficiencies, would allow the function to complete successfully.

Why this answer

The log shows the function timed out at 3000 ms, which is the default Lambda timeout (3 seconds). The correct answer is D because the timeout value is set too low, causing the function to be terminated before it can complete. Option A is incorrect because memory usage is only 64 MB out of 128 MB, so insufficient memory is not the issue.

Option B is incorrect because there is only one invocation shown; frequent invocations would cause throttling, not a timeout. Option C is incorrect because the init duration is normal (e.g., 2.34 ms), indicating that a cold start is not the cause; cold starts increase latency but do not cause timeouts if the function runs within the timeout limit.

1424
MCQhard

A company has a Lambda function that processes sensitive data and needs to access an RDS database. The security team requires that the database credentials are automatically rotated every 30 days. Which service should be used to store and rotate the credentials?

A.AWS Secrets Manager
B.AWS Systems Manager Parameter Store
C.Amazon DynamoDB
D.AWS IAM roles
AnswerA

AWS Secrets Manager is a purpose-built service for storing and managing database credentials and other sensitive secrets. It provides native automatic rotation, including native integration with Amazon RDS, Redshift, and DocumentDB, which enforces credential lifecycle management and reduces the operational burden of periodic rotation. Its resource-based policies and tight integration with AWS Lambda and IAM make it the correct, secure choice for handling sensitive data.

Why this answer

AWS Secrets Manager is the correct choice because it is specifically designed to securely store, manage, and automatically rotate database credentials for services like RDS. It supports native, built-in rotation for Amazon RDS (MySQL, PostgreSQL, Oracle, SQL Server, and MariaDB) without requiring custom Lambda functions. The automatic rotation can be scheduled at a desired interval (e.g., every 30 days) using a rotation schedule defined in the secret's configuration, and it integrates directly with RDS to update the credentials on both the secret and the database.

Exam trap

The trap here is that candidates often confuse AWS Systems Manager Parameter Store with Secrets Manager because both can store secrets, but Parameter Store lacks native automatic rotation and RDS integration, making it unsuitable for the 30-day rotation requirement.

How to eliminate wrong answers

Option B is wrong because AWS Systems Manager Parameter Store does not support automatic rotation of credentials; it is a hierarchical store for configuration data and secrets but requires custom automation (e.g., a Lambda function) to rotate values, and it lacks native integration with RDS for credential rotation. Option C is wrong because Amazon DynamoDB is a NoSQL database service, not a secrets management service; it cannot natively store or rotate credentials, and using it would require building custom encryption and rotation logic, violating the security team's requirement for automated rotation. Option D is wrong because AWS IAM roles are used to grant permissions to AWS resources (e.g., Lambda to access RDS) but cannot store or rotate database credentials; IAM roles provide temporary credentials for AWS API calls, not for database user passwords, and RDS database authentication via IAM is possible but does not involve storing or rotating static credentials.

1425
MCQhard

A company manages a fleet of EC2 instances using AWS Systems Manager State Manager. They have a State Manager association that ensures a specific software package is installed on all instances. Recently, they noticed that some instances are reporting the association as 'Success' even though the software is not installed. The association uses a custom document that runs a script to install the package. The engineer checks the association execution history and sees that the script exited with code 0 on those instances. What is the most likely cause?

A.The association is not targeting those instances.
B.The instances are not configured to send compliance data to Systems Manager.
C.The instances do not have the SSM Agent installed.
D.The script does not check the exit code of the installation command and always returns 0.
AnswerD

State Manager judges an association as successful based on the exit code returned by the script; if the script's last command always returns 0, or it explicitly ends with `exit 0`, then even a failed installation will be recorded as compliant. To correctly reflect failures, the script must inspect `$?` (or `$LASTEXITCODE` in PowerShell) after the installer and propagate a non-zero exit. Because this script ignores the installer's failure and exits 0, compliance shows Success despite the software not being installed.

Why this answer

The script likely does not check the exit code of the installation command and always returns 0, so State Manager reports success even when installation fails. Option A is incorrect because the association is running on those instances, as shown by execution history. Option B is incorrect because compliance data is being sent (the 'Success' status is reported).

Option C is incorrect because the association runs, indicating SSM Agent is installed.

Page 18

Page 19 of 20

Page 20