Courseiva

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

1083 questions total · 15pages · All types, answers revealed

Page 13

Page 14 of 15

Page 15
976
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.

977
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.

978
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.

979
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.

980
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.

981
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.

982
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.

983
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.

984
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.

985
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.

986
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.

987
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.

988
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.

989
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.

990
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.

991
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.

992
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.

993
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.

994
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.

995
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.

996
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.

997
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.

998
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.

999
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.

1000
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.

1001
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.

1002
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.

1003
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.

1004
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.

1005
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.

1006
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.

1007
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.

1008
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.

1009
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.

1010
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.

1011
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.

1012
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.

1013
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.

1014
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.

1015
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.

1016
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.

1017
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.

1018
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.

1019
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).

1020
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.

1021
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.

1022
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.

1023
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.

1024
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.

1025
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.

1026
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.

1027
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.

1028
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.

1029
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.

1030
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.

1031
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.

1032
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.

1033
Multi-Selecthard

Which TWO metrics should be monitored in Amazon CloudWatch to detect a potential memory leak in an EC2 instance? (Choose two.)

Select 2 answers
A.DiskReadOps
B.MemoryUtilization (custom metric published via CloudWatch Agent).
C.NetworkIn
D.SwapUsage (custom metric published via CloudWatch Agent).
E.CPUUtilization
AnswersB, D

MemoryUtilization, published as a custom metric by the CloudWatch Agent, is calculated from /proc/meminfo or OS-level memory counters and represents the percentage of actual RAM in use. A memory leak causes this value to climb continuously over time as allocations are never freed, even when the workload is stable. Monitoring this metric reveals the leak as a monotonic upward trend, making it one of the most direct and essential signals for detection.

Why this answer

MemoryUtilization is a custom metric that must be published via the CloudWatch Agent because EC2 does not expose memory metrics by default. Monitoring this metric over time can reveal a steady upward trend in memory usage that does not drop after processes complete, which is a classic symptom of a memory leak.

Exam trap

The trap here is that candidates assume EC2 provides memory metrics by default (like CPUUtilization), but they must be explicitly enabled via the CloudWatch Agent, and they overlook SwapUsage as a complementary indicator of memory pressure from a leak.

1034
MCQeasy

A company wants to ensure its data in Amazon S3 is protected against accidental deletion. The bucket stores critical documents. Which approach provides the HIGHEST level of resilience?

A.Apply a bucket policy that denies s3:DeleteObject for all users.
B.Enable S3 lifecycle policies to archive objects to Glacier.
C.Enable versioning and MFA delete on the bucket.
D.Configure cross-region replication (CRR) to another bucket.
AnswerC

Enabling versioning on the bucket creates a new version for every object put, overwrite, or delete, so a delete operation only inserts a delete marker that hides old versions rather than purging them; with versioning enabled, you can permanently recover any object version. MFA Delete fortifies this by requiring an MFA code (using root credentials) to permanently delete an object version, suspend versioning, or change the versioning state—thus preventing attackers or accidental admin actions from irreversibly destroying data.

Why this answer

Enabling versioning and MFA delete provides protection against both accidental overwrites and malicious deletions. Versioning allows recovery of deleted or overwritten objects, while MFA delete adds an extra layer of security by requiring multi-factor authentication for permanent deletions. Option A is incorrect because a bucket policy that denies s3:DeleteObject can prevent deletions but does not allow recovery if the policy is bypassed or changed.

Option B is incorrect because lifecycle policies archive objects to Glacier, which reduces costs but does not prevent or recover from accidental deletion. Option D is incorrect because cross-region replication protects against regional failures but does not protect against accidental deletion within the source bucket.

1035
MCQhard

A company's production environment consists of EC2 instances in an Auto Scaling group behind an Application Load Balancer (ALB). The instances run a web application that stores session data in an ElastiCache Redis cluster. The company has enabled detailed CloudWatch metrics and set up a dashboard. The operations team notices that the average CPU utilization across the Auto Scaling group spikes to 95% every 15 minutes, coinciding with a high number of Redis connections. What is the MOST likely cause?

A.The application is using Memcached instead of Redis, causing increased load.
B.The Auto Scaling group's scaling policy is based on memory utilization instead of CPU.
C.The ALB has session stickiness enabled, causing traffic to be routed to the same instances.
D.The ElastiCache cluster is not large enough to handle the number of requests.
AnswerC

With session stickiness enabled on the ALB target group, the load balancer consistently routes a given client's requests to the same EC2 instance for the stickiness duration. When a few power users or long-lived connections generate heavy traffic, those specific instances absorb a disproportionate share of load, causing CPU utilization to spike even if the aggregate fleet average remains moderate. This creates a hot-spot pattern where some targets are saturated while others idle, and the Auto Scaling group, if scaling on average CPU, may not react in time.

Why this answer

ALB session stickiness (sticky sessions) causes the load balancer to route requests from the same client to the same EC2 instance. When a large number of clients connect simultaneously (e.g., due to a periodic batch job), they may all be routed to the same few instances, causing CPU spikes on those instances. The high number of Redis connections corresponds to the sessions being stored in Redis.

This explains the 15-minute periodic spikes. Option A is incorrect because Memcached is not used; the question states ElastiCache Redis. Option B is incorrect because the scaling policy is based on CPU utilization, not memory.

Option D is incorrect because the cluster size doesn't cause periodic spikes; it would cause consistent high utilization.

1036
MCQmedium

A company uses Terraform with an S3 backend to manage infrastructure. The DevOps engineer notices that after a colleague runs 'terraform apply' locally, the state file in S3 becomes corrupted and subsequent runs fail. What is the BEST way to prevent this issue?

A.Store the state file locally and commit it to version control.
B.Use DynamoDB for state locking and enable consistency checks.
C.Use S3 server-side encryption to protect the state file.
D.Enable S3 versioning on the state bucket to recover previous versions.
AnswerB

The DynamoDB lock table uses conditional writes to ensure that only one Terraform run can hold the state lock at a time, preventing two `apply` executions from simultaneously updating the same S3 object and causing corruption. Enabling consistency checks (for example, verifying the lock acquisition and using DynamoDB's strongly consistent reads) ensures that the state pulled before a plan or apply is the latest known-good version, so stale or partially written state is never used as the basis for changes.

Why this answer

Enabling DynamoDB for state locking prevents concurrent modifications that can corrupt the state file. When a user runs 'terraform apply', Terraform acquires a lock in DynamoDB, ensuring only one operation modifies the state at a time. Consistency checks (e.g., using DynamoDB's conditional writes) further validate that the state hasn't been tampered with, directly addressing the corruption issue.

Exam trap

The trap here is that candidates often confuse recovery mechanisms (like S3 versioning) with prevention mechanisms (like state locking), leading them to choose Option D even though it only mitigates damage after corruption occurs.

How to eliminate wrong answers

Option A is wrong because storing the state file locally and committing it to version control introduces risks of manual merge conflicts, stale state, and accidental exposure of sensitive data; it does not prevent corruption from concurrent applies. Option C is wrong because S3 server-side encryption protects data at rest but does not prevent concurrent writes or state corruption from race conditions. Option D is wrong because S3 versioning allows recovery of previous state versions after corruption, but it does not prevent the corruption from occurring in the first place.

1037
MCQeasy

A company uses AWS CodeBuild to compile a Java application. The build specification includes a pre-build phase to download dependencies. Which file defines the commands for each build phase?

A.pipeline.json
B.buildspec.yml
C.config.xml
D.appspec.yml
AnswerB

buildspec.yml is the correct file because AWS CodeBuild automatically looks for a file named buildspec.yml in the root of the source code directory, unless an alternate buildspec file is specified in the build project. This YAML file defines the build phases—install, pre_build, build, and post_build—along with environment variables, artifact output, and cache settings. For a Java application, the `build` phase would contain commands such as `mvn compile` or `gradle build` to compile the source code. Without a valid buildspec, CodeBuild will fail unless an inline buildspec is provided in the project configuration.

Why this answer

In AWS CodeBuild, the build specification file named 'buildspec.yml' defines the commands that CodeBuild runs during each phase of the build process, including the pre-build phase for downloading dependencies. This YAML file is placed in the root of the source code or specified in the build project configuration, and it contains structured sections for install, pre_build, build, and post_build phases. Option B is correct because buildspec.yml is the standard file that CodeBuild uses to orchestrate build commands.

Exam trap

The trap here is that candidates often confuse the build specification file for CodeBuild (buildspec.yml) with the deployment specification file for CodeDeploy (appspec.yml), especially since both services are part of the AWS CI/CD pipeline and have similar naming patterns.

How to eliminate wrong answers

Option A is wrong because pipeline.json is not a file used by AWS CodeBuild; it is associated with AWS CodePipeline for defining pipeline stages and actions, not for specifying build phase commands. Option C is wrong because config.xml is a configuration file commonly used by Jenkins (a different CI/CD tool) for job configuration, not by AWS CodeBuild. Option D is wrong because appspec.yml is used by AWS CodeDeploy to define deployment lifecycle hooks and file mappings, not for CodeBuild build phases.

1038
MCQhard

A company has a multi-account strategy using AWS Organizations. The security team needs to respond to incidents across all accounts. They want to ensure that all CloudTrail trails are enabled and logging to a central S3 bucket in the management account. What is the MOST efficient way to monitor compliance?

A.Create a CloudTrail organization trail and use CloudTrail Insights to detect configuration changes.
B.Use AWS Config conformance packs with a managed rule to check CloudTrail is enabled.
C.Set up CloudWatch Events rules in each account to detect trail disabling.
D.Use AWS Trusted Advisor to check CloudTrail configuration in each account.
AnswerB

AWS Config conformance packs provide a way to deploy a collection of AWS Config rules and remediation actions across all accounts and Regions in an organization. A managed rule such as `cloudtrail-enabled` can be included in a conformance pack to verify that CloudTrail trails are configured and enabled, and the results are aggregated centrally in the AWS Config console for the entire organization. This approach gives a single, policy-as-code mechanism to enforce and audit CloudTrail enablement consistently across every account.

Why this answer

AWS Config conformance packs with managed rules can be deployed across multiple accounts using StackSets or directly via AWS Organizations to check that CloudTrail trails are enabled and logging to a central S3 bucket. This provides centralized, automated compliance monitoring without manual per-account setup. Option A is wrong because CloudTrail Insights detects unusual API activity, not configuration compliance.

Option C is wrong because setting up CloudWatch Events rules in each account is less efficient and harder to maintain than Config conformance packs. Option D is wrong because Trusted Advisor checks are per-account and cannot be centrally enforced across an organization.

Exam trap

Candidates might mistakenly believe that CloudTrail organization trails or Trusted Advisor can monitor compliance across all accounts, but neither provides the centralized rule enforcement and automated remediation that AWS Config conformance packs offer.

1039
MCQeasy

Refer to the exhibit. A DevOps engineer attaches the IAM policy to an IAM user. The user reports being unable to download objects from the S3 bucket. What is the likely cause?

A.The bucket policy denies access to the user
B.The policy is malformed because the Resource element is incorrect
C.The policy does not allow s3:ListBucket, which is required for the AWS CLI to list objects
D.The user's access key is expired
AnswerC

The AWS CLI's high-level command aws s3 cp does not directly invoke GetObject on a known key; it first performs a ListObjectsV2 operation to discover the objects in the bucket. Even if the IAM policy allows s3:GetObject, without the s3:ListBucket permission the CLI receives AccessDenied when attempting to list the source bucket. This is a common gotcha because users assume GetObject is sufficient for downloads, but the CLI's behavior requires both actions for object transfer commands.

Why this answer

The policy only allows s3:GetObject, but the user may be trying to list objects or access a bucket that requires additional permissions. Option A is wrong because the policy allows GetObject. Option B is wrong because the policy is not malformed.

Option D is wrong because the user is allowed to access the bucket.

1040
MCQmedium

A company uses AWS CodePipeline to deploy a Node.js application to AWS Elastic Beanstalk. The pipeline includes a build stage using AWS CodeBuild. Developers notice that the deployed application occasionally crashes due to missing environment variables that were configured in the Elastic Beanstalk environment but not passed from CodeBuild. What is the MOST efficient way to ensure the environment variables are consistently applied?

A.Define environment variables in the source code using .ebextensions configuration files.
B.Update the environment variables manually in the Elastic Beanstalk console after each deployment.
C.Use the aws elasticbeanstalk update-environment CLI command after the pipeline completes.
D.Store environment variables in AWS Systems Manager Parameter Store and have the application retrieve them at runtime.
AnswerA

Commit the variables in a .ebextensions/*.config file (e.g., option_settings for namespace aws:elasticbeanstalk:application:environment). CodePipeline packages the entire source into the application version, and the Elastic Beanstalk deployment agent processes this file automatically, injecting the values into the Node.js process's environment. This makes environment configuration declarative, versioned, and reproducible for every pipeline run, eliminating manual or post-deployment steps.

Why this answer

Ebextensions configuration files allow you to define environment variables declaratively in the source code, ensuring they are consistently applied during every deployment via CodePipeline. This approach eliminates the dependency on runtime or manual steps, as the Elastic Beanstalk environment automatically reads these files during environment creation and updates. It integrates seamlessly with CodeBuild and CodePipeline, making it the most efficient and reliable method for maintaining environment variable consistency.

Exam trap

The trap here is that candidates often assume runtime parameter retrieval (e.g., from Parameter Store or Secrets Manager) is the best practice for all scenarios, but for environment variables required at process startup in Elastic Beanstalk, .ebextensions provide a more reliable and simpler solution that avoids application code changes and ensures variables are set before the application runs.

How to eliminate wrong answers

Option B is wrong because manually updating environment variables in the Elastic Beanstalk console after each deployment is error-prone, not scalable, and violates the principle of infrastructure as code, leading to configuration drift. Option C is wrong because using the aws elasticbeanstalk update-environment CLI command after the pipeline completes introduces an extra post-deployment step that can fail or be forgotten, and it does not tie the variables to the source code version, making rollbacks inconsistent. Option D is wrong because while Parameter Store can be used for runtime retrieval, it requires application code changes to fetch variables at startup, adds latency, and does not guarantee the variables are present during the Elastic Beanstalk environment initialization, potentially causing crashes before the application code runs.

1041
Multi-Selectmedium

A company uses AWS CodePipeline with a source stage from Amazon S3 and a deploy stage to AWS Elastic Beanstalk. The pipeline has been working for months, but recently the deploy stage started failing with the error 'The S3 object does not exist.' The source artifact is uploaded to the S3 bucket by an external system. Which TWO actions should be taken to resolve this issue? (Choose TWO.)

Select 2 answers
A.Ensure the external system does not overwrite the object after the pipeline execution starts.
B.Change the source stage to use AWS CodeCommit instead of S3.
C.Enable versioning on the S3 bucket and configure the pipeline to use the specific version ID.
D.Use server-side encryption with AWS KMS (SSE-KMS) on the S3 bucket.
E.Increase the timeout for the deploy stage in the pipeline.
AnswersA, C

CodePipeline's S3 source action resolves the artifact by object key at the moment the pipeline execution starts. If an external system overwrites or deletes that object during the run, the pipeline may fetch a different revision or fail entirely because the original content no longer exists. Enforcing immutability through a write-once policy or access controls prevents this race condition and guarantees the pipeline operates on a stable artifact.

Why this answer

The deploy stage fails with 'The S3 object does not exist' when the external system overwrites the source artifact after the pipeline execution starts. CodePipeline references the object by its key at the time the pipeline is triggered; if the object is replaced (i.e., deleted and re-uploaded with the same key), the pipeline may attempt to download a version that no longer exists, especially if the S3 bucket is not versioned. Ensuring the external system does not overwrite the object during execution prevents this race condition.

Exam trap

The trap here is that candidates often assume the error is due to a permission or encryption issue (like SSE-KMS) rather than recognizing it as a classic race condition caused by object overwriting in a non-versioned bucket.

1042
MCQhard

A company runs a web application on Amazon ECS with Fargate launch type behind an Application Load Balancer (ALB). The application uses an RDS MySQL database. The security team performed a penetration test and discovered that the application is vulnerable to SQL injection. The development team has deployed a WAF web ACL to the ALB that includes rules to block SQL injection attacks. However, after the deployment, the application started returning 403 errors for legitimate requests, and the security team needs to investigate. The team also wants to ensure that only approved AWS services can access the RDS database. The current security groups are configured with a rule that allows inbound traffic from the ALB security group to the RDS database on port 3306. Which combination of actions should the security team take to resolve the issue and improve the security posture?

A.Disable the WAF rules that are causing false positives and add network ACLs to block all traffic to the database except from the ALB.
B.Remove the WAF web ACL and rely on security group ingress rules that allow all traffic from the VPC CIDR to the database.
C.Switch the WAF web ACL to count mode and add a second ALB in front of the database to filter traffic.
D.Switch the WAF web ACL to count mode while tuning the rules, and implement an IAM policy to restrict database access to specific AWS services using the aws:SourceArn condition key.
AnswerD

Switching to count mode allows monitoring and tuning of WAF rules to eliminate false positives while still detecting SQL injection. Implementing an IAM policy with the aws:SourceArn condition key restricts database access to only approved AWS services, enhancing security beyond network controls.

Why this answer

The correct answer. Switching the WAF web ACL to count mode allows the security team to monitor requests that would be blocked without actually blocking them, enabling them to fine-tune the rules to eliminate false positives while still protecting against SQL injection. Additionally, implementing an IAM policy with the aws:SourceArn condition key can restrict database access to only approved AWS services, such as Lambda functions or specific EC2 instances, enhancing the security posture beyond just network-level controls.

Option A is incorrect because disabling WAF rules would leave the application vulnerable, and network ACLs are stateless and not sufficient for fine-grained access control. Option B is incorrect because relying solely on security groups with VPC CIDR allows broad access and does not address the false positive issue. Option C is incorrect because adding a second ALB is unnecessary and does not solve the false positive problem, and using count mode alone without IAM policy does not address database access restrictions.

1043
MCQeasy

A company experiences an unexpected spike in network traffic to a web application hosted on EC2 instances behind an Application Load Balancer. The DevOps team needs to investigate the source IP addresses generating the traffic. Which AWS service should they use to capture the traffic?

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

VPC Flow Logs capture IP traffic metadata for every network interface in a VPC, subnet, or at the interface level, recording source and destination IP addresses, ports, protocol, packet/byte counts, and whether the action was accepted or rejected by security groups and network ACLs. Enabling flow logs on the affected VPC or subnets would immediately provide the raw data needed to identify the top talkers, unusual port usage, or malicious sources behind the spike. This makes it the correct service for diagnosing an unexpected increase in network traffic.

Why this answer

VPC Flow Logs capture IP traffic information, including source and destination IPs, ports, and protocols, allowing investigation of source IPs. Option A (CloudWatch Logs) is wrong because it captures application logs, not network traffic. Option B (AWS Config) is wrong because it records resource configuration changes.

Option C (CloudTrail) is wrong because it logs API calls, not network traffic.

1044
MCQmedium

A company is using AWS OpsWorks for configuration management. They have a stack with a PHP application layer and a MySQL layer. The DevOps team needs to update the PHP version across all instances. They create a custom Chef recipe that updates the PHP package and add it to the lifecycle events. After running the 'Setup' lifecycle event on the layer, the instances are updated but the application stops working because the new PHP version is incompatible with some custom PHP extensions. The team needs to roll back the PHP version to the previous one quickly and minimize downtime. The instances are in an Auto Scaling group with a desired count of 4. What should the team do?

A.Re-run the old 'Setup' recipe that installs the previous PHP version on the layer.
B.Create a new AMI with the old PHP version, launch new instances, and terminate the old ones.
C.Use the OpsWorks 'Rollback' feature to revert the stack to a previous state.
D.Manually SSH into each instance and downgrade the PHP package, then restart the web server.
AnswerA

The correct approach in OpsWorks Stacks is to run the original 'Setup' recipe manually on the layer by using the 'Execute Recipes' action, which re-applies the Chef code that installs and configures the previous PHP version on all instances. Because lifecycle recipes should be idempotent, re-running the Setup recipe restores the desired PHP version without needing to recreate instances or manually edit files. This leverages OpsWorks's intended pattern for configuration changes and updates all instances in the layer in a controlled, automated manner.

Why this answer

Re-running the old 'Setup' recipe on the layer will revert the PHP version to its previous state, leveraging Chef's idempotency and the OpsWorks lifecycle event system. This approach minimizes downtime as it only re-applies the old configuration without reprovisioning instances. Option B is incorrect because creating a new AMI and launching new instances takes time and may cause prolonged downtime.

Option C is incorrect because OpsWorks does not have a built-in 'Rollback' feature; you must use recipes to revert changes. Option D is incorrect because manually SSHing into each instance is error-prone, not scalable, and not recommended for production environments.

Exam trap

Candidates might assume that OpsWorks has a native rollback feature for stacks, but it does not. The correct approach is to re-run the previous recipe via the appropriate lifecycle event.

1045
Multi-Selectmedium

A company is designing a disaster recovery plan for an RDS PostgreSQL database. They have a cross-region read replica. Which THREE steps should they take to ensure a successful failover?

Select 3 answers
A.Enable automated backups on the replica before promotion
B.Configure applications to use the new database endpoint
C.Update Route 53 DNS record to point to the new master
D.Promote the read replica to a standalone database instance
E.Enable Multi-AZ on the read replica before promotion
AnswersB, C, D

A promoted read replica is a new database instance with a distinct DNS endpoint; the original master endpoint does not automatically reroute to the replica. Applications that connect using the old endpoint will continue hitting the original instance (or fail if it is down), so you must update your connection strings or configuration to use the promoted replica's endpoint. In complex environments, this is often managed via a CNAME that can be repointed to the replica, but the core requirement is that clients resolve to the new master.

Why this answer

To failover a cross-region read replica, promote it to a standalone database instance (Option D). After promotion, update the Route 53 DNS record to point to the new master (Option C) and configure applications to use the new database endpoint (Option B). Option A is incorrect because automated backups are enabled by default on the replica once promoted or can be enabled separately, but they are not required prior to promotion.

Option E is incorrect because Multi-AZ is not supported on read replicas in the same region; cross-region replicas also cannot have Multi-AZ before promotion. Multi-AZ can be configured after promotion if desired.

1046
MCQhard

A company runs a production application on Amazon ECS with Fargate launch type. The application uses an RDS MySQL database. The security team requires that all traffic between the application and the database be encrypted in transit. Currently, the database security group allows inbound traffic from the ECS tasks' security group on port 3306 (MySQL). The application uses the standard MySQL client connection without SSL. After enabling SSL on the RDS instance, the application starts failing to connect. The error logs show 'SSL connection error: protocol version mismatch'. The application runs on a custom Docker image based on Amazon Linux 2. The DevOps engineer needs to fix the connection issue. Which course of action should the engineer take?

A.Update the Docker image to include the latest MySQL client libraries that support TLS 1.2.
B.Update the application code to connect using SSL with the --ssl-mode=REQUIRED flag.
C.Modify the RDS parameter group to allow TLS 1.0 and 1.1.
D.Create a VPC peering connection and route traffic through a VPN.
AnswerA

The root cause is a TLS protocol version mismatch: the MySQL client library in the Docker image is too old to negotiate TLS 1.2, which is the minimum version required by Amazon RDS for MySQL. Rebuilding the Docker image with the latest MySQL client libraries ensures the client supports TLS 1.2 (and later), allowing the SSL handshake to succeed. This is the correct fix because it directly addresses the version negotiation failure at the transport layer without forcing insecure protocol fallbacks.

Why this answer

The error indicates that the MySQL client in the container does not support the TLS version required by RDS. The simplest solution is to modify the application connection string to use the '--ssl-mode=REQUIRED' flag or equivalent, but the error persists even after that. The actual fix is to update the MySQL client libraries in the container image to a version that supports TLS 1.2, as RDS requires TLS 1.2 or higher.

Alternatively, the engineer can configure RDS to accept TLS 1.0, but that is not secure. Changing the security group or using SSH tunneling does not address the TLS version mismatch.

1047
MCQhard

A company runs a containerized microservices application on Amazon EKS. The application includes a critical service that processes real-time financial transactions. This service must be highly available and resilient to node failures. The current setup uses a Deployment with 3 replicas and a ClusterIP service. During a recent node failure, the application experienced a brief period of unavailability. Which action should the DevOps engineer take to improve resilience without changing the underlying infrastructure?

A.Change the service type from ClusterIP to NodePort and configure an external load balancer.
B.Increase the number of replicas to 10 and use a node selector to schedule all pods on the largest instance type.
C.Configure a PodDisruptionBudget with a maxUnavailable of 1, and add pod anti-affinity rules to spread pods across different nodes.
D.Enable HorizontalPodAutoscaler with a target CPU utilization of 50% to automatically scale the Deployment.
AnswerC

A PodDisruptionBudget with maxUnavailable:1 guarantees that at most one Pod is unavailable during voluntary evictions such as node drains, and pod anti-affinity rules (preferably with topologyKey kubernetes.io/hostname) force the scheduler to place replicas on distinct nodes. This means an involuntary node failure can kill only one replica, and the remaining replicas continue to serve traffic. Combined, these mechanisms directly address both failure classes—involuntary hardware failures and voluntary maintenance—by ensuring the application always has at least N-1 replicas available across different failure domains.

Why this answer

A PodDisruptionBudget with maxUnavailable=1 ensures that at most one pod is unavailable during voluntary disruptions, while pod anti-affinity rules force the scheduler to distribute pods across different nodes. This combination prevents a single node failure from taking down all replicas, maintaining service availability without altering the underlying infrastructure.

Exam trap

The trap here is that candidates often confuse scaling (HPA or more replicas) with resilience, failing to realize that without proper pod distribution and disruption budgets, scaling alone cannot prevent downtime from node failures.

How to eliminate wrong answers

Option A is wrong because changing to NodePort with an external load balancer adds network complexity and does not address pod distribution or node failure resilience; the ClusterIP service already provides internal load balancing. Option B is wrong because increasing replicas to 10 and using node selector to pin pods to the largest instance type actually reduces resilience by creating a single point of failure on that node. Option D is wrong because HorizontalPodAutoscaler scales based on CPU utilization, which does not protect against node failures; it may even exacerbate the problem by scaling pods onto the same failing nodes.

1048
Multi-Selecthard

A company runs a critical application on Amazon EC2 instances in an Auto Scaling group. The application generates logs that are sent to Amazon CloudWatch Logs. The DevOps team needs to configure a metric filter to monitor for error patterns and trigger an alarm when the error rate exceeds 5% of total requests over a 5-minute period. Which TWO steps should the team take? (Choose TWO.)

Select 2 answers
A.Create a CloudWatch Logs log group for the error metric.
B.Create a metric filter on the log group to count occurrences of the error pattern.
C.Create a CloudWatch Logs subscription filter to stream errors to a Lambda function that calculates the error rate.
D.Create a CloudWatch metric for the error count.
E.Create a CloudWatch alarm that uses a math expression to calculate the error rate (error count / total request count) and compare it to the threshold of 5%.
AnswersB, E

This creates a custom metric for error count.

Why this answer

To achieve the monitoring goal, the team must first create a metric filter on the existing log group (Option B). This filter defines the error pattern to count and emits a custom metric for the error count. Then, they need to create a CloudWatch alarm that uses a math expression to calculate the error rate by dividing the error count metric by a total request count metric (or by using the same log group with another filter for total requests) and triggers when the rate exceeds 5% over 5 minutes (Option E).

Option A is not required because the log group already exists. Option C is incorrect because a subscription filter would forward logs to Lambda, but the requirement is to use metric filters and alarms. Option D is incorrect because the metric is automatically created by the metric filter; you do not need to manually create a separate metric.

1049
MCQmedium

A company uses AWS CloudFormation to manage its infrastructure. The DevOps team wants to ensure that critical resources, such as an RDS database, are not accidentally deleted when a stack is updated or deleted. Which CloudFormation feature should be used to prevent this?

A.DeletionPolicy attribute with Retain
B.Stack policy
C.Termination protection
D.DependsOn attribute
AnswerA

DeletionPolicy: Retain on a resource instructs AWS CloudFormation to preserve that physical resource when the stack is deleted. Without it, DeleteStack removes every resource in the template; with Retain, the resource is simply left in place and becomes orphaned, allowing you to keep critical data such as databases or S3 buckets. This is the standard way to prevent accidental data loss during stack deletion.

Why this answer

The DeletionPolicy attribute with the Retain value is the correct choice because it explicitly instructs CloudFormation to preserve the physical resource (e.g., an RDS database) when its corresponding logical resource is deleted from the stack template during an update or when the entire stack is deleted. This prevents accidental deletion of critical stateful resources by ensuring the resource remains in the AWS account even after the stack operation completes.

Exam trap

The trap here is that candidates confuse termination protection (an EC2-specific feature) with CloudFormation's DeletionPolicy, or mistakenly think a stack policy can prevent deletion during a full stack deletion, when it only restricts update operations.

How to eliminate wrong answers

Option B is wrong because a stack policy is an IAM-like resource-level policy that controls which stack resources can be updated or deleted during a stack update, but it does not prevent deletion when the entire stack is deleted; it only restricts update/delete actions during an update operation. Option C is wrong because termination protection is an EC2 instance-level feature that prevents accidental termination of an EC2 instance, not a CloudFormation feature and not applicable to RDS databases. Option D is wrong because the DependsOn attribute only specifies resource creation order within a stack template; it has no effect on preventing deletion of resources during stack updates or deletions.

1050
MCQhard

A company's security team suspects that an attacker has compromised an IAM user's access keys. The keys were used to launch instances in an unauthorized region. What is the FASTEST way to mitigate the threat?

A.Delete the IAM user.
B.Change the IAM user's password.
C.Rotate the access keys immediately.
D.Attach an AWS WAF to block the attacker's IP address.
AnswerC

Rotating the access keys means generating a new access key pair for the IAM user, updating dependent applications with the new credentials, and then deactivating and deleting the compromised keys. This immediately denies requests signed with the stolen keys because IAM checks key validity for every call, making it the fastest, least-disruptive way to stop the attacker.

Why this answer

Rotating the access keys immediately invalidates the compromised keys, preventing further unauthorized use without disrupting the IAM user's other permissions or requiring a full user recreation. This is the fastest mitigation because it directly revokes the attacker's access while allowing the legitimate user to continue using new keys after rotation.

Exam trap

The trap here is that candidates confuse password changes (console access) with access key rotation (programmatic access), or they overcorrect by deleting the entire user instead of simply rotating the compromised keys.

How to eliminate wrong answers

Option A is wrong because deleting the IAM user is an overly drastic measure that removes all permissions and associated resources, causing unnecessary downtime and operational overhead; it is not the fastest way to stop key-based access. Option B is wrong because changing the IAM user's password only affects console login credentials, not access keys, so it does nothing to mitigate the threat from compromised programmatic keys. Option D is wrong because AWS WAF is a web application firewall that operates at the application layer (HTTP/HTTPS) and cannot block IAM access key usage, which occurs at the AWS API level via Signature Version 4 signing.

Page 13

Page 14 of 15

Page 15