Courseiva

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

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

Page 15

Page 16 of 20

Page 17
1126
MCQmedium

A DevOps team uses AWS CodeDeploy to deploy an application to an Auto Scaling group. The deployment fails with an error 'The overall deployment failed because too many individual instances failed deployment'. The team checks the instance logs and finds that the 'BeforeInstall' lifecycle event script returned a non-zero exit code. What is the BEST approach to resolve this?

A.Set the 'ignoreScriptFailure' option to true in the AppSpec file and redeploy.
B.Manually run the script on an instance and then resume the deployment.
C.Fix the script error in the revision and redeploy.
D.Change the deployment configuration to 'AllAtOnce' to speed up deployment.
AnswerC

Fixing the script error in the application revision directly addresses the root cause: the failure is deterministic in the artifact, so every instance that runs the same script will encounter the same problem. A subsequent redeployment with the corrected AppSpec or associated script lets CodeDeploy re-run the lifecycle hooks on all target instances, ensuring consistent and reproducible success. This is the standard remediation because CodeDeploy deployments are immutable artifacts—changes must be made in the revision, not on live instances.

Why this answer

The deployment failed due to a script error in the BeforeInstall lifecycle event. The root cause is the script itself, so fixing the script error in the revision and redeploying addresses the issue permanently. Option A is wrong because setting 'ignoreScriptFailure' to true would mask the error and could lead to application issues.

Option B is wrong because manually running the script on an instance does not fix the underlying issue in the revision, and the deployment will fail again. Option D is wrong because changing the deployment configuration to 'AllAtOnce' does not fix the script error and may cause more instances to fail simultaneously.

1127
MCQhard

Refer to the exhibit. A user outside the 192.0.2.0/24 IP range attempts to get an object from example-bucket. What will happen?

A.The request is allowed because the Allow statement matches
B.The request is allowed because there is no explicit Deny for GetObject
C.The request is denied because the policy is malformed
D.The request is denied because the Deny statement applies
AnswerD

The request is denied because the Deny statement is explicitly written to block access for users whose IP address is not within the 192.0.2.0/24 range. The policy uses a condition such as NotIpAddress, and since the user originates from an IP outside that range, the Deny condition evaluates to true. In AWS authorization, any applicable explicit Deny immediately overrides all Allow statements, so the request is denied regardless of any other matching permissions.

Why this answer

The Deny statement explicitly denies all S3 actions if the IP is not in the allowed range. Since the user is outside, the Deny applies, overriding the Allow. Option A is wrong because the Deny blocks access.

Option B is wrong because the Deny is explicit. Option C is wrong because the policy is not malformed.

1128
MCQhard

A company uses AWS CodeDeploy to deploy a web application to an Auto Scaling group. After a deployment, some instances fail the health check and are terminated by the Auto Scaling group. What should the DevOps engineer do to prevent this?

A.Configure a CloudWatch alarm to stop the deployment if instances are unhealthy.
B.Modify the deployment configuration to deploy to only one instance at a time.
C.Update the deployment group to use an Elastic Load Balancer and configure health checks.
D.Increase the desired capacity of the Auto Scaling group to tolerate failures.
AnswerC

Registering the instances with an Elastic Load Balancer and configuring health checks in the CodeDeploy deployment group is the correct fix because CodeDeploy can then use the ELB's health check to validate that each instance is serving traffic correctly before allowing the deployment to continue. ELB health checks also enable automatic instance replacement by the Auto Scaling group when an instance becomes unhealthy, which prevents the deployment from being stuck with known-bad hosts. This integrates deployment validation with traffic shift and instance lifecycle management, directly addressing the health check failure at the application layer.

Why this answer

Configuring an Elastic Load Balancer (ELB) with health checks in the CodeDeploy deployment group allows CodeDeploy to monitor instance health during deployment. If an instance fails the ELB health check, CodeDeploy can automatically roll back or stop the deployment, preventing the Auto Scaling group from terminating unhealthy instances. This integrates the deployment lifecycle with load balancer health signals, ensuring only healthy instances serve traffic.

Exam trap

The trap here is that candidates often confuse Auto Scaling group health checks (which terminate instances) with CodeDeploy's deployment health checks (which can stop or roll back deployments), leading them to choose options that only address symptoms rather than integrating the two services properly.

How to eliminate wrong answers

Option A is wrong because a CloudWatch alarm can trigger actions like scaling or notifications, but it cannot directly stop a CodeDeploy deployment; CodeDeploy has its own built-in rollback and health check mechanisms that should be used. Option B is wrong because deploying to one instance at a time reduces risk but does not prevent instances from failing health checks and being terminated by the Auto Scaling group; it only limits blast radius. Option D is wrong because increasing the desired capacity of the Auto Scaling group does not address the root cause of health check failures; it only masks the problem by adding more instances, and unhealthy instances will still be terminated.

1129
MCQhard

A DevOps engineer is troubleshooting a slow AWS CodeBuild project. The build is a Java application that compiles source code and runs tests. The build environment uses a general1.large compute type. The build duration has increased from 5 minutes to 15 minutes over the past month. The engineer notices that the build logs show 'Downloading...' messages for Maven dependencies for several minutes. What is the most cost-effective way to reduce the build time?

A.Configure the build to use a VPC with a NAT gateway
B.Use AWS CodeArtifact as a proxy for Maven dependencies
C.Change the compute type to general1.2xlarge
D.Enable local caching in the CodeBuild project for dependencies
AnswerD

Enabling local caching in the CodeBuild project tells the build runner to preserve a cache directory on the build host between executions, and when using Maven you can point it at the local repository (~/.m2) so previously downloaded artifacts are reused instead of fetched again. This directly eliminates the repeated network transfer of third-party dependencies, making PR builds dramatically faster by serving artifacts from local disk. Unlike remote caches or bigger compute, it targets the exact dependency-resolution bottleneck and works for both Maven and other package managers when configured correctly.

Why this answer

Enabling local caching in AWS CodeBuild allows the build environment to cache Maven dependencies in the local file system across builds. This eliminates the need to re-download dependencies from remote repositories each time, directly addressing the 'Downloading...' messages in the logs. It is the most cost-effective solution as it requires no additional AWS services or compute upgrades.

Exam trap

The trap here is that candidates often assume upgrading compute resources (Option C) or adding network components (Option A) will fix performance issues, when the actual bottleneck is repetitive network downloads that can be eliminated with caching.

How to eliminate wrong answers

Option A is wrong because configuring the build to use a VPC with a NAT gateway would add network complexity and cost without solving the dependency download bottleneck; NAT gateways are for outbound internet access from private subnets, not for caching dependencies. Option B is wrong because while AWS CodeArtifact can serve as a proxy for Maven dependencies, it introduces additional service costs and setup overhead, making it less cost-effective than local caching for this specific scenario. Option C is wrong because changing the compute type to general1.2xlarge would increase cost by doubling compute capacity without addressing the root cause of slow dependency downloads; the build time is dominated by network latency, not CPU or memory constraints.

1130
MCQeasy

A company uses Amazon DynamoDB as the database for a mobile application. The application requires single-digit millisecond read and write latency and must be resilient to the failure of an entire AWS Region. Which DynamoDB feature should the company use?

A.DynamoDB point-in-time recovery (PITR)
B.DynamoDB global tables
C.DynamoDB Accelerator (DAX)
D.DynamoDB on-demand capacity mode
AnswerB

DynamoDB global tables create a fully managed, multi-Region, multi-master replicated database using DynamoDB Streams and a backend replication engine. Changes made in any replica table are replicated to all other selected Regions with sub-second latency, enabling active-active failover: if one Region fails, traffic can be redirected to a remaining Region with minimal or zero downtime. This architecture directly addresses the requirement for low-latency access and resilience to Regional outages, making it the correct answer.

Why this answer

DynamoDB global tables provide multi-Region, multi-active replication, ensuring the application can withstand an entire AWS Region failure while maintaining single-digit millisecond read and write latency in each Region. This is achieved through DynamoDB Streams and a last-writer-wins conflict resolution mechanism, making it the correct choice for cross-Region resilience.

Exam trap

The trap here is that candidates often confuse high-availability features like DAX (caching) or PITR (backup) with true disaster recovery and multi-Region resilience, failing to recognize that only global tables replicate data across Regions for active-active failover.

How to eliminate wrong answers

Option A is wrong because point-in-time recovery (PITR) protects against accidental writes or deletions by enabling restoration to any point within the last 35 days, but it does not provide cross-Region resilience or continuous availability during a Region outage. Option C is wrong because DynamoDB Accelerator (DAX) is an in-memory cache that improves read latency but operates within a single Region and does not replicate data across Regions, offering no protection against a full Region failure. Option D is wrong because on-demand capacity mode handles traffic spikes automatically but is a scaling feature within a single Region, not a disaster recovery or multi-Region replication solution.

1131
Multi-Selectmedium

Which TWO actions should a DevOps engineer take to implement a GitFlow branching strategy for infrastructure as code using AWS CodeCommit and CodePipeline? (Choose two.)

Select 2 answers
A.Disable automatic triggers on the master branch to prevent accidental deployments.
B.Use CodeBuild to run unit tests on feature branches before merging.
C.Use a single pipeline that handles all branches.
D.Create separate pipelines for develop and master branches.
E.Configure CodePipeline to trigger on pull request creation.
AnswersB, D

Using CodeBuild to run unit tests on feature branches is correct because it provides fast, isolated feedback on each commit before the code is merged into develop. CodeBuild can be configured to respond to branch push or pull request webhooks, allowing tests to run without requiring a full CodePipeline execution. This validates code early in the development cycle, reducing the chance of integration problems and aligning with GitFlow's feature branch workflow.

Why this answer

Options B and D are correct. Option B: CodeBuild can run unit tests on feature branches before merging, ensuring code quality. Option D: Separate pipelines for develop and master branches allow different deployment behaviors (e.g., non-prod vs. prod).

Option A is wrong because disabling automatic triggers on the master branch would prevent automated deployments when changes are merged, which is contrary to GitFlow where master deployments are desired. Option C is wrong because a single pipeline for all branches reduces flexibility and can cause unintended deployments. Option E is wrong because CodePipeline does not natively support pull request triggers; use CodeBuild or other services for that.

1132
MCQhard

A company uses AWS CloudFormation to manage infrastructure. The development team wants to promote changes from a development environment to a production environment using change sets. They need to ensure that the production stack is not updated if there are any changes to the stack's IAM policies. Which approach should the team use?

A.Enable drift detection on the production stack and compare with the development stack.
B.Create a ChangeSet from the updated template, review the changes for IAM modifications, and execute only if no IAM changes are present.
C.Use AWS CloudFormation StackSets to deploy to multiple accounts and use stack instance filters.
D.Use a custom resource in the template that checks for IAM changes and fails the update.
AnswerB

ChangeSets provide a preview of all changes, including IAM resource modifications.

Why this answer

AWS CloudFormation change sets allow you to review the proposed changes to a stack before executing them. By creating a change set from the updated template, the team can inspect the list of changes and specifically look for any modifications to IAM resources (e.g., AWS::IAM::Role, AWS::IAM::Policy). If the change set contains IAM-related changes, they can choose not to execute it, thereby preventing unintended updates to the production stack's IAM policies.

Exam trap

The trap here is that candidates may confuse drift detection (which is reactive) with change sets (which are proactive), or they may think that StackSets or custom resources are needed for multi-environment promotion, when in fact change sets provide a simple, native mechanism for reviewing and selectively applying updates.

How to eliminate wrong answers

Option A is wrong because drift detection compares the current state of a stack with its expected template configuration, but it does not prevent updates; it only reports differences after they occur. Option C is wrong because AWS CloudFormation StackSets are designed for deploying identical templates across multiple accounts and regions, not for reviewing or blocking changes based on IAM modifications in a single production stack. Option D is wrong because a custom resource that checks for IAM changes and fails the update would require complex custom logic and would not leverage the built-in change set review capability; it also risks breaking the update process entirely rather than providing a controlled review step.

1133
MCQhard

A company has a VPC with public and private subnets. An EC2 instance in the private subnet needs to download patches from the internet but must not be directly accessible from the internet. Which configuration allows this?

A.Set up a VPN connection to the company's on-premises network and route traffic through it.
B.Deploy a NAT gateway in a public subnet and route the private subnet's traffic through it.
C.Deploy a bastion host in the public subnet and configure the instance to use it.
D.Attach an internet gateway to the VPC and add a route to the private subnet route table.
AnswerB

Deploying a NAT gateway in a public subnet is the correct solution because it allows instances in a private subnet to initiate outbound IPv4 traffic to the internet while blocking any unsolicited inbound connections. A NAT gateway is a highly available, managed service that resides in a public subnet with an Elastic IP; the private subnet's route table simply adds a 0.0.0.0/0 route pointing to the NAT gateway. This preserves the instance's private reachability and satisfies the requirement without exposing it publicly.

Why this answer

A NAT gateway deployed in a public subnet allows instances in private subnets to initiate outbound traffic to the internet while preventing inbound connections from the internet. This matches the requirement for downloading patches without direct accessibility. Option B is correct.

Option A is incorrect because a VPN connection provides access to an on-premises network, not general internet access. Option C is incorrect because a bastion host provides SSH/RDP access to instances, not outbound internet connectivity for patch downloads. Option D is incorrect because attaching an internet gateway and adding a route to the private subnet route table would make the instances directly accessible from the internet, violating the requirement.

1134
MCQeasy

A company uses Amazon Route 53 for DNS. They want to ensure that if their primary website endpoint fails, traffic is automatically routed to a secondary endpoint in a different Region. Which routing policy should be used?

A.Latency routing
B.Simple routing
C.Failover routing
D.Weighted routing
AnswerC

Failover routing is the correct choice because it explicitly pairs a primary record with a secondary record and uses Route 53 health checks to decide which to return. When the health check for the primary endpoint fails, Route 53 automatically returns the secondary record's value. This works in an active-passive configuration and gives the deterministic failover behavior the company requires.

Why this answer

Failover routing policy allows you to configure an active-passive failover setup.

1135
Multi-Selectmedium

A company is using Amazon CloudWatch Logs to store application logs. The DevOps team wants to set up real-time monitoring for specific error patterns and trigger remediation actions. Which TWO services can process the log events in real time and invoke an AWS Lambda function for remediation? (Choose two.)

Select 2 answers
A.Stream log events to Amazon Kinesis Data Streams and configure a Lambda function to process the stream.
B.Create a CloudWatch Logs subscription filter that delivers log events to a Lambda function.
C.Create an Amazon EventBridge rule that matches on CloudWatch Logs log group events.
D.Configure the log group to send log events to an Amazon SQS queue, and have the Lambda function poll the queue.
E.Publish log events to an Amazon SNS topic and subscribe the Lambda function.
AnswersA, B

Amazon CloudWatch Logs subscription filters can deliver log events in real time to a Kinesis data stream, which then uses a Lambda event source mapping to process each record. The stream acts as a durably buffered, highly scalable ingestion layer that decouples producers from consumers and preserves event ordering per shard. This is a fully supported path for real-time log processing and allows multiple Lambda functions or other consumers to read the same stream independently.

Why this answer

Options A and B are correct. CloudWatch Logs can stream log events in real time using subscription filters. These filters can deliver log events directly to a Lambda function (Option B) or to Amazon Kinesis Data Streams, which can then be processed by a Lambda function (Option A).

Option C is incorrect because Amazon EventBridge cannot directly subscribe to CloudWatch Logs log groups; it can receive events from other services but not process log streams in real time. Option D (SQS) introduces latency due to polling and is not designed for real-time streaming. Option E (SNS) is a push notification service and does not natively receive log events from CloudWatch Logs.

1136
MCQmedium

A company uses Amazon CloudWatch Logs to store application logs from multiple EC2 instances. The DevOps team needs to create a real-time dashboard that displays the count of ERROR-level log entries across all instances. Which combination of services should be used?

A.Amazon Athena and Amazon QuickSight
B.Amazon Kinesis Data Analytics and Amazon Elasticsearch Service
C.Amazon S3 and Amazon QuickSight
D.CloudWatch Logs Insights and CloudWatch Dashboards
AnswerD

CloudWatch Logs Insights runs SQL-like queries directly against live CloudWatch Logs data, allowing you to count matching log entries with a query such as 'stats count(*) by status' in real time. CloudWatch Dashboards can embed these query results as graph or numeric widgets, which automatically refresh (on up to a 60-second interval) to provide a live operational view. This is the native, serverless, and lowest-latency solution designed specifically for this use case.

Why this answer

CloudWatch Logs Insights allows real-time querying of CloudWatch Logs, and CloudWatch Dashboards can display the results as a real-time dashboard showing the count of ERROR-level log entries across all instances. Option A is incorrect because Amazon Athena is designed for querying data stored in S3, not real-time log streams. Option B is incorrect because while Kinesis Data Analytics and Elasticsearch Service could be used, they add unnecessary complexity and cost compared to the native CloudWatch integration.

Option C is incorrect because Amazon S3 and QuickSight are not suitable for real-time monitoring; QuickSight is for business intelligence and batch analytics.

1137
MCQhard

A company uses AWS CloudFormation with a template that creates an Amazon RDS DB instance. The password for the master user is stored in AWS Secrets Manager. The CloudFormation stack creation fails with the error: 'Value of property MasterUserPassword must be of type String'. How should the DevOps engineer resolve this issue?

A.Use the Fn::ImportValue intrinsic function to import the secret value.
B.Use the Ref intrinsic function to reference the secret.
C.Use the dynamic reference '{{resolve:secretsmanager:MySecret:SecretString:password}}' in the CloudFormation template.
D.Use the Fn::GetAtt intrinsic function to retrieve the secret value from Secrets Manager.
AnswerC

This is the correct approach: a dynamic reference of the form {{resolve:secretsmanager:MySecret:SecretString:password}} instructs CloudFormation to call the GetSecretValue API during stack creation and extract the field named 'password' from the SecretString of 'MySecret'. The resolved value is then substituted directly into the supported resource property, and it never appears as a literal in the template or the saved stack template. This is the official mechanism for injecting Secrets Manager values into CloudFormation templates without using a custom resource.

Why this answer

CloudFormation supports dynamic references, which allow you to retrieve secret values from AWS Secrets Manager at stack creation time using the syntax `{{resolve:secretsmanager:secret-id:secret-string:json-key}}`. This resolves the password as a plaintext string directly in the template, satisfying the `MasterUserPassword` property's requirement for a String type. Other intrinsic functions like `Ref` or `Fn::GetAtt` return ARNs or metadata, not the secret value itself, and cannot be used directly for this purpose.

Exam trap

The trap here is that candidates often confuse intrinsic functions like `Ref` or `Fn::GetAtt` with the ability to retrieve secret values, not realizing that only dynamic references (the `{{resolve:...}}` syntax) can directly inject a secret string into a resource property that expects a plaintext value.

How to eliminate wrong answers

Option A is wrong because `Fn::ImportValue` is used to import exported cross-stack output values, not to retrieve secret values from Secrets Manager. Option B is wrong because `Ref` on an AWS::SecretsManager::Secret resource returns the secret ARN, not the secret string value, so it cannot provide the password as a string. Option D is wrong because `Fn::GetAtt` on a Secrets Manager secret returns attributes like the ARN or the generated password metadata, but not the plaintext secret value, and it does not resolve to a string that can be used directly in the `MasterUserPassword` property.

1138
MCQeasy

Given the above IAM policy, which action is permitted?

A.Invoke the Lambda function MyFunction in us-east-1 account 123456789012
B.Read objects from an S3 bucket
C.Create a Lambda function
D.Start an EC2 instance
AnswerA

The IAM policy explicitly grants the lambda:InvokeFunction action with a Resource value set to arn:aws:lambda:us-east-1:123456789012:function:MyFunction. Since the specified ARN matches exactly the function being invoked, this action is permitted under the policy. No additional conditions or denied statements exist, so the caller can invoke this function synchronously or asynchronously.

Why this answer

The policy explicitly allows the lambda:InvokeFunction action on the specified function ARN. Option A is correct. It does not allow other Lambda actions (B), S3 actions (C), or EC2 actions (D).

1139
MCQhard

Refer to the exhibit. A CodeBuild project uses this buildspec. The build fails with the error: 'The runtime version specified is not supported in this environment.' What change should be made?

A.Add an install command to install Node.js 12 from source.
B.Remove the runtime-versions section and install Node.js manually.
C.Update the runtime-versions to nodejs: 14.
D.Change the build environment to use a custom image that includes Node.js 12.
AnswerC

Updating runtime-versions to nodejs:14 is the correct fix because the CodeBuild standard image likely no longer includes Node.js 12 after that version reached end-of-life or was deprecated from the managed environment. By specifying an actively supported runtime like Node.js 14, CodeBuild provisions the matching pre-installed runtime, eliminating the "run not available" error. This change is simple, declarative, and leverages CodeBuild's managed image updates without requiring manual installation or custom images.

Why this answer

The CodeBuild managed image for the specified environment (likely Ubuntu Standard 5.0 or similar) only supports Node.js runtime versions 14 and above. The error indicates that Node.js 12 is not available in the runtime-versions section of the buildspec for that environment. Updating to nodejs: 14 aligns with the supported runtime versions in the managed image, resolving the error without requiring custom images or manual installation.

Exam trap

The trap here is that candidates may assume they can install any Node.js version manually (Option A or B) without realizing that the runtime-versions section is validated against the managed image's pre-configured runtime manager, and the error is not about missing Node.js but about the version not being in the allowed list.

How to eliminate wrong answers

Option A is wrong because installing Node.js 12 from source via an install command would not override the runtime-versions section, and the build environment's runtime version validation occurs before the install phase, so the error would persist. Option B is wrong because removing the runtime-versions section and installing Node.js manually would still fail, as the build environment's default runtime (if any) might not match, and the error is triggered by the environment's lack of support for Node.js 12, not by the presence of the section. Option D is wrong because while using a custom image with Node.js 12 would work, it is an unnecessary and more complex solution compared to simply updating the runtime-versions to a supported version like nodejs: 14, which is the intended fix.

1140
Multi-Selectmedium

Which THREE steps should a DevOps engineer take to troubleshoot an EC2 instance that cannot be reached via SSH? (Choose three.)

Select 3 answers
A.Check the network ACL inbound rules for the subnet.
B.Verify that the corporate firewall allows SSH to the instance.
C.Create an AMI from the instance and launch a new one.
D.Check the security group inbound rules for port 22.
E.Verify that the instance has a public IP address.
AnswersA, D, E

Network ACLs are stateless, subnet-level filters that apply to all traffic crossing the subnet boundary. Even if a security group allows inbound SSH, a deny rule in the NACL inbound table for port 22 will silently drop the connection before it reaches the instance, so inspecting the subnet's inbound NACL rules is an essential first troubleshooting step.

Why this answer

Network ACLs (NACLs) are stateless firewall rules applied at the subnet level. If the inbound rule for ephemeral ports or port 22 is not explicitly allowed, SSH traffic will be dropped even if the security group permits it. Checking NACL inbound rules is a fundamental step in troubleshooting connectivity issues.

Exam trap

The trap here is that candidates often overlook network ACLs and focus only on security groups, or they mistake a recovery action (creating an AMI) for a troubleshooting step, when the correct approach is to systematically verify the layered network controls (NACLs, security groups, and public IP assignment).

1141
MCQeasy

A DevOps engineer needs to securely store and automatically rotate database credentials for a MySQL RDS instance. The credentials should be accessible to a Lambda function without hardcoding them. Which AWS service should be used?

A.AWS Systems Manager Parameter Store
B.AWS Secrets Manager
C.AWS Key Management Service (KMS)
D.IAM roles for EC2
AnswerB

AWS Secrets Manager is purpose-built for storing, retrieving, and automatically rotating database credentials. It provides native integration with RDS, allowing you to configure automatic rotation on a schedule with a managed Lambda rotation function that updates credentials in both Secrets Manager and RDS. Fine-grained IAM policies can restrict access to specific secrets, and the service also supports cross-account access, making it the correct answer for securely storing and auto-rotating RDS credentials.

Why this answer

AWS Secrets Manager is the correct service because it allows you to store secrets, automatically rotate them for supported RDS databases, and retrieve them programmatically via the Lambda runtime using the Secrets Manager API. AWS Systems Manager Parameter Store can store secrets but does not natively support automatic rotation for RDS. AWS KMS is used for managing encryption keys, not storing secrets.

IAM roles for EC2 provide permissions to EC2 instances but cannot store credentials.

1142
MCQmedium

A team uses AWS CloudFormation to manage infrastructure. They have a stack that creates an Amazon RDS instance. During an update, the stack fails with 'CREATE_FAILED' for the DB instance resource, and the error message indicates 'The DB instance already exists.' What is the most likely cause?

A.An RDS instance with the same identifier already exists in the account and region.
B.The stack update is trying to replace the DB instance without a proper UpdateReplace policy.
C.The stack has a DeletionPolicy of Retain on the RDS instance.
D.The RDS instance has deletion protection enabled.
AnswerA

DB instance identifiers must be unique per region; if one exists, creation fails.

Why this answer

The error 'The DB instance already exists' indicates that CloudFormation is attempting to create a new RDS instance with a DB instance identifier that is already in use within the same AWS account and region. Since DB instance identifiers must be unique per account and region, the creation fails. This typically occurs when a stack update triggers a resource replacement (e.g., due to a property change that requires recreation) and the old instance was not deleted or its identifier is still reserved.

Exam trap

The trap here is that candidates often confuse 'DeletionPolicy' or 'deletion protection' with the root cause, but the error is specifically about a duplicate identifier during creation, not about deletion or retention policies.

How to eliminate wrong answers

Option B is wrong because CloudFormation does not have an 'UpdateReplace policy'; instead, it uses replacement behaviors based on the resource's 'RequiresRecreation' property, and the error here is about a duplicate identifier, not a missing policy. Option C is wrong because a 'DeletionPolicy' of 'Retain' would cause the old RDS instance to persist after stack deletion, but during an update replacement, CloudFormation creates the new instance before deleting the old one, leading to a duplicate identifier conflict — however, the error message specifically says 'already exists,' which is the direct cause, not the DeletionPolicy itself. Option D is wrong because deletion protection prevents the instance from being deleted via the AWS API, but it does not prevent CloudFormation from attempting to create a new instance with the same identifier; the error is about creation, not deletion.

1143
Multi-Selecteasy

A DevOps team needs to implement a solution to automatically remediate an S3 bucket that becomes publicly accessible. Which TWO services should they use together?

Select 2 answers
A.AWS CloudTrail
B.AWS Config
C.AWS Lambda
D.AWS Systems Manager Automation
E.Amazon GuardDuty
AnswersB, D

Config can evaluate bucket policies and trigger remediation.

Why this answer

AWS Config can monitor S3 bucket configurations using a managed rule such as s3-bucket-public-read-prohibited. When a violation is detected, Config can automatically invoke an AWS Systems Manager Automation document as a remediation action. Systems Manager Automation runs a pre-defined workflow (e.g., applying a bucket policy that blocks public access) to correct the issue.

This combination provides automated, event-driven remediation without manual intervention, making AWS Config and AWS Systems Manager Automation the correct pair.

Exam trap

AWS often tests the misconception that AWS Lambda is the primary service for custom remediation. However, AWS Config natively integrates with AWS Systems Manager Automation for automatic remediation of non-compliant resources, reducing the need for custom Lambda functions. Lambda is not listed as a correct answer in this scenario.

1144
MCQhard

A DevOps engineer is configuring a centralized logging solution using Amazon CloudWatch Logs. They need to ensure that logs from multiple AWS accounts are aggregated into a single CloudWatch Logs account. Which approach meets this requirement?

A.Use Amazon Kinesis Data Firehose in each account to stream logs to a central Amazon S3 bucket, then use Amazon Athena to query.
B.Create a subscription filter in each account that delivers log events to a CloudWatch Logs destination in the central account.
C.Set up a cross-account destination using an Amazon Kinesis Data Streams stream in the central account and configure each account to send logs to that stream.
D.Configure each application to use the PutLogEvents API to send logs directly to the central account's log group.
AnswerB

Cross-account subscription filters allow real-time log aggregation from multiple accounts to a central account.

Why this answer

CloudWatch Logs supports cross-account subscription filters that can deliver log events to a CloudWatch Logs destination in a central account. The destination is a logical resource that points to a Kinesis Data Stream or Lambda function in the central account, and the source account creates a subscription filter that sends matching log events to that destination. This allows centralized aggregation without requiring each account to manage separate streaming infrastructure.

Exam trap

The trap here is that candidates confuse the CloudWatch Logs destination (which is a cross-account subscription mechanism) with directly writing to a Kinesis stream or using PutLogEvents across accounts, both of which are not supported for cross-account log aggregation.

How to eliminate wrong answers

Option A is wrong because Amazon Kinesis Data Firehose cannot directly stream logs from CloudWatch Logs in multiple accounts to a central S3 bucket without additional cross-account permissions and intermediate services; it also introduces unnecessary complexity and latency for real-time log aggregation. Option C is wrong because while a cross-account Kinesis Data Streams destination can be used, the correct implementation requires creating a CloudWatch Logs destination in the central account that points to the Kinesis stream, not configuring each account to send logs directly to the stream via PutRecord. Option D is wrong because the PutLogEvents API requires the log group and log stream to exist in the same account as the API call; cross-account PutLogEvents is not supported, and applications cannot send logs directly to a central account's log group.

1145
Matchingmedium

Match each AWS service health or performance concept to its meaning.

Drag a concept onto its matching description — or click a concept then click the description.

Concepts
Matches

Maximum limits on resources per account

Shows events and changes affecting your AWS resources

Monitors a metric and performs actions based on thresholds

Provides recommendations for cost, performance, security, and fault tolerance

Recommends optimal AWS compute resources for workloads

Why these pairings

The correct matches are: Amazon CloudWatch monitors resources in real-time; AWS Trusted Advisor optimizes cost, security, and performance; AWS Health Dashboard provides personalized health alerts. Common confusions involve swapping monitoring (CloudWatch) with auditing (CloudTrail) and recommendations (Trusted Advisor) with monitoring.

1146
Multi-Selecthard

Which THREE of the following are valid methods to enforce encryption at rest for Amazon EBS volumes? (Choose three.)

Select 3 answers
A.Enable EBS encryption by default in the account.
B.Use the AWS CLI to encrypt an existing volume in place.
C.Encrypt the volume when creating it through the AWS Management Console.
D.Attach the volume to an EC2 instance and use OS-level encryption.
E.Create an unencrypted snapshot of the volume, copy it with encryption, and create a new volume from the encrypted snapshot.
AnswersA, C, E

Enabling EBS encryption by default at the account level is a valid method because it automatically encrypts all new EBS volumes created in the account, using either the AWS managed key or a customer-managed KMS key. This setting is region-scoped and applies to volumes created from unencrypted snapshots when the snapshot is copied with encryption, but it does not retroactively encrypt existing unencrypted volumes. It is a control-plane safeguard that ensures any volume provisioned after enabling the setting is encrypted at rest without requiring per-volume configuration.

Why this answer

Enabling EBS encryption by default at the account level ensures all new volumes are encrypted. You can also encrypt volumes when creating them via the console or CLI. You cannot encrypt an existing volume directly; you must create a snapshot, copy it with encryption, and create a new volume.

Attaching a volume does not encrypt it.

1147
MCQeasy

A DevOps engineer needs to set up an alert for when the CPU utilization of an EC2 instance exceeds 90% for 5 consecutive minutes. Which CloudWatch features should be used?

A.CloudWatch Logs with a metric filter on CPU utilization logs.
B.CloudTrail to monitor EC2 instance CPU usage.
C.CloudWatch alarm on the CPUUtilization metric with a period of 5 minutes and threshold of 90.
D.Amazon S3 server access logs to check CPU utilization.
AnswerC

CloudWatch alarms are the native way to react to metric changes: the CPUUtilization metric for EC2 is published every 5 minutes with basic monitoring, so setting a period of 5 minutes ensures the alarm evaluates the average CPU utilization over each interval. A threshold of 90 means the alarm state becomes ALARM when the CPU utilization statistic exceeds 90%, and you can attach an action such as an SNS notification or Auto Scaling policy. This leverages a built-in metric with a well-established alarm evaluation model, making it the correct and simplest approach.

Why this answer

CloudWatch alarms can be configured on the `CPUUtilization` metric (a standard EC2 metric emitted every 5 minutes by default) with a threshold of 90 and an evaluation period of 1 (since the period is set to 5 minutes, one evaluation period covers the 5 consecutive minutes). This directly meets the requirement without additional setup.

Exam trap

The trap here is that candidates may confuse CloudWatch Logs metric filters (used for custom log-based metrics) with native EC2 metrics, or mistakenly think CloudTrail or S3 logs can monitor system performance, when only CloudWatch alarms on the `CPUUtilization` metric directly satisfy the requirement.

How to eliminate wrong answers

Option A is wrong because CloudWatch Logs with a metric filter requires EC2 instances to send CPU utilization data to CloudWatch Logs via a custom agent or script, which is unnecessary since the `CPUUtilization` metric is already available natively. Option B is wrong because CloudTrail records API calls and management events, not system-level metrics like CPU usage; it cannot monitor CPU utilization. Option D is wrong because Amazon S3 server access logs track requests made to S3 buckets, not EC2 instance performance metrics.

1148
MCQeasy

A DevOps engineer is tasked with ensuring that all Amazon S3 buckets in the account have server access logging enabled. The engineer needs to be automatically notified when a new bucket is created without logging enabled. Which AWS service should they use?

A.Use AWS CloudTrail to detect CreateBucket API calls and trigger a Lambda function to check logging.
B.Use AWS Trusted Advisor to check S3 bucket logging and send notifications via Amazon SNS.
C.Use Amazon S3 Event Notifications to trigger a Lambda function when a new bucket is created.
D.Use AWS Config with a managed rule to check if S3 bucket logging is enabled, and configure an SNS topic for notifications.
AnswerD

AWS Config continuously records configuration changes and evaluates them with managed rules, including s3-bucket-logging-enabled, which verifies server access logging is turned on for each bucket. When a bucket is created or its logging configuration changes, AWS Config re-evaluates in near real time and can publish compliance results to an SNS topic, triggering notifications. This provides a fully managed, automated, and near-real-time compliance check, making it the appropriate solution.

Why this answer

AWS Config provides continuous monitoring and evaluation of your AWS resource configurations. By using the managed rule 's3-bucket-server-access-logging-enabled', AWS Config can automatically check all S3 buckets (including newly created ones) for server access logging. When a bucket is non-compliant, AWS Config can trigger an SNS notification to alert the DevOps engineer, meeting the requirement for automatic notification without custom code.

Exam trap

The trap here is that candidates often confuse event-driven services like CloudTrail or S3 Event Notifications with configuration compliance services, mistakenly thinking they can directly detect and react to resource misconfigurations without the need for custom evaluation logic.

How to eliminate wrong answers

Option A is wrong because AWS CloudTrail records API calls but does not evaluate resource configurations; triggering a Lambda function from CloudTrail would require custom code to parse the event and check logging, which is not the most efficient or managed solution. Option B is wrong because AWS Trusted Advisor checks S3 bucket logging only for buckets in the 'S3 Bucket Logging' check, but it does not provide real-time notifications for new bucket creation; it runs periodic checks and requires manual setup or custom automation for alerts. Option C is wrong because Amazon S3 Event Notifications cannot be configured on a bucket that does not exist yet; you cannot set up event notifications for 'new bucket creation' events, as S3 Event Notifications are per-bucket and only support events like object creation or deletion within an existing bucket.

1149
MCQmedium

A team is using AWS CloudFormation to manage infrastructure. They want to implement a change management process where any modifications to the stack must be reviewed and approved. Which feature should they use?

A.Change Sets
B.StackSets
C.Drift Detection
D.Stack Policy
AnswerA

Change Sets let you preview the exact changes CloudFormation will make to a stack before executing them. When you create a change set, CloudFormation compiles a list of actions (add/remove/modify resources) that you can review in JSON or summary form, and you can approve, edit, or delete it without touching live infrastructure. This makes them the ideal mechanism for an approval-based change workflow, because the set can be submitted to a reviewer who validates it before the stack update is actually run.

Why this answer

Change Sets allow you to preview how proposed changes to a CloudFormation stack will impact your running resources before you execute them. This enables a review-and-approve workflow because you can generate a change set, have a team member or automated process inspect the list of resource additions, modifications, or deletions, and then either execute or discard the change set. This directly supports the required change management process.

Exam trap

The trap here is that candidates confuse Stack Policies (which protect resources from accidental updates) with a change review mechanism, but Stack Policies do not provide a preview or approval step—they only block certain updates at execution time.

How to eliminate wrong answers

Option B is wrong because StackSets are used to deploy CloudFormation stacks across multiple accounts and regions, not to review or approve changes to a single stack. Option C is wrong because Drift Detection identifies whether a stack's actual resources have diverged from its template, but it does not provide a mechanism to preview or approve proposed modifications. Option D is wrong because a Stack Policy is a resource-level permission document that prevents accidental updates or deletions of specific stack resources, but it does not generate a preview of changes or enforce a review-and-approve workflow.

1150
MCQhard

Refer to the exhibit. A DevOps engineer runs the describe-target-health command and receives the output shown. The ALB target group has two instances. One instance is healthy, and the other is unhealthy with a 502 error. What is the most likely cause of the 502 error?

A.The security group for the instance does not allow inbound traffic on port 80 from the ALB.
B.The application running on the instance is not responding correctly or has crashed.
C.The instance's route table does not have a route to the internet gateway.
D.The health check path is configured to return a 404 status code.
AnswerB

When the ALB forwards a request to a healthy EC2 instance, the target must send a complete, valid HTTP response within the configured timeout. If the application logic crashes, the process closes the socket, or the web server returns a malformed response, the ALB cannot construct a valid HTTP response for the client and surfaces as a 502 Bad Gateway. Thus, a faulty or crashed application is the direct underlying cause of a 502 error.

Why this answer

A 502 Bad Gateway error from an ALB indicates that the target (EC2 instance) is not responding correctly or has closed the connection prematurely. This is commonly caused by the application or web server on the instance crashing or being unable to handle the request. Option A is incorrect because security group issues typically lead to connection timeouts (504) or refused connections, not 502.

Option C is incorrect because a missing route to the internet gateway would cause network unreachability, resulting in a different error. Option D is incorrect because the health check path returning a 404 would cause the target to fail health checks, not return a 502 during actual traffic.

1151
MCQhard

A company runs a critical application on EC2 instances behind an Application Load Balancer (ALB). The application uses HTTPS. The security team wants to ensure that all traffic between the ALB and the instances is encrypted. The instances currently use a self-signed certificate for the backend HTTPS listener. The engineer notices that the ALB health checks are failing, and the error message indicates 'TLS handshake failed'. The health check is configured as HTTPS. What should the engineer do to resolve the health check failure while maintaining encryption?

A.Install a valid certificate from AWS Certificate Manager (ACM) on each EC2 instance and configure the ALB target group to use HTTPS with that certificate.
B.Change the health check to use HTTP on port 80 and allow HTTP traffic from the ALB to the instances.
C.Configure the ALB to ignore certificate verification for health checks by setting the health check protocol to HTTPS and enabling 'ignore certificate' option.
D.Disable health checks on the ALB and rely on CloudWatch alarms to detect instance failures.
AnswerB

Correct. Changing the health check to HTTP on port 80 eliminates the TLS handshake failure because the ALB will not attempt to establish a secure connection for health checks. The data traffic between ALB and instances can still be encrypted using HTTPS target group settings.

Why this answer

The ALB health check fails because the self-signed certificate on the instances is not trusted by the ALB. ACM certificates cannot be installed on EC2 instances, so option A is not feasible. The simplest solution is to change the health check protocol to HTTP (option B), which avoids the TLS handshake entirely.

This maintains encryption for the actual application traffic (HTTPS between ALB and instances) while allowing health checks to succeed. Option C is not a valid configuration; there is no 'ignore certificate' option for ALB health checks. Option D is not recommended as health checks provide essential monitoring.

1152
Multi-Selectmedium

A company is implementing a CI/CD pipeline for a microservices architecture on Amazon ECS. The pipeline must deploy to multiple environments (dev, test, prod) in sequence with manual approval gates between environments. Which two AWS services should be used together to meet these requirements? (Choose TWO.)

Select 2 answers
A.AWS CodePipeline
B.AWS CodeBuild
C.AWS CloudFormation
D.AWS CodeDeploy
E.AWS Elastic Beanstalk
AnswersA, D

AWS CodePipeline is the correct orchestrator for a CI/CD pipeline because it provides end-to-end workflow management, defining stages for source, build, test, deployment, and manual approval gates. It can trigger CodeBuild to build and push a container image, then use CodeDeploy or an ECS deploy action to update the ECS service, and even pause between environments (e.g., staging to production) for human sign-off. Its role is to coordinate the sequence and dependencies, not to execute the build or deployment itself, making it the central control plane for the pipeline.

Why this answer

AWS CodePipeline (A) is correct because it provides the orchestration framework to model the CI/CD pipeline with sequential stages for dev, test, and prod environments, including built-in support for manual approval gates between stages. AWS CodeDeploy (D) is correct because it integrates directly with CodePipeline to handle the actual deployment of containerized applications to Amazon ECS, supporting blue/green deployments and traffic shifting for microservices.

Exam trap

The trap here is that candidates often confuse AWS CodeDeploy with AWS CodeBuild or AWS CloudFormation, mistakenly thinking that a build or infrastructure tool can also handle the deployment sequencing and manual approval gates, when in fact CodePipeline is the only service that orchestrates the pipeline flow and CodeDeploy is the service that performs the actual ECS deployment.

1153
Multi-Selectmedium

A DevOps team is using AWS CodeBuild to run unit tests and package a Java application. They want to cache the Maven local repository (~/.m2) between builds to improve build times. Which TWO steps are necessary to enable caching in CodeBuild? (Select TWO.)

Select 2 answers
A.Set the MAVEN_OPTS environment variable to use a custom repository path.
B.Configure the buildspec to upload the Maven repository as a build artifact.
C.Enable 'Local cache' mode in the CodeBuild project.
D.Add a 'cache' section in the buildspec file specifying the paths to cache.
E.Create an S3 bucket to store the cache.
AnswersD, E

Adding a 'cache' section to the buildspec is the correct way to declare which paths CodeBuild should cache. You specify relative or absolute paths, such as /root/.m2, and CodeBuild saves the contents to a configurable S3 cache bucket after the build. On subsequent builds, CodeBuild restores those paths before the build starts, so dependency resolution skips re-downloading artifacts. This is the official mechanism for Maven dependency caching in CodeBuild.

Why this answer

To enable caching for the Maven local repository in AWS CodeBuild, two steps are required: (1) Add a `cache` section in the buildspec file specifying the paths to cache (e.g., ~/.m2) — this is option D. (2) Create an S3 bucket to store the cache and configure the CodeBuild project to use that bucket for caching — this is option E. Option A (setting MAVEN_OPTS) is not necessary because the default Maven repository path is already ~/.m2. Option B (uploading as a build artifact) is for saving output artifacts, not for caching.

Option C ('Local cache' mode) is a different feature used for Docker layer caching, not for Maven dependencies. Therefore, options D and E are correct.

1154
MCQhard

A company has a requirement to store audit logs for 7 years. The logs are currently stored in Amazon S3 and are accessed infrequently. Which storage class provides the lowest cost while meeting the retention requirement?

A.S3 Intelligent-Tiering
B.S3 Standard
C.S3 Glacier Deep Archive
D.S3 One Zone-Infrequent Access
AnswerC

S3 Glacier Deep Archive is the lowest-cost storage class in S3, priced at approximately $0.00099 per GB-month, specifically designed for long-term retention of data expected to be accessed at most once per year. With a standard retrieval time of 12-48 hours, it is well suited for compliance archives like audit logs that must be retained for 7 years but rarely accessed. The 180-day minimum storage duration is irrelevant when the retention period is 84 months, and the storage cost is a fraction of even S3 Glacier Flexible Retrieval.

Why this answer

S3 Glacier Deep Archive is the lowest-cost storage class for long-term retention of data that is accessed rarely. Option A (S3 Intelligent-Tiering) may move data but has monitoring costs. Option B (S3 Standard) is expensive for long-term.

Option D (S3 One Zone-IA) is not for long-term durability.

1155
MCQeasy

A company's DevOps team is designing a disaster recovery plan for a critical application. The application runs on EC2 instances with an RDS MySQL database. The Recovery Time Objective (RTO) is 15 minutes, and the Recovery Point Objective (RPO) is 1 hour. Which approach BEST meets these requirements?

A.Use backup and restore with daily snapshots stored in S3 and cross-Region replication.
B.Use a multi-Region application with Route 53 latency-based routing and RDS read replicas in the DR Region.
C.Use a warm standby strategy with a scaled-down copy of the production environment in the DR Region, and replicate data using RDS Multi-AZ with synchronous replication.
D.Use a pilot light strategy with EC2 instances stopped and RDS snapshots copied to the DR Region.
AnswerB

Cross-Region RDS read replicas provide asynchronous replication with an RPO of seconds to minutes, meeting the 1-hour RPO. Promoting a read replica and redirecting traffic via Route 53 can be done within minutes, meeting the 15-minute RTO. This is a valid warm standby configuration.

Why this answer

The best approach for a multi-Region disaster recovery with RTO of 15 minutes and RPO of 1 hour. By deploying the application in multiple regions and using RDS cross-Region read replicas, data is asynchronously replicated with an RPO typically within seconds to minutes, well within 1 hour. In the event of a failure, the read replica can be promoted to a primary instance, and Route 53 routing (preferably failover routing, but latency-based routing can also redirect traffic) can shift traffic to the DR region.

This failover can be completed within a few minutes, meeting the 15-minute RTO. Option A fails because daily snapshots exceed the 1-hour RPO and restore times exceed the RTO. Option C incorrectly relies on RDS Multi-AZ, which is a single-region high-availability feature and does not provide cross-region replication; thus it cannot serve as a disaster recovery solution across regions.

Option D, pilot light with snapshots, has a longer RTO as it requires restoring instances from snapshots and starting them, likely exceeding 15 minutes.

Exam trap

A common trap is to assume that RDS Multi-AZ provides cross-region replication; however Multi-AZ is a high-availability feature within a single region. For cross-region disaster recovery, asynchronous cross-Region read replicas or other cross-region replication methods are required. A warm standby architecture can be combined with cross-region replication, but the key is the replication mechanism, not Multi-AZ.

How to eliminate wrong answers

Option A is wrong because daily snapshots with cross-Region replication result in an RPO of up to 24 hours, far exceeding the 1-hour requirement, and the restore process takes longer than 15 minutes. Option B is wrong because Route 53 latency-based routing is for active-active traffic distribution, not disaster recovery failover, and RDS read replicas are asynchronous, leading to potential data loss and RPO that can exceed 1 hour during a failure. Option D is wrong because a pilot light strategy with stopped EC2 instances and RDS snapshots copied to the DR Region requires provisioning and restoring from snapshots, which typically takes longer than 15 minutes to become fully operational, and the RPO is limited by snapshot frequency.

1156
MCQmedium

A DevOps team uses AWS CloudFormation to deploy a web application. They want to receive notifications when a stack update fails. Which combination of services should they use?

A.Use AWS Config rules to monitor stack status and trigger an SNS notification.
B.Create a CloudWatch alarm on the CloudFormation stack event metric 'UPDATE_FAILED' and configure an SNS topic to send email notifications.
C.Use Amazon EventBridge to capture CloudFormation events and invoke an AWS Lambda function that sends an email.
D.Enable S3 event notifications on the CloudFormation template bucket and subscribe an SNS topic.
AnswerC

Amazon EventBridge is the correct service because CloudFormation publishes stack and resource status-change events to the default event bus, including events such as UPDATE_FAILED and ROLLBACK_IN_PROGRESS. You can define an event pattern that matches the stack name and desired status, then route matched events to a Lambda function or directly to an SNS topic for email delivery. This provides near-real-time, filterable notifications without polling or custom SDK integrations.

Why this answer

CloudFormation does not publish stack event metrics to CloudWatch Metrics. Instead, you can use Amazon EventBridge to capture CloudFormation events (such as stack update failures) and invoke an AWS Lambda function to send an SNS notification or email directly. Option B is incorrect because there is no 'UPDATE_FAILED' metric in CloudWatch for CloudFormation stacks.

Option A is incorrect: AWS Config rules evaluate resource compliance, not real-time stack events. Option D is incorrect: S3 event notifications on the template bucket only track object-level actions, not stack update failures.

1157
MCQmedium

A DevOps team is deploying a web application on EC2 instances behind an ALB. The application must authenticate users using an external identity provider (IdP) that supports SAML 2.0. Which solution provides the simplest integration with the ALB?

A.Use Amazon Cognito user pools with SAML federation and integrate with ALB
B.Use AWS CloudFront with Lambda@Edge to validate SAML tokens
C.Install a SAML service provider library on each EC2 instance
D.Configure the ALB to use an SAML identity provider for authentication
AnswerD

Configuring the ALB to use an SAML identity provider lets the load balancer act as the relying party, terminating the SAML exchange at the edge of the AWS network. When an unauthenticated user requests a protected target group, the ALB redirects to the IdP, validates the returned assertion, sets an encrypted session cookie, and forwards the authenticated session details to the backend as HTTP headers. This makes authentication transparent to the EC2 instances, so no code changes are required and security is centralized at one access point.

Why this answer

The Application Load Balancer (ALB) natively supports SAML 2.0 identity provider (IdP) authentication. This allows the ALB to offload user authentication at the edge, validating SAML assertions directly and forwarding authenticated requests to the target EC2 instances without any application-level changes. This is the simplest integration as it requires no additional infrastructure or code on the EC2 instances.

Exam trap

The trap here is that candidates often overcomplicate the solution by assuming they need a separate identity service like Cognito or custom code, when the ALB itself can directly integrate with any SAML 2.0 IdP, making it the simplest and most AWS-native choice.

How to eliminate wrong answers

Option A is wrong because Amazon Cognito user pools with SAML federation require additional configuration and management of a Cognito user pool, adding unnecessary complexity when the ALB can directly authenticate against the external SAML IdP. Option B is wrong because AWS CloudFront with Lambda@Edge to validate SAML tokens is overly complex and not designed for SAML token validation; Lambda@Edge is better suited for lightweight request/response transformations, not full SAML assertion parsing and validation. Option C is wrong because installing a SAML service provider library on each EC2 instance requires application-level changes, certificate management, and session handling, which is more complex and less scalable than using the ALB's built-in SAML authentication.

1158
MCQeasy

A developer is using AWS CodeCommit as a source repository for a CodePipeline. They want to automatically start the pipeline when changes are pushed to the main branch. What is the simplest way to achieve this?

A.Add a Lambda function that is invoked by CodeCommit triggers, which then starts the pipeline.
B.Configure the pipeline to poll the CodeCommit repository every 5 minutes.
C.Use a webhook from CodeCommit to the pipeline.
D.Create an Amazon EventBridge rule that triggers the pipeline on CodeCommit 'push to main' events.
AnswerD

EventBridge is the recommended method for triggering a CodePipeline on CodeCommit pushes. You create a rule with a source of aws.codecommit and an event pattern that matches the codecommit:ReferenceCreated or codecommit:ReferenceUpdated event, and then filter by the branch referenceName, for example "main". The rule targets the CodePipeline pipeline, and the pipeline starts nearly instantly after the push. This approach is fully managed, has no custom code, supports precise branch filtering, and is the AWS-prescribed best practice for CodeCommit source actions.

Why this answer

Amazon EventBridge can natively capture CodeCommit repository events, such as 'push to main', and directly trigger a CodePipeline execution without any custom code or polling. This is the simplest and most serverless approach, as it requires no additional infrastructure or manual configuration of webhooks.

Exam trap

The trap here is that candidates may confuse CodeCommit with third-party Git repositories and assume a webhook is required, but CodeCommit integrates natively with EventBridge, not webhooks, making option C a common distractor.

How to eliminate wrong answers

Option A is wrong because adding a Lambda function introduces unnecessary complexity and cost; CodeCommit triggers invoke Lambda for custom actions, but EventBridge provides a built-in, simpler integration to start pipelines. Option B is wrong because polling every 5 minutes introduces latency (up to 5 minutes delay) and is inefficient compared to event-driven triggers; CodePipeline supports event-based triggers via EventBridge or webhooks. Option C is wrong because CodeCommit does not support webhooks for pipeline triggers; webhooks are used with third-party sources like GitHub or Bitbucket, not with CodeCommit, which relies on EventBridge or CloudWatch Events.

1159
MCQhard

A company is using Amazon CloudWatch Logs to store application logs. The DevOps engineer needs to ensure that log data is encrypted at rest using a customer-managed KMS key. What step must be taken?

A.Use AWS CloudTrail to encrypt the log data before it is sent to CloudWatch Logs.
B.Create a KMS key and apply it to the IAM role used by the application.
C.Create a new KMS customer-managed key and associate it with the CloudWatch Logs log group.
D.Enable server-side encryption on the log group using the default CloudWatch Logs key.
AnswerC

This is the correct solution because CloudWatch Logs supports server-side encryption using a customer-managed KMS key that you can associate directly with the log group. When you create a log group or call the AssociateKmsKey API, you supply the key ARN, and CloudWatch Logs uses that key to encrypt all new incoming log events. This gives you full control over key rotation, access auditing, and lifecycle management, which is exactly what a requirement for customer-managed encryption requires. Note that the key must exist in the same AWS Region as the log group and its key policy must grant CloudWatch Logs permission to generate a data key for encryption.

Why this answer

CloudWatch Logs supports encryption at rest using a customer-managed KMS key, which must be explicitly associated with the log group. When you create or update a log group, you can specify a KMS key ID (via the AWS CLI, SDK, or console) to encrypt all log data stored in that group. This ensures that the log data is encrypted using a key you control, not the default AWS-managed key.

Exam trap

The trap here is that candidates often confuse associating a KMS key with an IAM role (which controls access) with associating it directly with the log group (which controls encryption at rest), leading them to select Option B instead of C.

How to eliminate wrong answers

Option A is wrong because AWS CloudTrail is an auditing service that records API calls, not an encryption mechanism; it cannot encrypt log data before it is sent to CloudWatch Logs. Option B is wrong because applying a KMS key to an IAM role does not encrypt log data at rest; the key must be associated directly with the CloudWatch Logs log group, not with an IAM role. Option D is wrong because enabling server-side encryption with the default CloudWatch Logs key uses an AWS-managed key, not a customer-managed KMS key, which does not meet the requirement for a customer-managed key.

1160
Multi-Selectmedium

A company is using AWS KMS to encrypt data in Amazon S3. The security team wants to ensure that the KMS key can only be used from within the company's VPC. What should be done? (Choose TWO.)

Select 2 answers
A.Attach a security group to the KMS key.
B.Modify the KMS key policy to include a condition that requires the kms:ViaService to be from the VPC endpoint.
C.Configure the S3 bucket policy to allow only requests from the VPC.
D.Create a service control policy (SCP) that denies KMS operations from outside the VPC.
E.Create a VPC endpoint for AWS KMS.
AnswersB, E

This condition restricts use of the key to requests coming through the VPC endpoint.

Why this answer

Options B and E are correct. To restrict KMS key usage to within the VPC, you first create a VPC endpoint for AWS KMS (Option E) to allow private connectivity. Then, you modify the KMS key policy to include a condition that requires the request to originate from that VPC endpoint, using the kms:ViaService condition key (Option B).

Option A is wrong because security groups do not apply to KMS keys; they are used for EC2 instances and network interfaces. Option C is wrong because S3 bucket policies cannot restrict which KMS key is used for encryption; they can only restrict S3 actions. Option D is wrong because service control policies (SCPs) apply at the organizational level and cannot restrict KMS key usage to a specific VPC; key policies are the correct mechanism.

1161
MCQeasy

Refer to the exhibit. A DevOps engineer applies the IAM policy shown to an S3 bucket to enforce server-side encryption. However, users report that some uploads succeed without encryption. What is the most likely reason?

A.The policy uses StringEquals instead of StringNotEquals.
B.The policy only allows the action but does not deny actions that do not meet the condition.
C.The resource ARN is incorrect; it should be the bucket ARN.
D.The action should be s3:PutEncryptedObject instead of s3:PutObject.
AnswerB

This is the core problem: IAM is default-deny, so this Allow statement only grants the upload when the condition is met; it does nothing to block uploads that fail the condition if another policy grants them. To enforce encryption, you must include an explicit Deny for s3:PutObject without the required encryption condition, because Deny always overrides Allow. Merely adding a condition to an Allow does not constrain other permissions.

Why this answer

The IAM policy only allows the s3:PutObject action when the encryption condition is met, but it does not include an explicit Deny statement to block uploads that do not satisfy the condition. In IAM, an Allow statement with a condition does not automatically deny requests that fail the condition; it simply does not apply the Allow. If there is another policy (e.g., a bucket policy or an identity-based policy) that grants s3:PutObject without the encryption condition, or if the default S3 behavior permits unencrypted uploads (since S3 does not require encryption by default), then unencrypted uploads can still succeed.

To enforce encryption, you must add a Deny statement with a condition like `StringNotEquals` on `s3:x-amz-server-side-encryption` to explicitly reject requests that lack the required encryption header.

Exam trap

The trap here is that candidates assume an Allow statement with a condition implicitly denies requests that don't meet the condition, but AWS IAM requires an explicit Deny to block non-compliant requests, and the absence of that Deny is the root cause of the enforcement failure.

How to eliminate wrong answers

Option A is wrong because using StringEquals is correct for allowing only requests with the specified encryption value; the issue is not the operator but the lack of a Deny statement. Option C is wrong because the resource ARN in the policy is correct for the bucket itself (e.g., `arn:aws:s3:::bucket-name`), and the action s3:PutObject applies to objects, but the policy's Resource field can be the bucket ARN or the bucket ARN with a wildcard for objects; the given ARN is not the root cause of the failure to enforce encryption. Option D is wrong because there is no such action as s3:PutEncryptedObject in AWS S3; encryption is controlled via request headers and conditions, not a separate API action.

1162
Multi-Selecthard

Which THREE strategies can improve the resilience of an Amazon RDS for PostgreSQL database?

Select 3 answers
A.Disable automated backups to save costs
B.Enable automated backups with a retention period
C.Create read replicas in another Availability Zone
D.Use a single-AZ instance to reduce complexity
E.Enable Multi-AZ deployment
AnswersB, C, E

Enabling automated backups with a configured retention period allows Amazon RDS to continuously capture transaction logs and perform daily snapshots, enabling you to restore to any point in time within the retention window (e.g., the last 35 days). This provides a granular RPO, sometimes as low as seconds, because the recovery process replays transaction logs up to the desired timestamp. Backup files are stored in Amazon S3 with redundancy, and the time to recover (RTO) is typically minutes, making this a fundamental resilience strategy against logical errors and regional data loss.

Why this answer

Multi-AZ deployment (E) provides automatic failover to a standby instance in a different Availability Zone, enhancing availability. Automated backups with a retention period (B) enable point-in-time recovery, reducing data loss. Read replicas in another Availability Zone (C) offload read traffic and can be promoted to a standalone instance during a disaster.

Option A is wrong because disabling backups removes recovery capability, sacrificing resilience. Option D is wrong because a single-AZ instance has no failover and is less resilient.

1163
MCQhard

A company uses AWS CloudFormation to create a stack with a Lambda function that uses a VPC. The stack creation fails with 'CREATE_FAILED: The provided execution role does not have permissions to call ec2:CreateNetworkInterface on the resource'. What is the likely cause?

A.The VPC does not have a subnet with internet access.
B.The CloudFormation template does not specify a security group.
C.The Lambda function code has a syntax error.
D.The Lambda execution role is missing the ec2:CreateNetworkInterface permission.
AnswerD

When a Lambda function is configured with VPC settings, the AWS Lambda service must create an elastic network interface (ENI) in each subnet on the function's behalf, which requires the execution role to have the `ec2:CreateNetworkInterface` permission. Without this permission, CloudFormation receives an 'Ec2.CreateNetworkInterface is not authorized' error and fails the stack creation, because the function resource cannot be provisioned. The role also needs `ec2:DescribeNetworkInterfaces` and `ec2:DeleteNetworkInterface` for cleanup, but the missing `CreateNetworkInterface` action is the direct blocker.

Why this answer

When a Lambda function is configured to run inside a VPC, it requires the `ec2:CreateNetworkInterface` permission to create an Elastic Network Interface (ENI) in the VPC subnets. The error message explicitly states that the execution role lacks this permission, which is a required IAM action for VPC-enabled Lambda functions. Without this permission, CloudFormation cannot provision the ENI, causing the stack creation to fail.

Exam trap

The trap here is that candidates may confuse network connectivity issues (like missing internet access or security groups) with IAM permission errors, but the error message explicitly names the missing permission, making D the only technically correct answer.

How to eliminate wrong answers

Option A is wrong because the error is about missing IAM permissions, not about subnet internet access; Lambda functions in a VPC do not need internet access unless they explicitly require it (e.g., via a NAT gateway). Option B is wrong because while a security group is required for VPC-enabled Lambda, the error message specifically points to a missing IAM permission, not a missing security group specification. Option C is wrong because a syntax error in the Lambda code would cause a different error (e.g., 'CREATE_FAILED: Invalid function code' or a runtime error), not a permission-related failure during stack creation.

1164
MCQeasy

A company uses AWS OpsWorks for configuration management. The operations team needs to apply a configuration change to all instances in a layer without downtime. Which approach should they use?

A.Use a custom Chef recipe and run it on the layer using OpsWorks 'Run Command'.
B.Use an Auto Scaling lifecycle hook to apply the change during instance launch.
C.Clone the layer and update the clone with the new configuration, then switch traffic.
D.SSH into each instance and manually apply the change.
AnswerA

Use a custom Chef recipe and run it on the layer using OpsWorks 'Run Command' is correct because OpsWorks Stacks can execute a recipe on any currently online instance without waiting for a lifecycle event. This converges the specified layer's existing instances to the updated configuration immediately, and Chef's idempotent execution ensures only necessary changes are applied. You can target a single instance, a whole layer, or use custom Chef JSON to pass parameters.

Why this answer

The correct approach is to use a custom Chef recipe and run it on the layer using OpsWorks 'Run Command'. This allows applying configuration changes to all instances in the layer without downtime, as OpsWorks executes the recipe on each instance without requiring instance recreation. Option B is incorrect because Auto Scaling lifecycle hooks are used to execute actions during instance launch or termination, not for runtime configuration updates.

Option C is incorrect because cloning a layer creates a new layer and does not apply changes to existing instances; switching traffic would involve additional steps and potential downtime. Option D is incorrect because manually SSHing into each instance is error-prone, not scalable, and violates best practices for configuration management.

1165
Multi-Selectmedium

A company uses AWS CloudTrail to log API activity. The security team wants to be alerted when an IAM user creates a new access key. Which TWO steps should be taken to accomplish this? (Choose TWO.)

Select 2 answers
A.Enable CloudTrail Insights to detect unusual activity in the account.
B.Configure the CloudWatch Events rule to send a notification to an Amazon SNS topic.
C.Create an Amazon CloudWatch Events rule that matches the CreateAccessKey API call via CloudTrail.
D.Create an AWS Config rule that checks for access key creation and sends an SNS notification.
E.Use CloudWatch Logs Insights to run a query on the CloudTrail logs and set an alarm.
AnswersB, C

Configuring a CloudWatch Events (now Amazon EventBridge) rule to send a notification to an Amazon SNS topic is a correct and recommended solution for this scenario. You define an event pattern that matches the CreateAccessKey event (source: iam.amazonaws.com, eventName: CreateAccessKey) and set the target to an SNS topic, which then delivers email, text, or other notifications to subscribers. This approach provides near-real-time, event-driven alerts directly from CloudTrail, with no dependence on polling or querying. It is the most direct way to satisfy the requirement of notifying the security team immediately when an access key is created.

Why this answer

Amazon CloudWatch Events (now Events) can be configured to match specific API calls logged by CloudTrail, such as CreateAccessKey. When the rule triggers, it can invoke an SNS topic to send an alert, enabling real-time notification. This approach directly monitors the API activity without additional overhead.

Exam trap

The trap here is that candidates often confuse AWS Config rules (which check resource compliance) with CloudWatch Events (which react to API calls), leading them to choose Option D instead of the correct event-driven approach.

1166
Multi-Selecteasy

A company is using AWS CodeBuild to build a Docker image and push it to Amazon ECR. The buildspec.yaml includes commands to build and tag the image. However, the push to ECR fails with an authentication error. Which TWO actions should the DevOps engineer take to resolve this?

Select 2 answers
A.Configure the ECR repository as public.
B.Add a command in the buildspec to run 'aws ecr get-login-password --region <region> | docker login --username AWS --password-stdin <account>.dkr.ecr.<region>.amazonaws.com'.
C.Create an ECR lifecycle policy to expire untagged images.
D.Ensure the CodeBuild service role has permissions for ecr:GetAuthorizationToken and ecr:Push.
E.Run 'docker login' with ECR credentials in the buildspec.
AnswersB, D

This command is the standard way to authenticate Docker to an ECR registry. It invokes the AWS CLI to call ecr:GetAuthorizationToken, which returns a base64-encoded password valid for 12 hours, and pipes it directly to docker login using the --password-stdin flag to avoid exposing the token in process listings. The username must be AWS and the registry URL must include the account ID and region. With proper IAM permissions, this makes the subsequent docker push/build step succeed.

Why this answer

The `aws ecr get-login-password` command retrieves a temporary authentication token from the ECR service, which is then piped to `docker login` to authenticate the Docker client against the private ECR registry. This is the standard AWS-recommended method for authenticating Docker to ECR in automated build environments like CodeBuild, as it avoids hardcoding long-lived credentials.

Exam trap

The trap here is that candidates may think simply running `docker login` with static credentials (Option E) is sufficient, but they overlook that ECR requires a dynamically generated token via `get-login-password`, and that the CodeBuild service role must have the correct IAM permissions (Option D) for the authentication flow to succeed.

1167
MCQeasy

A DevOps team is designing an incident response plan for a critical microservices architecture. They need to automatically collect and analyze logs from all services during an incident. Which solution should they use?

A.Stream logs to Amazon Kinesis Data Firehose and analyze with Amazon OpenSearch Service.
B.Store logs in Amazon S3 and use Amazon Athena to query them.
C.Use AWS Systems Manager Run Command to execute log collection scripts on each instance.
D.Centralize logs in Amazon CloudWatch Logs and use CloudWatch Logs Insights for real-time querying.
AnswerD

Amazon CloudWatch Logs centralizes log streams from EC2 instances, Lambda, and other AWS services via the CloudWatch agent, making logs available for query within seconds of ingestion. CloudWatch Logs Insights provides an interactive, purpose-built query engine that can search, filter, and aggregate log events across multiple log groups using a simple query language, without requiring external infrastructure. This combination supports fast, exploratory incident analysis, real-time alarming via metric filters, and full retention options—making it the most direct and operationally ready choice.

Why this answer

Amazon CloudWatch Logs provides a centralized log management service that integrates natively with AWS services. During an incident, CloudWatch Logs Insights enables real-time, ad-hoc querying and analysis of logs from all microservices without needing to set up additional infrastructure, making it the most efficient solution for incident response.

Exam trap

The trap here is that candidates often over-engineer the solution by choosing complex streaming or analytics services (like Kinesis or Athena) for real-time incident analysis, when the native CloudWatch Logs Insights service is designed specifically for this use case with minimal setup and lower latency.

How to eliminate wrong answers

Option A is wrong because Amazon Kinesis Data Firehose is a streaming data delivery service that requires additional configuration to buffer and deliver logs to Amazon OpenSearch Service, adding latency and complexity not ideal for real-time incident analysis. Option B is wrong because storing logs in Amazon S3 and querying with Athena is designed for batch analytics, not real-time querying, and incurs significant latency due to S3 eventual consistency and Athena's per-query overhead. Option C is wrong because AWS Systems Manager Run Command is a one-time or scheduled command execution tool, not a continuous log collection and analysis solution, and it requires manual intervention to trigger scripts during an incident, which violates the automated incident response requirement.

1168
Multi-Selecthard

A DevOps team is designing a solution to encrypt data at rest for an Amazon RDS for MySQL database. Which TWO actions should the team take? (Choose TWO.)

Select 2 answers
A.Enable encryption after creating the RDS instance by modifying the instance
B.Enable SSL/TLS for the RDS instance
C.Use AWS KMS to create a customer managed key and assign it to the RDS instance
D.Enable encryption at rest when creating the RDS DB instance
E.Store the database files in an encrypted S3 bucket
AnswersC, D

You can use AWS KMS to create a customer managed key and assign it to the RDS instance during creation to encrypt data at rest.

Why this answer

To encrypt data at rest for Amazon RDS for MySQL, encryption must be enabled when creating the DB instance (Option D) and a customer managed key from AWS KMS can be used (Option C). Option A is incorrect because you cannot enable encryption on an existing unencrypted RDS instance; it must be done at creation time. Option B is incorrect because SSL/TLS encrypts data in transit, not at rest.

Option E is incorrect because storing database files in an encrypted S3 bucket does not encrypt the RDS instance; RDS encryption is managed by AWS KMS and is enabled at the instance level.

1169
MCQmedium

A DevOps engineer is using AWS CodeDeploy to deploy an application to an Auto Scaling group. The deployment fails with the error: 'The overall deployment failed because too many individual instances failed deployment'. The engineer checks the logs and finds that the application installation script exits with a non-zero exit code. What should the engineer do to troubleshoot?

A.Configure CloudWatch Logs to capture the script output
B.Increase the deployment's MinHealthyHosts percentage
C.Re-upload the application revision to S3
D.SSH into one of the failed instances and run the install script manually to identify the error
AnswerD

SSHing into a failed instance and manually running the install script is the most direct way to diagnose the failure, because you can reproduce the exact command and see the script's stderr, exit code, missing dependencies, permission errors, or incorrect path assumptions. CodeDeploy lifecycle scripts run under the instance's configured user environment, so executing the same script from the deployment archive directory (for example, /opt/codedeploy-agent/deployment-root/<deployment-id>/.../deployment-archive) exposes the root cause and lets you test a fix locally. This is the standard first step in troubleshooting a failed lifecycle hook.

Why this answer

The deployment failure is caused by the application installation script exiting with a non-zero exit code, which indicates a specific error in the script or its environment. SSHing into a failed instance and running the install script manually allows the engineer to see the exact error output, debug the script logic, and identify missing dependencies or configuration issues directly on the target host.

Exam trap

The trap here is that candidates may assume increasing MinHealthyHosts or re-uploading the revision will fix the issue, when in fact the problem is a script-level error that requires direct investigation on a failed instance.

How to eliminate wrong answers

Option A is wrong because CloudWatch Logs can capture script output only if the script is configured to write to a log file and the CloudWatch agent is installed and configured on the instances; it does not retroactively capture the error from a failed deployment. Option B is wrong because increasing MinHealthyHosts percentage would raise the threshold for healthy instances, making the deployment more strict and likely to fail faster, not help troubleshoot the script error. Option C is wrong because re-uploading the application revision to S3 does not address the root cause of the script failure; the revision is already present on the instances, and the error is in the execution, not in the upload.

1170
MCQeasy

A DevOps engineer needs to aggregate logs from multiple AWS accounts into a central account for analysis. Which service should they use?

A.AWS CloudTrail with organization trails.
B.Amazon CloudWatch Logs with cross-account subscription filters.
C.AWS Config with aggregator.
D.Amazon S3 with cross-account bucket policies.
AnswerB

CloudWatch Logs cross-account subscription filters let each source account forward selected log groups to a Kinesis Data Stream or Kinesis Firehose in a central account, which then feeds a central CloudWatch Logs group, S3 bucket, or Lambda function. This provides near-real-time log routing without agents, using a destination policy and IAM roles to authorize cross-account delivery. It is the only listed option that delivers actual log content (not configuration/API events) in a streamed, queryable pipeline to a central location.

Why this answer

Amazon CloudWatch Logs supports cross-account log aggregation via subscription filters, which can forward logs to a central account using Kinesis Data Streams or Firehose. Option A is incorrect because AWS CloudTrail with organization trails only aggregates CloudTrail logs (API activity), not general application logs. Option C is incorrect because AWS Config aggregator collects configuration and compliance data, not log data.

Option D is incorrect because while S3 can store logs with cross-account policies, it does not provide the real-time streaming or subscription capabilities needed for log aggregation.

1171
Multi-Selecthard

A company uses AWS CodePipeline with a source stage from Amazon S3. The pipeline deploys a static website to an S3 bucket. The deployment must ensure that the website is always available and that rollbacks happen automatically if the deployment fails. Which TWO actions should the company take?

Select 2 answers
A.Use Amazon Route53 weighted routing to shift traffic
B.Use AWS CodeDeploy with an in-place deployment
C.Use a blue/green deployment strategy with two S3 buckets
D.Configure AWS CloudFormation stack with automatic rollback on failure
E.Enable S3 bucket versioning to keep multiple versions
AnswersC, D

A blue/green deployment strategy with two S3 buckets allows you to host both the current (blue) and new (green) versions of your application or static assets in separate buckets. You validate the green version in production, then switch routing (e.g., via Route 53 or CloudFront) from blue to green, ensuring zero downtime. If issues arise after the switch, changing the routing back to the blue bucket provides an immediate rollback.

Why this answer

A blue/green deployment strategy with two S3 buckets allows the company to maintain the current (blue) bucket serving the live website while deploying the new version to a separate (green) bucket. This ensures zero-downtime deployments and, if the deployment fails, traffic can simply remain pointed to the blue bucket, providing an automatic rollback without any manual intervention. Option D is correct because AWS CloudFormation can be configured with automatic rollback on failure, which will revert the stack to its last known good state if the deployment fails, ensuring the website remains available.

Exam trap

The trap here is that candidates often confuse S3 bucket versioning (Option E) with a deployment rollback strategy, but versioning only provides object-level version history and does not automate traffic switching or infrastructure rollback on failure.

1172
Multi-Selectmedium

A company is using AWS CodeBuild to run builds for a Java application. The build takes a long time because it downloads Maven dependencies every time. The team wants to speed up the build by caching dependencies. Which TWO actions should be taken? (Choose 2)

Select 2 answers
A.Enable Amazon S3 caching in the CodeBuild project and specify an S3 bucket to store the cache.
B.Use CodeBuild's 'build cache' feature without specifying a bucket; it will automatically cache to a default location.
C.Set the cache type to 'Local' in the CodeBuild project configuration.
D.Mount an Amazon EFS file system to the build container and configure Maven to use it as a local repository.
E.Configure the buildspec file to save the Maven local repository (.m2) to the cache path.
AnswersA, E

Enabling Amazon S3 caching in the CodeBuild project configuration lets you specify an S3 bucket (and optional prefix) that CodeBuild uses to store and retrieve build artifacts such as the Maven local repository. When S3 caching is turned on, CodeBuild automatically saves the directories declared in the buildspec's cache/paths section to that bucket and restores them at the start of subsequent builds, eliminating repeated dependency downloads and reducing build time. This is the recommended, fully managed caching approach for Java/Maven projects.

Why this answer

CodeBuild supports Amazon S3 caching, which allows you to store build artifacts (such as Maven dependencies) in a specified S3 bucket. By enabling this feature, subsequent builds can download the cached dependencies from S3 instead of re-downloading them from the internet, significantly reducing build time. Option E is correct because the buildspec file must explicitly define the cache path (e.g., /root/.m2) to tell CodeBuild which directory to cache; without this, CodeBuild does not know what to save or restore.

Exam trap

The trap here is that candidates often assume CodeBuild has a built-in local cache that works automatically without configuration, but in reality, you must explicitly define the cache path in the buildspec and choose between S3 or local caching (local caching is only available for certain build environments and still requires the buildspec path).

1173
MCQmedium

A security audit reveals that an S3 bucket contains objects that are not encrypted. The bucket is configured with default encryption using SSE-S3. What is the most likely reason that objects are unencrypted?

A.The objects were uploaded with server-side encryption using AWS KMS
B.The bucket policy denies SSE-S3 encryption
C.The objects were uploaded before default encryption was enabled
D.The objects were uploaded with SSE-C
AnswerC

S3 default encryption is a bucket-level setting that applies only to objects uploaded after the setting is enabled; it has no retroactive effect on objects that already exist. If the audit found unencrypted objects, the most plausible cause is that these objects were written before the bucket's default encryption was turned on, leaving them in their original, unencrypted state. Enabling default encryption at a later time does not trigger a re-encryption of existing data unless a separate process, such as S3 Batch Operations, is explicitly run.

Why this answer

Default encryption applies only to newly uploaded objects that do not have encryption settings. If objects were uploaded before default encryption was enabled, or if the PUT request explicitly specified no encryption, they may remain unencrypted. Option A is wrong because SSE-S3 does not require KMS.

Option B is wrong because default encryption applies to new objects. Option D is wrong because SSE-C is not relevant.

1174
Multi-Selecthard

Which TWO approaches can be used to automatically roll back a failed deployment in AWS CodeDeploy? (Choose two.)

Select 2 answers
A.Use a CloudWatch Events rule to trigger a rollback when a deployment fails
B.Attach an IAM policy to the CodeDeploy service role that allows rollback actions
C.Specify a rollback revision in the AppSpec file
D.Configure the deployment group to automatically roll back when a deployment fails
E.Configure the deployment group to automatically roll back when a CloudWatch alarm is triggered
AnswersD, E

Configuring the deployment group to automatically roll back when a deployment fails is a built-in CodeDeploy feature: you select this option in the deployment group's rollback configuration, and if the deployment fails (for example, due to a failed health check), CodeDeploy automatically redeploys the last successfully deployed revision. This is one of the two native automatic rollback triggers, and it requires no external services or custom code. It also logs the rollback as a new deployment event for auditability.

Why this answer

AWS CodeDeploy allows you to configure a deployment group to automatically roll back a deployment when it fails. This is a native feature that can be enabled in the deployment group settings, ensuring that if a deployment fails (e.g., due to health check failures or script errors), CodeDeploy automatically reverts to the last known good revision without manual intervention.

Exam trap

The trap here is that candidates often confuse CloudWatch Events rules with direct rollback triggers, but CloudWatch Events can only invoke actions like notifications or Lambda functions, not native CodeDeploy rollbacks, which require explicit configuration in the deployment group.

1175
MCQeasy

A company has an Amazon RDS for MySQL database that stores sensitive data. The security team requires encryption at rest and in transit. Which combination of options meets these requirements?

A.Use AWS Certificate Manager to issue a certificate for the RDS instance
B.Place the RDS instance in a private subnet and use VPC peering
C.Enable encryption at rest on the RDS instance and enforce SSL connections
D.Use AWS KMS to encrypt the database before inserting data and decrypt on read
AnswerC

Enabling RDS encryption at rest encrypts the underlying storage, automated backups, snapshots, and read replicas using AWS KMS AES-256 encryption, satisfying the data-at-rest requirement. Enforcing SSL connections (for example, by setting rds.force_ssl=1 or requiring ssl-mode in the client) encrypts data between the application and the database, covering data in transit. Note that enabling encryption at rest on an existing unencrypted MySQL instance requires restoring from an encrypted snapshot rather than modifying the instance in place, but together these controls fully address the stated security need.

Why this answer

Encryption at rest for Amazon RDS is enabled by turning on RDS encryption when creating the instance. Encryption in transit is achieved by enforcing SSL/TLS connections for client connections to the database. Option C correctly combines both: enabling RDS encryption for at-rest security and enforcing SSL for in-transit security.

Option A (AWS Certificate Manager) provides certificates but does not directly encrypt the RDS instance. Option B (private subnet with VPC peering) addresses network isolation, not encryption. Option D (client-side encryption with KMS) encrypts data before insertion but does not use RDS encryption and is not a standard RDS feature.

1176
Multi-Selectmedium

Which TWO actions can be taken to secure an Amazon S3 bucket that contains confidential data? (Choose TWO.)

Select 2 answers
A.Enable S3 Default Encryption.
B.Enable S3 Transfer Acceleration.
C.Enable S3 Cross-Region Replication.
D.Enable S3 Versioning.
E.Enable S3 Block Public Access.
AnswersA, E

S3 Default Encryption ensures that every object written to the bucket is automatically encrypted at rest, using either SSE-S3 (AES-256) or SSE-KMS (customer-managed KMS keys); SSE-C is not supported for default encryption. This protects the confidentiality of data at rest and helps satisfy compliance frameworks that mandate encryption. It is a direct security control for data confidentiality, but it does not control who can access the data.

Why this answer

Correct options: A and E. Option A: S3 Default Encryption ensures data is encrypted at rest automatically, a key security measure. Option E: S3 Block Public Access prevents public exposure of the bucket and its objects, a key security measure.

Option B (Transfer Acceleration) is for speed, not security. Option C (Cross-Region Replication) is for disaster recovery, not security. Option D (Versioning) helps with recovery from accidental deletions/overwrites, but does not directly secure data from unauthorized access.

1177
MCQmedium

An organization uses AWS Systems Manager to manage a fleet of EC2 instances. They want to ensure that all instances have a specific software package installed. Which approach should they take?

A.Use OpsCenter to create an OpsItem for each instance.
B.Use Run Command to execute the installation on all instances.
C.Create a Patch Baseline that includes the package.
D.Create a State Manager association with a custom document that installs the package.
AnswerD

State Manager enforces configuration state.

Why this answer

State Manager associations can enforce desired configurations, such as installing software packages, on a schedule or continuously. Option B is wrong because Run Command is for one-time ad-hoc execution, not ongoing compliance. Option C is wrong because Patch Manager focuses on OS patches, not arbitrary software packages.

Option A is wrong because OpsCenter is for operational issues, not configuration management.

1178
MCQeasy

A DevOps team is using AWS CloudFormation to manage a multi-tier application. They want to ensure that when an update to the stack causes a resource replacement, the replacement occurs only after the new resource is fully created and tested. Which CloudFormation feature should they use?

A.UpdatePolicy attribute with AutoScalingRollingUpdate
B.CreationPolicy attribute
C.DeletionPolicy attribute set to Retain
D.DependsOn attribute to specify creation order
AnswerB

Incorrect. The `CreationPolicy` attribute does not have a `CreateBeforeDestroy` property. It is used to wait for a signal from the resource after creation, not to control the order of replacement during updates.

Why this answer

The CreationPolicy attribute can be added to a resource to ensure that CloudFormation waits for a specified number of success signals before considering the resource created. When a stack update causes a resource replacement, CloudFormation creates the new resource, waits for the creation signals (if a CreationPolicy is defined), and only then deletes the old resource. This ensures the new resource is fully operational and tested before replacement.

The other options are incorrect: UpdatePolicy with AutoScalingRollingUpdate is for updating instances in an Auto Scaling group without full replacement; DeletionPolicy Retain keeps the old resource but does not manage creation; DependsOn controls creation order but does not wait for testing signals.

Exam trap

Candidates often confuse the UpdatePolicy (used for rolling updates in Auto Scaling) with CreationPolicy (used to wait for resource creation signals). The trap is to think that only Auto Scaling resources can be tested during replacement; many resources support CreationPolicy for signal-based testing during replacement.

How to eliminate wrong answers

Option A is wrong because `UpdatePolicy` with `AutoScalingRollingUpdate` is specific to Auto Scaling groups and controls how instances are updated during rolling updates, not how resource replacements are sequenced for arbitrary resources. Option C is wrong because `DeletionPolicy` set to `Retain` only preserves a resource when the stack is deleted, not during an update replacement; it does not control creation order or testing. Option D is wrong because `DependsOn` only specifies the creation order of resources during initial stack creation, not the replacement behavior during updates; it cannot enforce that a new resource is created and tested before the old one is removed.

1179
MCQhard

A DevOps engineer is tasked with centralizing logs from multiple AWS accounts into a single Amazon OpenSearch Service domain. The engineer sets up Amazon Kinesis Data Firehose to deliver logs from each account to the OpenSearch domain. However, some accounts show failed deliveries in the Firehose console. Which configuration is MOST likely causing the failures?

A.The IAM role assumed by Firehose in each account does not have permissions to write to the cross-account OpenSearch domain
B.The source accounts do not have a CloudWatch Logs subscription filter to send logs to Firehose
C.The Kinesis Data Streams used as the Firehose source is not encrypted
D.The OpenSearch domain's access policy does not allow access from the S3 bucket used by Firehose
AnswerA

Firehose needs an IAM role with sts:AssumeRole and es:HttpPut permissions for the destination OpenSearch domain.

Why this answer

The most likely cause of failed deliveries is that the IAM role assumed by Kinesis Data Firehose in each source account lacks the necessary permissions to write to the cross-account Amazon OpenSearch Service domain. Firehose uses a service-linked or custom IAM role to perform actions such as `es:ESHttpPut` and `es:ESHttpPost` against the OpenSearch domain endpoint. Without explicit cross-account trust and resource-based policy allowing the Firehose role's ARN, the delivery will fail with an authorization error.

Exam trap

The trap here is that candidates often assume the failure is due to missing CloudWatch subscription filters or S3 bucket permissions, but the real issue is the missing cross-account IAM trust between the Firehose role and the OpenSearch domain's access policy.

How to eliminate wrong answers

Option B is wrong because CloudWatch Logs subscription filters are used to stream log data to Firehose, but the question states that logs are being delivered from multiple accounts; the failure is at the Firehose-to-OpenSearch stage, not at the ingestion stage. Option C is wrong because Kinesis Data Streams encryption (whether server-side or client-side) does not affect Firehose's ability to write to OpenSearch; Firehose can read encrypted streams as long as it has the proper KMS permissions. Option D is wrong because Firehose writes directly to the OpenSearch domain via HTTP/HTTPS, not through an S3 bucket; the OpenSearch domain's access policy must grant access to the Firehose IAM role or the source account's principal, not to an S3 bucket.

1180
MCQmedium

Refer to the exhibit. A security engineer finds this CloudTrail log entry. What is the most likely security concern?

A.The bucket is now publicly accessible
B.The bucket policy grants the root user full access
C.The root user performed an action that should have been done by an IAM user
D.The bucket policy allows only authenticated users to read objects
AnswerA

The CloudTrail event shows an s3:PutBucketPolicy call containing 'Principal': '*' and 'Effect': 'Allow' for 's3:GetObject'. That statement explicitly permits anonymous, unauthenticated access to all objects in the bucket. Since no condition restricts the requester and S3 object ownership permits the bucket owner to apply the policy, the bucket is now publicly accessible and every object is readable by anyone with the URL.

Why this answer

The CloudTrail log entry shows a PutBucketPolicy action that sets a bucket policy with principal '*', granting public read access to all objects in the bucket. This is a security concern because the bucket becomes publicly accessible, allowing anyone on the internet to read objects. Option A is correct because the bucket policy makes the bucket publicly accessible.

Option B is incorrect because the bucket policy does not grant the root user full access; it grants public access. Option C is incorrect because the action is performed by an IAM user (the user field shows 'arn:aws:iam::123456789012:user/admin'), not the root user. Option D is incorrect because the policy allows all principals (public) to read objects, not just authenticated users.

1181
Multi-Selecthard

A company is migrating a monolithic application to a microservices architecture on AWS. To improve resilience, which THREE design patterns should be implemented? (Select THREE.)

Select 3 answers
A.Synchronous communication between services to ensure consistency
B.Single shared database to maintain data consistency
C.Retry with exponential backoff for transient failures
D.Bulkhead pattern to isolate critical services from non-critical ones
E.Circuit breaker pattern to stop calls to a failing service
AnswersC, D, E

Retry with exponential backoff is a core resilience pattern that reattempts an operation after an exponentially increasing delay, typically with jitter to avoid synchronized retries, which prevents a thundering herd. It specifically targets transient failures, such as network timeouts, database connection drops, or throttling (e.g., API Gateway 429s or DynamoDB throttling), where the operation may succeed on a subsequent attempt if the original failure was short-lived. This pattern preserves system stability by giving the dependency time to recover and reducing continuous load, and it is widely supported in AWS SDKs and infrastructure.

Why this answer

Implementing retry with exponential backoff allows services to handle transient failures (e.g., network timeouts, throttling) by automatically retrying operations after increasing delays, reducing load on recovering systems. This pattern is essential for microservices on AWS, where services like DynamoDB or Lambda may throttle requests, and exponential backoff (e.g., using jitter as per AWS SDK defaults) prevents cascading failures.

Exam trap

The trap here is that candidates confuse synchronous communication (Option A) with resilience, but in microservices, synchronous calls increase failure propagation, while asynchronous patterns and the three selected patterns (retry, circuit breaker, bulkhead) are the correct resilience mechanisms.

1182
Multi-Selecthard

A company uses AWS Organizations to manage multiple accounts. The DevOps team needs to monitor for any IAM user creation across all accounts in the organization. Which THREE steps should be taken to implement this centralized monitoring?

Select 3 answers
A.Create a CloudWatch Logs metric filter on the organization's CloudTrail log group for 'CreateUser' events.
B.Enable CloudTrail in the management account with an organization trail that applies to all accounts.
C.Configure an S3 bucket to receive CloudTrail logs from all accounts and enable S3 event notifications for object creation.
D.Use AWS Config rules to detect IAM user creation across accounts.
E.Set a CloudWatch alarm on the metric to send notifications via SNS.
AnswersA, B, E

Metric filters in CloudWatch Logs can parse CloudTrail logs for specific event names, counting occurrences of CreateUser API calls. Since the organization trail delivers logs to a central log group in the management account, a single metric filter can monitor IAM user creation across all member accounts. This provides a real-time, event-driven signal to trigger a CloudWatch alarm, rather than relying on periodic scans or resource configuration evaluations.

Why this answer

Options A, B, and E are correct. Option B: Enabling CloudTrail in the management account with an organization trail captures all API activity across accounts. Option A: Creating a CloudWatch Logs metric filter on the organization's CloudTrail log group for 'CreateUser' events captures the specific event.

Option E: Setting a CloudWatch alarm on the metric sends notifications via SNS. Option C is wrong because configuring an S3 bucket with event notifications does not directly enable centralized monitoring and alerting for IAM user creation. Option D is wrong because AWS Config rules are used for resource configuration compliance, not for real-time API call monitoring like IAM user creation.

1183
MCQhard

A company is using AWS CodeDeploy with a blue/green deployment strategy for an Amazon ECS service. After a deployment, the new task set fails health checks, and CodeDeploy automatically rolls back to the original task set. However, the rollback fails because the original task set's desired count is set to 0. What is the most likely cause?

A.The original task set's desired count was set to 0 during the blue/green deployment and the rollback is unable to restore it because the original task definition is no longer available.
B.The original task set's health checks are failing.
C.The original task set's CloudFormation stack was deleted during the deployment.
D.The original task set was deregistered from the target group.
AnswerA

In a blue/green ECS deployment, CodeDeploy shifts traffic to the replacement task set and sets the original task set's desired count to zero. When a rollback triggers, CodeDeploy attempts to restore that original task set, but if its task definition revision was deregistered or replaced, ECS cannot recreate the task set. The missing task definition makes it impossible to satisfy the service's desired count, leaving the service at zero. This is why keeping the original task definition revision available is critical for successful rollbacks.

Why this answer

During a blue/green deployment on ECS, CodeDeploy sets the original (blue) task set's desired count to 0 after the new (green) task set is created and begins serving traffic. If the green task set fails health checks and triggers an automatic rollback, CodeDeploy attempts to restore the original task set's desired count to its previous value. However, if the original task definition has been deregistered or deleted (e.g., due to lifecycle policies or manual cleanup), the rollback cannot scale the original task set back up, causing the rollback to fail.

Exam trap

The trap here is that candidates assume the rollback fails because the original task set is unhealthy or deregistered from the target group, when in reality the root cause is the deletion of the original task definition, which CodeDeploy needs to recreate the task set during rollback.

How to eliminate wrong answers

Option B is wrong because the original task set's health checks are irrelevant — the original task set is not running (desired count is 0) and thus cannot fail health checks; the rollback failure is due to the inability to restore the task set, not health check failures. Option C is wrong because CloudFormation stacks are not involved in the CodeDeploy blue/green deployment process for ECS; the deployment is managed by CodeDeploy and ECS services, not CloudFormation stack deletion. Option D is wrong because deregistering the original task set from the target group would not prevent the rollback from scaling it up — the rollback fails because the original task definition is missing, not because of target group registration.

1184
MCQmedium

A company is using AWS CodeBuild as part of its CI/CD pipeline. The build projects need to access a private Amazon ECR repository to pull Docker images. What is the MOST secure way to grant CodeBuild access to ECR?

A.Configure a VPC endpoint for ECR and allow CodeBuild to connect through it.
B.Store ECR credentials in AWS Systems Manager Parameter Store and retrieve them in the buildspec.
C.Create a service role for CodeBuild with an IAM policy that grants ECR pull access.
D.Use the AWS CLI to retrieve an ECR authorization token and pass it to Docker.
AnswerC

Creating a service role for CodeBuild and attaching an IAM policy with ECR pull permissions is the proper way to grant access. The service role is assumed by the CodeBuild build, and actions such as ecr:GetAuthorizationToken, ecr:BatchGetImage, and ecr:GetDownloadUrlForLayer allow Docker to pull the image. This approach uses temporary credentials and follows least-privilege principles, making it both secure and auditable. It is the only solution that directly addresses the permission requirement.

Why this answer

CodeBuild can assume an IAM service role with a policy that grants pull access to the ECR repository. This is the most secure approach because it avoids static credentials and leverages AWS identity and access management. Option A is wrong: a VPC endpoint provides private network connectivity to ECR but does not grant access; IAM permissions are still required.

Option B is wrong: storing ECR credentials in Parameter Store introduces static credentials that must be managed and rotated, making it less secure than using an IAM role. Option D is wrong: using the AWS CLI to retrieve an authorization token requires managing temporary credentials and is more complex; the service role approach is simpler and more secure.

1185
MCQeasy

A team wants to automate the creation of a CI/CD pipeline using a JSON/YAML file that defines source, build, and deploy stages. Which AWS service should they use?

A.AWS CloudFormation
B.AWS Elastic Beanstalk
C.AWS CodePipeline
D.AWS CodeDeploy
AnswerA

AWS CloudFormation is the correct choice because it allows the CI/CD pipeline to be defined declaratively as infrastructure as code. A CloudFormation template can specify the source stage, build actions, deployment providers (including CodeDeploy), IAM roles, S3 buckets, and event triggers, then create or update the pipeline in a repeatable and version-controlled manner. This makes it a true automation mechanism for pipeline creation, unlike the other services listed, which either are the pipeline itself or operate within it.

Why this answer

AWS CloudFormation is the correct service because it allows you to define infrastructure as code (IaC) using JSON or YAML templates, which can include the creation of a CI/CD pipeline by defining resources like AWS CodePipeline, CodeBuild, and CodeDeploy. This enables full automation of the pipeline's source, build, and deploy stages through a declarative template, rather than manually configuring each service. The question specifically asks for automating the creation of the pipeline itself using a JSON/YAML file, which is exactly what CloudFormation does.

Exam trap

The trap here is that candidates often confuse the service that defines the pipeline (CloudFormation) with the service that runs the pipeline (CodePipeline), leading them to select CodePipeline because it is directly associated with CI/CD, but the question explicitly asks for the service that uses a JSON/YAML file to automate the creation of the pipeline, which is CloudFormation.

How to eliminate wrong answers

Option B is wrong because AWS Elastic Beanstalk is a PaaS service that automates application deployment and scaling, but it does not allow you to define a CI/CD pipeline using a JSON/YAML file; it uses a configuration file (e.g., .ebextensions) for environment settings, not for pipeline stages. Option C is wrong because AWS CodePipeline is a CI/CD service that orchestrates source, build, and deploy stages, but it is the pipeline itself, not a tool to create the pipeline via a JSON/YAML file; while CodePipeline can be defined in a CloudFormation template, the question asks for the service to automate the creation of the pipeline, not the pipeline service itself. Option D is wrong because AWS CodeDeploy is a deployment service that automates code deployments to compute services like EC2 or Lambda, but it only handles the deploy stage and cannot define the entire pipeline (source, build, deploy) using a JSON/YAML file.

1186
MCQeasy

A company runs a web application on an Auto Scaling group of EC2 instances. The operations team uses CloudWatch alarms to monitor the application. They have set up a CPUUtilization alarm that triggers when the average CPU exceeds 70% for 5 minutes. The alarm triggers a scaling policy to add instances. Recently, the team noticed that the alarm frequently triggers during the day, but the application performance is acceptable. They suspect the alarm is too sensitive and want to reduce the number of false alarms. The team wants to keep the alarm responsive to real CPU spikes but avoid triggering on short bursts. What should the team change in the alarm configuration?

A.Create a composite alarm that combines CPUUtilization with MemoryUtilization.
B.Reduce the metric period to 1 minute and keep evaluation periods at 1.
C.Increase the number of evaluation periods to 3, so the alarm triggers only if CPU is high for 3 consecutive periods.
D.Lower the threshold to 60% to catch more CPU spikes.
AnswerC

Increasing evaluation periods to 3 (with the same period of e.g., 5 minutes) means the alarm triggers only if CPU exceeds 70% for 3 consecutive periods (15 minutes). This filters out short bursts and reduces false alarms while still catching sustained high CPU.

Why this answer

The alarm is triggering too frequently due to short CPU bursts. The goal is to reduce false alarms while remaining responsive to sustained high CPU. Increasing the number of evaluation periods requires the CPU to exceed the threshold for multiple consecutive periods before triggering, filtering out transient spikes.

Thus, option C is correct. Option A (composite alarm) would add complexity but does not address the sensitivity to short bursts. Option B (reducing period to 1 minute) would make the alarm more sensitive, increasing false alarms.

Option D (lowering threshold to 60%) would also increase sensitivity, making false alarms worse.

1187
MCQmedium

A DevOps engineer is creating a CloudFormation template to deploy a VPC with public and private subnets. The template uses the 'AWS::EC2::VPC' resource and two 'AWS::EC2::Subnet' resources. The engineer wants to ensure that the subnets are created in different Availability Zones. What is the best approach?

A.Use Fn::GetAZs function with Fn::Select to pick different AZs from the region's AZ list.
B.Use the CidrBlock property to define different AZs.
C.Use Fn::GetAZs function with a count of 2 to automatically assign different AZs.
D.Hardcode the Availability Zone names in the template.
AnswerA

Fn::GetAZs returns a list of all Availability Zones available in the current region, and Fn::Select chooses an element via its zero-based index. By combining them, you can assign the first AZ to one subnet (Fn::Select [0, Fn::GetAZs ""]) and the second AZ to another (Fn::Select [1, Fn::GetAZs ""]), ensuring two distinct AZs without hardcoding region-specific names. This approach remains valid even as the region's AZ list changes and keeps the template portable across regions.

Why this answer

Fn::GetAZs returns a list of all Availability Zones in the region, and Fn::Select allows you to pick specific indices from that list, ensuring each subnet is assigned a different AZ. This approach is dynamic and region-agnostic, so the template works across regions without hardcoding AZ names. It also avoids the risk of using the same AZ for both subnets, which would violate the requirement for high availability.

Exam trap

The trap here is that candidates confuse the CidrBlock property with AZ assignment, or assume Fn::GetAZs can directly return multiple AZs without using Fn::Select, leading them to pick option B or C.

How to eliminate wrong answers

Option B is wrong because the CidrBlock property defines the IP address range for the subnet, not the Availability Zone; AZ assignment is controlled by the AvailabilityZone property. Option C is wrong because Fn::GetAZs does not accept a count parameter; it returns a list of all AZs, and you must use Fn::Select or Fn::Split to pick individual AZs. Option D is wrong because hardcoding AZ names makes the template region-specific and brittle; if the template is deployed in a region with different AZ names, it will fail, and it also prevents the template from adapting to regions with fewer AZs.

1188
MCQmedium

A company uses AWS CloudFormation to manage infrastructure. After updating a stack, a resource fails to update because it requires a physical replacement. The stack update is set to 'Rollback on failure'. The engineer wants to test the effect of the change without affecting the production environment. Which approach should the engineer use?

A.Create a change set to review the proposed changes before executing the update.
B.Disable rollback on failure and update the stack, then manually revert if issues occur.
C.Create a new stack using the same template but with a different stack name.
D.Use a different AWS region and replicate the stack there for testing.
AnswerA

Change sets provide a read-only, risk-free preview of the exact modifications CloudFormation will apply to the existing stack—including resource replacements, parameter updates, and potential capacity constraints—before any execution. By reviewing a change set, the engineer can see that an update will replace a physical resource (e.g., a database instance) and decide whether to proceed, making it the only option that directly validates the update's impact without touching live infrastructure.

Why this answer

Creating a change set allows you to preview the proposed changes (including whether a resource replacement is required) without actually applying them. This enables you to assess the impact on the production environment before executing the update. Option B is incorrect because disabling rollback still applies the changes, which could disrupt production.

Option C is incorrect because creating a new stack does not test the update against the existing stack; it creates an independent environment. Option D is incorrect because using a different region does not replicate the exact state of the current stack and adds complexity.

1189
MCQmedium

A company's security team requires that all API calls to AWS are logged for audit purposes. Which service should be enabled to capture and store these logs?

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

AWS CloudTrail is the governance, compliance, and audit service that continuously logs every API call made to AWS across the entire account. Each event records the caller identity, source IP address, request parameters, and response elements, which directly satisfies the security team's requirement to audit all API activity. CloudTrail can also deliver these immutable audit logs to an S3 bucket or CloudWatch Logs for long-term retention and automated analysis. It is the definitive service for answering who, what, and when regarding AWS API usage.

Why this answer

AWS CloudTrail is the correct service because it is specifically designed to log all API calls made to the AWS environment, including calls made via the AWS Management Console, AWS SDKs, command line tools, and higher-level AWS services. CloudTrail captures the identity of the caller, the time of the call, the source IP address, the request parameters, and the response elements, storing this information in a log file that can be delivered to an Amazon S3 bucket for long-term audit storage. This directly meets the security team's requirement to capture and store all API calls for audit purposes.

Exam trap

The trap here is that candidates often confuse CloudWatch Logs with CloudTrail because both involve 'logging', but CloudWatch Logs is for application and system logs (e.g., from EC2 or Lambda), while CloudTrail is exclusively for AWS API call logs, and the question explicitly asks for 'API calls to AWS'.

How to eliminate wrong answers

Option B (Amazon CloudWatch Logs) is wrong because CloudWatch Logs is a service for monitoring, storing, and accessing log files from AWS resources (like EC2 instances, Lambda functions, or custom applications), not for capturing AWS API calls themselves; it can ingest CloudTrail logs as a data source but is not the primary service for API call logging. Option C (AWS Config) is wrong because AWS Config is a service that evaluates and records resource configuration changes and compliance over time, not the API calls that triggered those changes; it provides a configuration history but does not log the API requests. Option D (Amazon VPC Flow Logs) is wrong because VPC Flow Logs capture information about IP traffic going to and from network interfaces in a VPC (e.g., source/destination IP, ports, protocol), not AWS API calls; it is a network-level logging feature, not an API-level audit trail.

1190
MCQhard

An organization uses AWS Key Management Service (KMS) with customer-managed keys. The security policy requires automatic key rotation every year. A DevOps engineer notices that the key material is not rotating as expected. What is the most likely cause?

A.The key was created by importing key material; automatic rotation is not supported for imported keys.
B.The key must be re-imported annually to enable rotation.
C.The key is not enabled for rotation due to a billing limit.
D.The key is in a 'Pending Deletion' state and cannot be rotated.
AnswerA

An AWS KMS customer master key with imported key material (Origin: EXTERNAL) cannot have automatic key rotation enabled, because rotation relies on the key material being generated and managed within AWS KMS. The import mechanism bypasses KMS's managed backing keys, so the service cannot automatically replace the backing key. To rotate such a key, you must manually create a new CMK or import new key material into the existing CMK.

Why this answer

Automatic key rotation is not supported for imported key material. Option B is wrong because KMS does not charge extra for automatic rotation. Option C is wrong because KMS does not require re-importing for rotation; it's simply not available.

Option D is wrong because the key state does not prevent rotation.

1191
MCQmedium

A company stores sensitive customer data in an S3 bucket. The security team requires that all data be encrypted at rest using customer-managed KMS keys. Additionally, any attempt to upload an unencrypted object must be denied. Which S3 bucket policy should be used?

A.Deny s3:PutObject unless the request includes s3:x-amz-server-side-encryption: true
B.Allow s3:PutObject with condition s3:x-amz-server-side-encryption: AES256
C.Allow s3:PutObject with condition kms:EncryptionContext: department:finance
D.Deny s3:PutObject unless the request includes s3:x-amz-server-side-encryption: aws:kms
AnswerD

This explicit Deny is the correct approach because it denies any PutObject that does not include the x-amz-server-side-encryption header with the value 'aws:kms'. The value 'aws:kms' is the algorithm identifier for SSE-KMS, ensuring all uploaded objects are encrypted with a KMS-managed key. Because it is an explicit deny, even if another policy allows an unencrypted upload, this deny overrides it. This is the standard pattern for enforcing KMS encryption across an S3 bucket.

Why this answer

The condition 's3:x-amz-server-side-encryption':'aws:kms' in a Deny statement ensures that only requests with SSE-KMS encryption are allowed, blocking unencrypted uploads or uploads with other encryption types. Option A is wrong because 'true' is not a valid encryption type; the correct value is 'aws:kms'. Option B is wrong because it allows SSE-S3 (AES256), not KMS encryption.

Option C is wrong because it checks a KMS encryption context rather than the encryption header, and it does not deny unencrypted uploads.

1192
MCQhard

A DevOps engineer is troubleshooting a CodePipeline that has a Build stage using AWS CodeBuild. The build logs show 'Error: No such file or directory' for a file that is present in the source repository. What is the most likely cause?

A.The buildspec.yaml specifies an incorrect path for the file relative to the source root.
B.The build commands are not executed because the pre_build phase failed.
C.The artifact definition in the buildspec.yaml is incorrect.
D.The environment variables in CodeBuild are not set correctly.
AnswerA

In CodeBuild, each build phase executes from the source root, so any command that references a file—such as a build script, configuration file, or dependency manifest—must specify a path relative to that root (or use $CODEBUILD_SRC_DIR). If buildspec.yaml points to a file using an incorrect relative path (e.g., forgetting a subdirectory, misspelling a folder, or assuming a different working directory), the shell returns a 'No such file or directory' error. Verify the actual repository layout against every file path used in the install, pre_build, build, and post_build commands.

Why this answer

The error 'No such file or directory' indicates that the build process is attempting to access a file at a path that does not exist relative to the source root. In AWS CodeBuild, the build runs in a temporary directory that contains the source code, and all paths in the buildspec.yaml are relative to the source root by default. If the buildspec.yaml specifies an incorrect relative path (e.g., using an absolute path or a wrong subdirectory), CodeBuild will fail to locate the file, even though it exists in the repository.

Exam trap

The trap here is that candidates often confuse file path errors with environment variable misconfiguration or artifact issues, but the root cause is almost always a path mismatch in the buildspec.yaml relative to the source root.

How to eliminate wrong answers

Option B is wrong because if the pre_build phase failed, the build phase would not execute at all, and the error message would typically indicate a phase failure, not a 'No such file or directory' error for a specific file. Option C is wrong because an incorrect artifact definition would cause issues during the artifact packaging or upload phase, not during the build execution when accessing source files. Option D is wrong because environment variables in CodeBuild do not affect file path resolution; they are used for passing configuration values, not for locating files in the source directory.

1193
MCQhard

A company uses Amazon RDS for MySQL with Multi-AZ deployment. The primary DB instance fails, and automatic failover does not occur within the expected 1-2 minutes. The DevOps team needs to quickly restore database availability. What should the team do first?

A.Restore the latest automated snapshot to a new DB instance.
B.Modify the DB instance to change the Multi-AZ setting to enable automatic failover.
C.Connect to the standby instance directly and promote it to primary.
D.Reboot the DB instance with failover selected.
AnswerD

Rebooting the DB instance with the 'Reboot with failover' option selected forces a synchronous failover to the standby instance, typically completing in 60-120 seconds. This is the fastest method to manually initiate a failover while preserving existing data, as the standby is already in sync and becomes the new primary.

Why this answer

When automatic failover does not occur within the expected 1-2 minutes, the fastest way to manually trigger a failover is to reboot the DB instance with the 'Reboot with Failover' option selected. This forces the RDS service to promote the standby replica to the new primary, restoring database availability without waiting for the automated health check to complete. Option D is correct because it directly initiates the failover process, leveraging the existing Multi-AZ setup.

Exam trap

The trap here is that candidates assume they can directly access or promote the standby instance (Option C), but RDS does not expose the standby as a connectable endpoint, and the only manual failover mechanism is the reboot with failover option.

How to eliminate wrong answers

Option A is wrong because restoring from the latest automated snapshot to a new DB instance is a time-consuming process (can take minutes to hours depending on size) and does not utilize the existing standby replica, which is already synchronized and ready to take over. Option B is wrong because modifying the Multi-AZ setting to 'enable automatic failover' is not a valid action; Multi-AZ is already enabled and the setting cannot be toggled to 'enable' failover—failover is inherent to Multi-AZ and the issue is that the automatic health check did not trigger it. Option C is wrong because you cannot directly connect to the standby instance in Amazon RDS Multi-AZ; the standby is not accessible as a standalone database endpoint and there is no 'promote' operation available to the user—RDS manages the standby entirely.

1194
Matchingmedium

Match each AWS automation or configuration management tool to its description.

Drag a concept onto its matching description — or click a concept then click the description.

Concepts
Matches

Operational hub for managing AWS resources at scale

Configuration management service using Chef and Puppet

PaaS for deploying and scaling web applications

Infrastructure as Code using templates

Create and manage approved IT service catalogs

Why these pairings

AWS CloudFormation is for IaC, OpsWorks for configuration management, Elastic Beanstalk for PaaS, and CodeDeploy for automated deployments. Distractors swap definitions.

1195
MCQhard

A company uses Amazon ECS with Fargate for containerized applications. The DevOps team notices that some tasks are failing with 'OutOfMemoryError' but the CloudWatch metric 'MemoryUtilization' for the service shows values well below the task memory limit. What is the most likely cause of this discrepancy?

A.The container's memory usage is hitting the kernel's memory cgroup limit before the Docker-reported usage reaches the task memory limit.
B.The CloudWatch metric 'MemoryUtilization' is aggregated across all tasks in the service, so individual task spikes are averaged out.
C.The task definition has a memory reservation but no hard limit, causing ECS to overcommit memory.
D.The container is using swap space, which is not included in the MemoryUtilization metric.
AnswerA

The OOM killer can be triggered by the kernel's memory cgroup limit, which may be set lower than the task memory limit, or by the container exceeding the soft limit, causing the metric to not reflect the actual limit breach.

Why this answer

The MemoryUtilization metric reported by CloudWatch for ECS on Fargate is based on the Docker-reported memory usage, but the Linux kernel's out-of-memory (OOM) killer terminates the container when it exceeds the hard memory limit defined at the container level in the task definition. This can happen even if the task-level metric appears below the limit, as the metric may smooth out spikes or not reflect the container's actual memory cgroup limit. Option B is wrong because averaging across tasks does not cause a discrepancy for individual tasks; the metric is per-task.

Option C is wrong because in Fargate, the task definition specifies both memory reservation (soft limit) and memory limit (hard limit), and the issue is with the hard limit. Option D is wrong because Fargate does not support swap space.

1196
MCQhard

A company runs a containerized application on Amazon ECS with Fargate launch type. The application experiences intermittent failures when the ECS service scheduler attempts to place tasks during a deployment. The DevOps engineer notices that tasks fail to start due to insufficient IP addresses in the VPC subnets. What is the MOST resilient solution to prevent this issue?

A.Create an ECS service-linked role with permissions to allocate IPs.
B.Increase the desired task count in the ECS service to pre-warm IP addresses.
C.Use VPC endpoints for ECS to reduce IP usage.
D.Configure the ECS service to use multiple subnets with larger CIDR blocks across multiple Availability Zones.
AnswerD

Deploying the ECS service across multiple subnets with larger CIDR blocks increases the total number of usable private IP addresses in different Availability Zones, allowing additional tasks to be launched. Since each awsvpc-mode task requires an ENI with its own private IP, a larger IP pool directly solves the exhaustion. Using multiple AZs also improves availability by spreading tasks across fault domains, making this the appropriate corrective action.

Why this answer

Using a larger CIDR block for subnets provides more IP addresses, and using multiple subnets across Availability Zones increases availability and capacity. Option A is wrong because increasing desired count does not solve IP shortage. Option B is wrong because ECS service-linked role does not affect IP allocation.

Option C is wrong because VPC endpoints do not provide IP addresses for tasks.

1197
MCQeasy

A company wants to use AWS OpsWorks for configuration management of their EC2 instances. They need to ensure that the instances are automatically configured with the latest security patches upon boot. Which OpsWorks feature should they use?

A.Create a custom Chef recipe that installs security patches and assign it to the setup lifecycle event.
B.Configure the instances to run a user data script that updates packages.
C.Use AWS Systems Manager Patch Manager with an OpsWorks lifecycle event.
D.Use a CloudFormation template to apply patches during stack creation.
AnswerA

Custom Chef recipes are the native configuration-management mechanism in AWS OpsWorks. Assigning a recipe that invokes the platform package manager (e.g., `apt-get update` and `apt-get upgrade -y` or `yum update -y`) to the setup lifecycle event ensures it runs on every instance immediately after boot, before any application deployment. The setup event runs only once at instance launch, making it the correct hook for initial patch application, and OpsWorks propagates any recipe changes when instances are updated or started.

Why this answer

AWS OpsWorks uses Chef recipes to manage instance configuration. By creating a custom Chef recipe that installs the latest security patches and assigning it to the 'setup' lifecycle event, the recipe runs automatically on every new instance boot, ensuring patches are applied before the instance enters service. This is the native OpsWorks mechanism for configuration management during instance provisioning.

Exam trap

The trap here is that candidates may confuse OpsWorks's native Chef lifecycle events with external tools like Systems Manager or user data scripts, failing to recognize that OpsWorks is designed to use Chef recipes for configuration management, not external patch management services.

How to eliminate wrong answers

Option B is wrong because user data scripts run at boot but are not integrated with OpsWorks lifecycle events, so they cannot leverage OpsWorks's configuration management workflow or be managed centrally via Chef. Option C is wrong because AWS Systems Manager Patch Manager is a separate service that does not integrate directly with OpsWorks lifecycle events; OpsWorks does not have a built-in event hook for Patch Manager. Option D is wrong because CloudFormation templates are used for infrastructure provisioning, not for ongoing configuration management within OpsWorks; applying patches during stack creation does not ensure automatic patching on subsequent boots.

1198
MCQeasy

An application running on Amazon ECS experiences intermittent failures. The DevOps engineer wants to capture the application's standard output and error logs and send them to CloudWatch Logs. What is the simplest way to achieve this?

A.Install the CloudWatch Agent in each container.
B.Configure AWS CloudTrail to capture logs.
C.Use the awslogs log driver in the task definition.
D.Write logs to a file and use an S3 bucket with event notifications.
AnswerC

The `awslogs` log driver, configured under the `logConfiguration` element in the ECS task definition, makes Docker send the container's `stdout` and `stderr` directly to a specified CloudWatch Logs group and stream. The ECS agent automatically creates log streams, and you can set `awslogs-group`, `awslogs-region`, and `awslogs-stream-prefix`; the task execution role must have `logs:CreateLogStream` and `logs:PutLogEvents` permissions. This approach requires no changes to the application image, works on both Fargate and EC2 launch types, and provides near-real-time access to logs through the CloudWatch console, CLI, or APIs. It is the native, recommended method for centralizing ECS container logs.

Why this answer

The awslogs log driver is the simplest native integration between Amazon ECS and CloudWatch Logs. By specifying the log driver in the task definition, the ECS container agent automatically captures stdout and stderr from the container and streams them to CloudWatch Logs without any additional agents or custom code.

Exam trap

The trap here is that candidates may overcomplicate the solution by choosing the CloudWatch Agent (Option A) because they assume an agent is needed, but the awslogs log driver is the built-in, simpler mechanism for ECS tasks.

How to eliminate wrong answers

Option A is wrong because installing the CloudWatch Agent inside each container adds unnecessary complexity and overhead; the awslogs log driver handles log forwarding at the container runtime level, making an in-container agent redundant. Option B is wrong because AWS CloudTrail captures API activity and management events, not application stdout/stderr logs, so it cannot fulfill the requirement to capture application output. Option D is wrong because writing logs to a file and using S3 event notifications introduces latency, extra components (S3 bucket, notifications), and does not provide real-time log streaming to CloudWatch Logs; the awslogs driver is far simpler and more direct.

1199
Multi-Selectmedium

A company is deploying a new microservice on AWS Lambda. The DevOps team needs to monitor the function for errors and performance issues. Which TWO steps should the team take to set up effective monitoring?

Select 2 answers
A.Enable VPC Flow Logs to monitor network traffic to the function
B.Enable AWS Config rules to evaluate the function configuration
C.Enable active tracing with AWS X-Ray to trace requests through the function
D.Enable CloudWatch Logs for the Lambda function to capture application logs
E.Install the CloudWatch Agent on the Lambda execution environment
AnswersC, D

Enabling active tracing with AWS X-Ray gives you end-to-end visibility into requests as they pass through the Lambda function and any downstream AWS services or HTTP APIs. X-Ray automatically records a trace segment for each invocation, captures timing, errors, and subsegments for calls made with the AWS SDK, and supports sampling to control cost. It also propagates trace IDs across services, enabling you to follow a single user request through the entire distributed application.

Why this answer

AWS X-Ray provides end-to-end tracing for requests, allowing you to identify performance bottlenecks and errors in Lambda functions. Option D is correct because Lambda automatically sends logs to CloudWatch Logs, which capture application output, errors, and custom logging. Option A is incorrect: VPC Flow Logs monitor network traffic at the VPC level, not Lambda function internals.

Option B is incorrect: AWS Config evaluates resource configurations for compliance, not for function monitoring. Option E is incorrect: The CloudWatch Agent is for EC2 or on-premises servers; Lambda already integrates with CloudWatch Logs natively.

1200
MCQmedium

Refer to the exhibit. A DevOps engineer set up a CloudWatch alarm for a Lambda function. The alarm fires when the error count metric exceeds 10 in 5 minutes. The engineer receives an alarm notification, but when checking the Lambda logs, only 3 errors are found in that 5-minute window. What is the MOST likely reason for the discrepancy?

A.The metric filter is not processing logs in real time, causing a delay.
B.The metric filter is counting errors from other log groups or sources that use the same metric name.
C.The metric filter pattern is incorrect and is matching non-error entries.
D.The Lambda function is generating more errors than shown in the logs.
AnswerB

When multiple log groups or sources publish to the same metric name and namespace, CloudWatch automatically sums all values into that single metric. The alarm then evaluates the aggregated count across all sources, not just the one log group being inspected in the console. In this scenario, other log groups or a Lambda custom metric with the same name are contributing 500-counts, so the alarm correctly reflects a combined total that is higher than the count visible in one individual log group.

Why this answer

The metric filter might be capturing errors from other log groups that share the same metric name (ErrorCount). If multiple Lambda functions or other services publish to the same metric, the alarm could be summing across all of them. Option A is wrong because CloudWatch Logs metric filters are near real-time.

Option C is wrong because Lambda errors are counted correctly. Option D is wrong because the metric filter is correctly defined.

Page 15

Page 16 of 20

Page 17