devopsbymuh_

DVA-C02 practice questions and answers

All 66 questions from Full Practice Test 1 for AWS Certified Developer – Associate, with the correct answer and a full explanation for each — including why the other options are wrong. Free to read, no signup.

What this set covers

Questions are weighted to match the official DVA-C02 exam guide. The real exam is 65 (50 scored) questions in 130 minutes with a pass mark of 720 / 1000.

  • Development with AWS Services21 q · 32%
  • Security17 q · 26%
  • Deployment16 q · 24%
  • Troubleshooting and Optimization12 q · 18%
Question 1Development with AWS Services

A Lambda function must process messages from an SQS queue and delete them only after successful processing. What is the correct way to build this?

  • AConfigure the SQS queue as an event source mapping for the function; Lambda deletes messages when the function returns successfully.
  • BPoll the queue from inside the function with a loop and call DeleteMessage manually.
  • CSubscribe the function to an SNS topic that also writes to the queue.
  • DUse a CloudWatch Events rule to invoke the function every minute and read the queue.

Correct answer: A Configure the SQS queue as an event source mapping for the function; Lambda deletes messages when the function returns successfully.

An event source mapping makes Lambda poll the queue, invoke the function with a batch, and delete the messages automatically when the invocation succeeds. Failed messages become visible again and eventually go to a dead-letter queue. Manual polling and scheduled invocations reinvent that machinery badly.

Using Lambda with Amazon SQS
Question 2Development with AWS Services

A DynamoDB table uses `customerId` as the partition key. The application must query all orders for a customer sorted by date. What is the best table design?

  • AAdd `orderDate` as the sort key of the table.
  • BScan the table and sort the results in the application.
  • CCreate a second table keyed by date.
  • DStore all orders for a customer in one large item.

Correct answer: A Add `orderDate` as the sort key of the table.

With a composite key of partition key plus sort key, a Query returns all items for a customer already sorted by the sort key, and can use ranges such as 'last 30 days'. Scans read the whole table and cost far more. A single large item hits the 400 KB item limit.

DynamoDB core components
Question 3Security

A mobile app must let users sign in with Google or email, then call an API Gateway endpoint with temporary AWS credentials. Which service handles this?

  • AAmazon Cognito user pools with an identity pool
  • BIAM users created for each app user
  • CAWS Directory Service
  • DAWS Secrets Manager

Correct answer: A Amazon Cognito user pools with an identity pool

A Cognito user pool handles sign-up and sign-in, including federated identity providers such as Google, and an identity pool exchanges that token for temporary AWS credentials. Creating IAM users per end user does not scale and is not the intended pattern.

Amazon Cognito identity pools
Question 4Security

A Lambda function must read a database password that is encrypted with a customer managed KMS key. What must the function's execution role allow?

  • Akms:Decrypt on the key, plus permission to read the secret or parameter
  • Bkms:CreateKey and kms:Encrypt
  • Ciam:PassRole on the execution role
  • DNothing — Lambda decrypts automatically

Correct answer: A kms:Decrypt on the key, plus permission to read the secret or parameter

To read an encrypted value the role needs the read action (for example `secretsmanager:GetSecretValue` or `ssm:GetParameter`) and `kms:Decrypt` on the key, and the key policy must allow the role. Nothing decrypts automatically with a customer managed key.

AWS KMS key policies and grants
Question 5Deployment

A team wants to shift 10% of production traffic to a new Lambda version, watch CloudWatch alarms, and roll back automatically if errors rise. What should they use?

  • AA Lambda alias with weighted routing, deployed by AWS CodeDeploy with a canary configuration
  • BPublish the new version and update all clients at once
  • CTwo separate functions behind an Application Load Balancer
  • DA CloudFormation stack update with rollback triggers only

Correct answer: A A Lambda alias with weighted routing, deployed by AWS CodeDeploy with a canary configuration

CodeDeploy supports canary and linear traffic shifting for Lambda by adjusting the weights on an alias, and it rolls back automatically when a CloudWatch alarm fires. The other options either have no gradual shift or no automated rollback tied to function metrics.

Lambda deployment configurations in CodeDeploy
Question 6Deployment

Which Elastic Beanstalk deployment policy keeps full capacity during the deployment and gives the fastest rollback, at the cost of running double the instances for a while?

  • AAll at once
  • BRolling
  • CRolling with additional batch
  • DImmutable

Correct answer: D Immutable

Immutable deployments launch a full new set of instances in the same Auto Scaling group and swap them in, so rollback is simply terminating the new instances. Rolling policies replace instances in batches and roll back more slowly, and all-at-once causes downtime.

Elastic Beanstalk deployment policies
Question 7Troubleshooting and Optimization

Requests through API Gateway to a Lambda function are slow, and the team needs to see where the time goes across the API, the function, and DynamoDB. Which service should they enable?

  • AAWS X-Ray tracing
  • BAWS CloudTrail data events
  • CAmazon CloudWatch Logs Insights alone
  • DVPC Flow Logs

Correct answer: A AWS X-Ray tracing

X-Ray produces a service map and traces with timing for each segment, which is exactly how you find the slow hop. CloudTrail records API calls for audit, Logs Insights queries log text without end-to-end timing, and flow logs show network traffic only.

AWS X-Ray concepts
Question 8Troubleshooting and OptimizationSelect 2

A Lambda function writing to DynamoDB starts returning `ProvisionedThroughputExceededException` during traffic spikes. Which two changes address this? (Select TWO.)

  • ASwitch the table to on-demand capacity mode.
  • BImplement exponential backoff with jitter for retries in the SDK.
  • CIncrease the Lambda function timeout.
  • DAdd a global secondary index.
  • EIncrease the Lambda memory setting.

Correct answer: A, B Switch the table to on-demand capacity mode. · Implement exponential backoff with jitter for retries in the SDK.

Throttling means the table cannot serve the request rate: on-demand mode scales capacity automatically, and exponential backoff spreads retries instead of hammering the table. A longer timeout, a new index, or more memory do not add table capacity.

Error retries and exponential backoff
Question 9Development with AWS Services

Which API Gateway feature lets you return cached responses for identical GET requests to reduce backend load?

  • AStage-level caching with a TTL
  • BUsage plans
  • CRequest validators
  • DMapping templates

Correct answer: A Stage-level caching with a TTL

API Gateway caching is enabled per stage with a cache size and TTL, and it serves repeated requests without calling the integration. Usage plans throttle and meter API keys, validators reject malformed requests, and mapping templates transform payloads.

Caching in API Gateway
Question 10Security

An application must upload files directly from a browser to Amazon S3 without sending them through the application server, and without exposing AWS credentials. What should be used?

  • AA presigned URL generated by the backend
  • BThe AWS access key embedded in the JavaScript bundle
  • CA public bucket with CORS enabled
  • DAn S3 bucket policy allowing anonymous PUT

Correct answer: A A presigned URL generated by the backend

A presigned URL carries a short-lived signature for one specific operation and object, so the browser can upload straight to S3 while credentials stay on the server. Keys in JavaScript and anonymous PUT permissions are serious security holes.

Using presigned URLs
Question 11Development with AWS Services

A workflow must call several services in sequence, retry failed steps, branch on results, and wait for a human approval step that can take days. Which service fits best?

  • AAWS Step Functions
  • BAmazon SQS with long polling
  • CA single long-running Lambda function
  • DAmazon EventBridge rules

Correct answer: A AWS Step Functions

Step Functions state machines handle sequencing, retries, choices, parallel branches and long waits — including callback tasks that pause until a token is returned. Lambda has a 15-minute maximum runtime, so it cannot wait for days.

AWS Step Functions
Question 12Deployment

In AWS SAM or CloudFormation, which section holds values you want to pass in at deploy time so the same template works for dev and prod?

  • AParameters
  • BOutputs
  • CMappings
  • DConditions

Correct answer: A Parameters

Parameters accept values at stack creation or update. Outputs export values from a stack, Mappings hold static lookup tables such as Region-to-AMI, and Conditions decide whether resources are created.

CloudFormation template anatomy
Question 13Troubleshooting and Optimization

A Lambda function performs a CPU-heavy image transformation and regularly runs close to its 30-second timeout. The function is allocated 512 MB of memory and uses only about 200 MB. What is the most effective way to make it finish faster?

  • AIncrease the memory setting, because Lambda allocates CPU power proportionally to memory.
  • BIncrease the function timeout to 60 seconds.
  • CLower the memory setting to match actual usage so the function starts faster.
  • DMove the function into a VPC with a larger subnet.

Correct answer: A Increase the memory setting, because Lambda allocates CPU power proportionally to memory.

In Lambda, memory is the only performance dial: CPU (and network) scale with the memory you configure, and a function crosses one full vCPU at 1,769 MB. A CPU-bound function that barely uses its RAM still runs faster with more memory allocated, and often costs the same or less because duration drops. A longer timeout just permits a slow run, lowering memory makes it slower, and VPC configuration does not add CPU.

Lambda function memory and CPU
Question 14Troubleshooting and OptimizationSelect 2

An IoT platform writes device readings to a Kinesis data stream. Producers frequently receive ProvisionedThroughputExceededException, and CloudWatch shows one shard far busier than the others. Which two changes address the problem? (Select TWO.)

  • AChoose a partition key with higher cardinality, such as the device ID, so records spread evenly across shards.
  • BIncrease the number of shards, or switch the stream to on-demand capacity mode.
  • CIncrease the data retention period of the stream.
  • DSwitch consumers to enhanced fan-out.
  • EEnable server-side encryption on the stream.

Correct answer: A, B Choose a partition key with higher cardinality, such as the device ID, so records spread evenly across shards. · Increase the number of shards, or switch the stream to on-demand capacity mode.

Write throughput is per shard, so throttling with one hot shard means the partition key concentrates records — a high-cardinality key spreads them — and the stream as a whole may simply need more capacity. Retention controls how long records stay readable. Enhanced fan-out gives each consumer its own read throughput and does nothing for producer throttling. Encryption is unrelated.

Kinesis Data Streams: resharding and partition keys
Question 15Deployment

A team wants a small group of beta testers to hit a new version of a Lambda-backed REST API while all other clients keep using the current version. They do not want to duplicate the API definition or the resources.

  • ACreate a second API Gateway stage (for example `beta`) and use a stage variable that points the integration at a different Lambda alias.
  • BCreate a second REST API in API Gateway and redeploy the whole definition to it.
  • CPublish a new Lambda version and change the $LATEST alias for everyone.
  • DAdd a query string parameter that the function inspects to decide which code path to run.

Correct answer: A Create a second API Gateway stage (for example `beta`) and use a stage variable that points the integration at a different Lambda alias.

Stages are separate deployments of the same API definition, and stage variables can be used in the integration URI to select a Lambda alias per stage — so `beta` invokes the new alias and `prod` keeps the stable one. Duplicating the API doubles the maintenance. Repointing an alias affects all callers. Branching inside the function mixes two versions of the code in one deployable.

Using stage variables in API Gateway
Question 16Security

A video platform serves paid content through Amazon CloudFront and must make each file link valid for one hour and tied to a single customer. Which approach does AWS recommend?

  • ACreate signed URLs using a public key uploaded to CloudFront and referenced by a trusted key group.
  • BCreate signed URLs using CloudFront key pairs created by the AWS account root user.
  • CRestrict the distribution with a geo restriction rule per customer.
  • DServe the files from a public S3 bucket and rotate the object names every hour.

Correct answer: A Create signed URLs using a public key uploaded to CloudFront and referenced by a trusted key group.

Trusted key groups are the current recommended mechanism: you upload a public key to CloudFront, add it to a key group, and sign URLs with the matching private key, setting an expiry per URL. Trusted signers based on root-account key pairs are the legacy approach AWS advises against. Geo restrictions filter by country, not by customer. Renaming public objects is security by obscurity.

Serving private content with signed URLs
Question 17Security

A mobile game lets players sign in with Google or Apple. After sign-in, the app must upload screenshots directly to Amazon S3 using temporary AWS credentials scoped per user. Which combination should the developer use?

  • AAn Amazon Cognito user pool for sign-in, plus an identity pool that exchanges the token for temporary AWS credentials.
  • BAn Amazon Cognito user pool only — its tokens are AWS credentials.
  • CAn IAM user per player, with access keys delivered to the app after sign-in.
  • DAWS IAM Identity Center with a permission set per player.

Correct answer: A An Amazon Cognito user pool for sign-in, plus an identity pool that exchanges the token for temporary AWS credentials.

A user pool handles registration, sign-in and federation with social providers, and returns JWTs. Those tokens are not AWS credentials — an identity pool trades them via STS for temporary credentials tied to an IAM role, which can even restrict S3 prefixes per user with policy variables. Per-player IAM users do not scale, and IAM Identity Center is for workforce access, not app end users.

Amazon Cognito identity pools
Question 18Security

Compliance requires that every object written to an S3 bucket is encrypted with SSE-KMS, and that any upload request without the encryption header is rejected outright. What should the developer configure?

  • AA bucket policy that denies s3:PutObject when the s3:x-amz-server-side-encryption condition key is not aws:kms.
  • BDefault bucket encryption only, so unencrypted uploads are encrypted automatically.
  • CAn IAM policy on the uploading role that allows s3:PutObject.
  • DS3 Object Lock in compliance mode.

Correct answer: A A bucket policy that denies s3:PutObject when the s3:x-amz-server-side-encryption condition key is not aws:kms.

A bucket policy with a Deny and the encryption condition key is what actually rejects a non-conforming request — that is the stated requirement. Default encryption silently encrypts instead of rejecting, so a request without the header still succeeds. Allowing PutObject grants access without constraining it. Object Lock prevents deletion, not unencrypted writes.

Protecting data with server-side encryption
Question 19Development with AWS Services

Betting records in a DynamoDB table must be removed automatically about 30 days after they are written, without consuming write capacity for deletes and without a scheduled job.

  • AEnable TTL on the table and write an attribute holding the expiry time as a Unix epoch value in seconds.
  • BRun a scheduled Lambda function that scans the table and deletes old items.
  • CEnable point-in-time recovery and restore the table each month.
  • DAdd a global secondary index on the timestamp and delete from it.

Correct answer: A Enable TTL on the table and write an attribute holding the expiry time as a Unix epoch value in seconds.

DynamoDB TTL deletes expired items in the background at no extra cost — you enable it on a numeric attribute containing epoch seconds. Deletion is not immediate (typically within 48 hours), which is fine for a 30-day retention rule. A scanning Lambda burns read and write capacity. PITR is a backup feature, and you cannot delete items 'from' an index.

Expiring items with DynamoDB TTL
Question 20Deployment

During a rolling deployment in AWS Elastic Beanstalk, two batches updated successfully and the third failed health checks. What is the state of the environment, and what should the developer expect?

  • AThe environment is running a mix of the old and new application versions, and another deployment is needed to make all instances consistent.
  • BBeanstalk automatically restores every instance to the previous version.
  • CThe environment is terminated and rebuilt from the last known good version.
  • DAll traffic is routed to the two successful batches until the third recovers on its own.

Correct answer: A The environment is running a mix of the old and new application versions, and another deployment is needed to make all instances consistent.

A failed rolling deployment leaves the already-updated batches on the new version and the rest on the old one, so you must deploy again — usually the previous version — to converge. Only immutable and blue/green style deployments give a clean automatic fallback, which is exactly why teams choose them for production despite the extra instances.

Elastic Beanstalk deployment policies
Question 21Development with AWS Services

Consumers of an SQS standard queue occasionally process the same message twice. Logs show the duplicate is picked up about 30 seconds after the first consumer received it, while processing normally takes 45 to 90 seconds. What is the correct fix?

  • AIncrease the queue's visibility timeout beyond the maximum processing time, and call ChangeMessageVisibility from the consumer when a message takes longer.
  • BIncrease the message retention period.
  • CEnable long polling by setting ReceiveMessageWaitTimeSeconds to 20.
  • DReduce the delay seconds setting on the queue to zero.

Correct answer: A Increase the queue's visibility timeout beyond the maximum processing time, and call ChangeMessageVisibility from the consumer when a message takes longer.

A message becomes visible again when the visibility timeout expires, so a 30-second timeout on work that takes 90 seconds guarantees another consumer will pick it up. Raise the timeout, and extend it dynamically with ChangeMessageVisibility for long jobs. Retention controls how long unprocessed messages survive, long polling reduces empty responses, and delay seconds postpones first delivery — none of them affect redelivery mid-processing.

Amazon SQS visibility timeout
Question 22Security

A team must store roughly 400 configuration values and third-party API keys used by their applications. They need encryption, a folder-like hierarchy, version history, and the lowest possible cost. Rotation is not required.

  • AAWS Systems Manager Parameter Store using SecureString parameters.
  • BAWS Secrets Manager with rotation disabled.
  • CLambda environment variables encrypted with a KMS key.
  • DAn encrypted S3 object read at application start.

Correct answer: A AWS Systems Manager Parameter Store using SecureString parameters.

Parameter Store supports hierarchical names such as /app/prod/db/password, keeps version history, encrypts SecureString values with KMS, and standard parameters are free — the right fit when automatic rotation is not needed. Secrets Manager charges per secret per month and its main advantage is rotation. Environment variables cannot be shared across applications, and an S3 object is a hand-built store with no versioned parameter API.

AWS Systems Manager Parameter Store
Question 23Troubleshooting and OptimizationSelect 2

An application on EC2 instruments its code with the AWS X-Ray SDK, but no traces appear in the X-Ray console. The application runs without errors. Which two things should the developer check? (Select TWO.)

  • AThe X-Ray daemon is installed and running on the instance, listening on UDP port 2000.
  • BThe instance profile role grants xray:PutTraceSegments and xray:PutTelemetryRecords.
  • CThe instance has a public IP address so it can reach the X-Ray console.
  • DDetailed CloudWatch monitoring is enabled on the instance.
  • EThe application writes trace data to CloudWatch Logs first.

Correct answer: A, B The X-Ray daemon is installed and running on the instance, listening on UDP port 2000. · The instance profile role grants xray:PutTraceSegments and xray:PutTelemetryRecords.

The SDK does not call the X-Ray API directly — it sends segments over UDP to the local X-Ray daemon, which buffers and uploads them, so the daemon must be running and the instance role must allow the two X-Ray write actions (the AWSXRayDaemonWriteAccess managed policy covers them). Public IPs are unnecessary if there is a route or VPC endpoint, detailed monitoring is a metrics resolution setting, and X-Ray does not read traces from CloudWatch Logs.

Running the X-Ray daemon on Amazon EC2
Question 24Development with AWS Services

A trading application has several processes updating the same DynamoDB item. Updates must not overwrite each other: a write should succeed only if the item has not changed since it was read.

  • AUse UpdateItem with a ConditionExpression that checks a version attribute, and retry when the condition fails.
  • BUse PutItem and rely on DynamoDB's last-writer-wins behaviour.
  • CEnable strongly consistent reads on the table.
  • DUse BatchWriteItem to group the updates into one request.

Correct answer: A Use UpdateItem with a ConditionExpression that checks a version attribute, and retry when the condition fails.

This is optimistic locking: keep a version number on the item and make the write conditional on that value, so a stale write fails with ConditionalCheckFailedException and can be retried with fresh data. PutItem simply overwrites. Strongly consistent reads fix read staleness, not write conflicts. BatchWriteItem does not support condition expressions and is not atomic across items.

Condition expressions in DynamoDB
Question 25Deployment

A CloudFormation template creates a VPC in one stack, and a second stack must place its resources in that VPC's subnets. Which mechanism should the developer use?

  • ADeclare Outputs with Export names in the network stack and use Fn::ImportValue in the application stack.
  • BUse Ref in the application stack to reference the network stack's logical IDs directly.
  • CCopy the subnet IDs into a Mappings section in the application stack.
  • DUse Fn::GetAtt with the other stack's name as the first argument.

Correct answer: A Declare Outputs with Export names in the network stack and use Fn::ImportValue in the application stack.

Cross-stack references work through exported outputs: the producing stack exports a value under a unique name, and consumers import it, which also blocks deletion of a resource another stack depends on. Ref and GetAtt only resolve resources inside the same template. Hard-coding IDs into Mappings breaks the moment the network stack is rebuilt.

Walkthrough: Refer to resource outputs in another stack
Question 26Deployment

Which line must appear in an AWS SAM template so that CloudFormation processes the serverless resource types?

  • ATransform: AWS::Serverless-2016-10-31
  • BType: AWS::Serverless::Application
  • CAWSTemplateFormatVersion: '2010-09-09'
  • DGlobals: Function: Runtime: python3.12

Correct answer: A Transform: AWS::Serverless-2016-10-31

The Transform declaration tells CloudFormation to run the SAM macro, which expands shorthand types such as AWS::Serverless::Function into full CloudFormation resources — without it the template is invalid. The template format version is optional, Globals is an optional convenience section, and the Application type is one specific resource.

AWS SAM template anatomy
Question 27Development with AWS Services

A Lambda function must hand a 5 MB JSON document to a downstream worker through Amazon SQS. Uploads fail because the payload exceeds the limit. What is the recommended pattern?

  • AStore the document in Amazon S3 and send a message containing the object key, or use the SQS Extended Client Library which does this for you.
  • BRequest a service quota increase for the SQS maximum message size.
  • CSplit the document into 256 KB messages and reassemble them in the consumer.
  • DCompress the payload and send it as a message attribute instead of the body.

Correct answer: A Store the document in Amazon S3 and send a message containing the object key, or use the SQS Extended Client Library which does this for you.

SQS messages are capped at 256 KB, and the standard answer is the claim-check pattern: put the payload in S3 and pass a pointer. The Extended Client Library implements it transparently for Java. The message size limit is not adjustable, manual chunking makes the consumer responsible for ordering and reassembly, and attributes count toward the same 256 KB.

Managing large Amazon SQS messages
Question 28Deployment

A data science team needs to deploy a Lambda function whose dependencies total 4 GB — far beyond the deployment package limits for .zip archives and layers. What should the developer do?

  • APackage the function as a container image of up to 10 GB, push it to Amazon ECR, and create the function from that image.
  • BSplit the dependencies across five Lambda layers.
  • CDownload the dependencies from S3 into /tmp during each cold start.
  • DRequest a quota increase for the 250 MB unzipped package limit.

Correct answer: A Package the function as a container image of up to 10 GB, push it to Amazon ECR, and create the function from that image.

Container image support raises the limit to 10 GB and is the intended path for heavy runtimes such as machine learning libraries; the image must live in ECR and include the Lambda runtime interface client. Layers share the same 250 MB unzipped quota, so five of them do not help. Downloading gigabytes into /tmp lengthens every cold start, and the package quota is not adjustable.

Creating Lambda functions from container images
Question 29Development with AWS Services

An order workflow in AWS Step Functions calls a payment API that sometimes returns a transient 503. The workflow must retry a few times with growing delays, and if it still fails, run a compensation state instead of failing the execution.

  • AAdd a Retry block with IntervalSeconds, MaxAttempts and BackoffRate to the task state, plus a Catch block routing to the compensation state.
  • BWrap the call in a Wait state and duplicate the task three times in the state machine.
  • CEnable Step Functions Express Workflows, which retry failed tasks automatically.
  • DHandle the retries inside the Lambda function code and let the state machine fail fast.

Correct answer: A Add a Retry block with IntervalSeconds, MaxAttempts and BackoffRate to the task state, plus a Catch block routing to the compensation state.

Retry and Catch are built into task states: Retry defines attempts, initial interval and backoff rate for matching error names, and Catch redirects to another state when retries are exhausted. Copying the task three times duplicates logic. Express workflows change execution semantics and pricing, not automatic retries. Retrying inside the function hides the failures from the state machine and burns Lambda duration.

Error handling in Step Functions
Question 30Development with AWS Services

Amazon ECS tasks on AWS Fargate run across several Availability Zones and all need read/write access to the same set of files, which must survive task restarts.

  • AMount an Amazon EFS file system as a volume in the task definition.
  • BUse a bind mount backed by the container instance's local disk.
  • CAttach an Amazon EBS volume to every task.
  • DStore the files in the container image and rebuild it on every change.

Correct answer: A Mount an Amazon EFS file system as a volume in the task definition.

EFS is the shared, durable file system that Fargate tasks can mount across Availability Zones, and the data outlives individual tasks. Bind mounts and the container filesystem are ephemeral. There is no per-task EBS attachment on Fargate for shared multi-AZ access, and baking files into the image makes every change a redeploy.

Amazon EFS volumes for Amazon ECS
Question 31Troubleshooting and Optimization

An ECS service behind an Application Load Balancer struggles during unpredictable traffic spikes: response times climb and some requests time out. The team wants capacity to follow demand automatically.

  • AConfigure ECS service auto scaling with a target tracking policy on ALBRequestCountPerTarget or average CPU utilization.
  • BIncrease the desired count permanently to the peak level.
  • CEnable the deployment circuit breaker on the service.
  • DIncrease the load balancer's idle timeout.

Correct answer: A Configure ECS service auto scaling with a target tracking policy on ALBRequestCountPerTarget or average CPU utilization.

Service auto scaling with target tracking adjusts the task count to hold a metric near a target — request count per target is the natural signal for spiky HTTP traffic. Running at peak all the time wastes money. The circuit breaker handles failed deployments. A longer idle timeout hides slow responses rather than adding capacity.

Amazon ECS service auto scaling
Question 32Deployment

A company must deploy the same application revision to EC2 instances and to physical servers in its own data centre using AWS CodeDeploy. What is required for the on-premises servers?

  • AInstall the CodeDeploy agent, register each server as an on-premises instance with an IAM identity, and tag the registered instances.
  • BInstall the CodeDeploy agent only — on-premises servers are discovered automatically.
  • CConnect the data centre with AWS Direct Connect, which registers the servers for CodeDeploy.
  • DUse AWS Systems Manager hybrid activations; CodeDeploy cannot target on-premises servers.

Correct answer: A Install the CodeDeploy agent, register each server as an on-premises instance with an IAM identity, and tag the registered instances.

CodeDeploy supports on-premises instances, but each one must be registered with CodeDeploy against an IAM user or role, have the agent installed and configured with those credentials, and carry tags so a deployment group can select it. Nothing is auto-discovered, and Direct Connect is only network connectivity.

Working with on-premises instances for CodeDeploy
Question 33Security

Developers in a second AWS account need to clone and push to an AWS CodeCommit repository that lives in the main account. What is the recommended way to grant this?

  • ACreate a cross-account IAM role in the repository's account with CodeCommit permissions, and let the developers' account assume it.
  • BGenerate Git credentials for an IAM user in the repository account and share them with the other team.
  • CMake the repository public and restrict pushes with a branch policy.
  • DCopy the repository into the second account and sync the two nightly.

Correct answer: A Create a cross-account IAM role in the repository's account with CodeCommit permissions, and let the developers' account assume it.

Cross-account access to CodeCommit uses role assumption: the repository account defines a role with the needed CodeCommit actions and trusts the other account, and developers assume it (with git-remote-codecommit making the credential handling painless). Sharing Git credentials shares one identity and destroys the audit trail. CodeCommit repositories cannot be public, and mirroring creates two sources of truth.

Cross-account access to a CodeCommit repository
Question 34Deployment

A team lead must produce a weekly summary of unit test results from AWS CodeBuild for the whole department, without building a custom parser for the build logs.

  • AAdd a reports section to the buildspec so CodeBuild creates test report groups from the JUnit output, and read the pass/fail trends in the CodeBuild console.
  • BShip the raw build logs to CloudWatch Logs and write a Logs Insights query.
  • CHave each build publish a custom CloudWatch metric with the number of failures.
  • DExport the build history with the CLI and process it in a spreadsheet each week.

Correct answer: A Add a reports section to the buildspec so CodeBuild creates test report groups from the JUnit output, and read the pass/fail trends in the CodeBuild console.

CodeBuild test reporting parses standard formats such as JUnit XML and Cucumber JSON into report groups, showing pass rates, durations and trends with no parsing code. Log queries and custom metrics can approximate this but you build and maintain them. Exporting build history gives outcomes per build, not per test case.

Test reporting with AWS CodeBuild
Question 35Troubleshooting and Optimization

During a sale, a customer-facing checkout Lambda function starts returning TooManyRequestsException while a batch reporting function in the same account is running thousands of concurrent invocations. What should the developer do?

  • ASet reserved concurrency on the checkout function to guarantee it capacity, and cap the reporting function's reserved concurrency.
  • BIncrease the checkout function's memory allocation.
  • CSet provisioned concurrency on the reporting function.
  • DMove the checkout function to a different runtime version.

Correct answer: A Set reserved concurrency on the checkout function to guarantee it capacity, and cap the reporting function's reserved concurrency.

Concurrency is a shared account-level pool, so a noisy function can starve everything else. Reserved concurrency does two things at once: it guarantees that slice for the critical function and it caps the function it is set on — so reserving for checkout and capping reporting fixes both sides. Memory affects speed, not concurrency. Provisioned concurrency removes cold starts and would reserve even more capacity for the batch job. The runtime is irrelevant.

Reserved concurrency for Lambda functions
Question 36Development with AWS Services

A Lambda function must add 10 points to a player's score in DynamoDB, creating the item if the player has no record yet, in a single request.

  • ACall UpdateItem with an ADD or SET expression — it creates the item when the key does not exist.
  • BCall GetItem, then PutItem with the new total.
  • CCall PutItem with a ConditionExpression of attribute_not_exists, then retry with UpdateItem if it fails.
  • DCall BatchWriteItem with both a delete and a put request.

Correct answer: A Call UpdateItem with an ADD or SET expression — it creates the item when the key does not exist.

UpdateItem is an upsert: if no item matches the key it creates one, and an atomic counter expression such as SET score = if_not_exists(score, :zero) + :inc applies the increment server-side in one call. Read-then-write introduces a race between the two calls. The two-step conditional put is the same race with extra requests. BatchWriteItem does not support update expressions.

Atomic counters and UpdateItem
Question 37Development with AWS Services

A lab must copy a DynamoDB table into Amazon S3 for analysis in Amazon Athena. The export must not consume table read capacity or affect production traffic, and the team does not want to write code.

  • AUse DynamoDB export to Amazon S3, which requires point-in-time recovery to be enabled on the table.
  • BRun a Lambda function that scans the table and writes objects to S3.
  • CEnable DynamoDB Streams and process records with Kinesis Data Firehose.
  • DCreate an on-demand backup and download it from the console.

Correct answer: A Use DynamoDB export to Amazon S3, which requires point-in-time recovery to be enabled on the table.

Export to S3 reads from the continuous backup rather than the table, so it costs no read capacity and does not touch live traffic; PITR must be on, and the output is DynamoDB JSON or Ion that Athena can query. Scanning consumes capacity. Streams carry ongoing changes, not a full snapshot. On-demand backups can only be restored into DynamoDB, not downloaded.

Exporting DynamoDB table data to Amazon S3
Question 38Security

An API Gateway REST API must accept a bearer token issued by the company's existing third-party identity provider, validate it, and derive per-caller permissions. Which authorization option fits?

  • AA Lambda authorizer that validates the token and returns an IAM policy document.
  • BA Cognito user pool authorizer.
  • CIAM authorization with SigV4-signed requests.
  • DAn API key attached to a usage plan.

Correct answer: A A Lambda authorizer that validates the token and returns an IAM policy document.

A Lambda authorizer is the extension point for tokens API Gateway does not understand natively: your code validates the token however the provider requires and returns an allow/deny policy, which API Gateway caches. Cognito authorizers only accept user pool tokens. SigV4 requires AWS credentials rather than a third-party token. API keys identify a client for throttling and metering and are not authentication.

API Gateway Lambda authorizers
Question 39Security

After a security review, a company must keep a reliable record of every GetObject and PutObject call against a sensitive S3 bucket, including the caller identity, for use in investigations.

  • AEnable AWS CloudTrail data events for that bucket.
  • BEnable S3 server access logging on the bucket.
  • CEnable S3 Storage Lens on the account.
  • DTurn on CloudWatch request metrics for the bucket.

Correct answer: A Enable AWS CloudTrail data events for that bucket.

Object-level API activity is captured by CloudTrail data events, which record the identity, action, resource and time and are delivered reliably for audit use. Server access logging is best-effort with delayed, sometimes incomplete delivery, and AWS recommends CloudTrail when the logs matter for security. Storage Lens and request metrics report usage statistics, not individual calls.

Logging Amazon S3 API calls with CloudTrail
Question 40Development with AWS Services

A gift-voucher transfer must never be applied twice, even if the producer retries the same request within a few minutes, and transfers for one account must be processed in order.

  • AUse an SQS FIFO queue with a message group ID per account and a message deduplication ID per transfer.
  • BUse an SQS standard queue and check a processed-IDs table before each transfer.
  • CUse an SNS standard topic with an SQS subscription.
  • DUse an SQS standard queue with the delay seconds set to 300.

Correct answer: A Use an SQS FIFO queue with a message group ID per account and a message deduplication ID per transfer.

FIFO queues give exactly-once processing within a five-minute deduplication window — a repeated deduplication ID is simply discarded — and message group IDs keep strict order per account while still allowing different accounts to be processed in parallel. Deduplicating by hand in a table is the workaround for standard queues, which are at-least-once. SNS standard fan-out and delay seconds address neither ordering nor duplicates.

Amazon SQS FIFO queue deduplication
Question 41Security

An application on EC2 instances in Account A must read objects from an S3 bucket owned by Account B. The security team forbids storing any long-lived credentials on the instances.

  • ACreate a role in Account B that trusts the instance role in Account A and grants the S3 permissions, then have the application call sts:AssumeRole and use the temporary credentials.
  • BCreate an IAM user in Account B and put its access keys in the instance user data.
  • CAdd the Account A instance role to a security group in Account B.
  • DEnable S3 Transfer Acceleration on the bucket in Account B.

Correct answer: A Create a role in Account B that trusts the instance role in Account A and grants the S3 permissions, then have the application call sts:AssumeRole and use the temporary credentials.

Cross-account access without stored secrets is exactly what role assumption is for: the trusting account defines the role and permissions, and the instance role assumes it through STS for short-lived credentials. Access keys in user data are long-lived secrets in plaintext. Security groups control network traffic and cannot reference IAM principals. Transfer Acceleration is a performance feature.

Cross-account access with IAM roles
Question 42Troubleshooting and Optimization

A public API served by API Gateway and Lambda returns the same daily dataset to unauthenticated callers. Traffic has grown and Lambda costs are rising, although the underlying data changes only once per day.

  • AEnable API Gateway stage caching with a TTL, so repeated requests are served without invoking the backend.
  • BIncrease the Lambda function's memory to shorten each invocation.
  • CAdd reserved concurrency to the Lambda function.
  • DMove the Lambda function into a VPC to reduce network latency.

Correct answer: A Enable API Gateway stage caching with a TTL, so repeated requests are served without invoking the backend.

Caching at the API Gateway stage returns responses for identical requests straight from the cache, which cuts both latency and the number of Lambda invocations you pay for — ideal for data that changes daily. More memory lowers duration but every request still invokes the function. Reserved concurrency caps or guarantees capacity without reducing cost. A VPC adds networking, not speed.

Enabling API caching in API Gateway
Question 43Development with AWS Services

A DynamoDB table uses `orderId` as the partition key. A new screen must list orders by `customerId` and date range. The table already holds millions of items and the new query pattern must not require changing the existing key schema.

  • ACreate a global secondary index with `customerId` as the partition key and `orderDate` as the sort key.
  • BCreate a local secondary index with `customerId` as the partition key.
  • CScan the table with a filter expression on `customerId`.
  • DRecreate the table with a composite key of `customerId` and `orderDate`.

Correct answer: A Create a global secondary index with `customerId` as the partition key and `orderDate` as the sort key.

A GSI can use a completely different partition and sort key, and it can be added to an existing table. A local secondary index must keep the table's partition key and can only be created when the table is created. Scanning reads every item, and recreating the table means a migration the question rules out.

Global secondary indexes in DynamoDB
Question 44Development with AWS Services

Every image uploaded to an S3 bucket must automatically produce a thumbnail. The solution should run only when an upload happens and require no servers.

  • AConfigure an S3 event notification for s3:ObjectCreated:* that invokes a Lambda function.
  • BRun a cron job on EC2 that lists the bucket every minute and processes new keys.
  • CEnable S3 Versioning and process versions in batches nightly.
  • DUse S3 Batch Operations on a schedule.

Correct answer: A Configure an S3 event notification for s3:ObjectCreated:* that invokes a Lambda function.

S3 event notifications invoke Lambda (or SNS/SQS/EventBridge) as objects are created, so processing happens within seconds and nothing runs while the bucket is idle. Polling costs money around the clock, and batch approaches add delay.

Amazon S3 Event Notifications
Question 45Development with AWS Services

A team is building a simple proxy API to a Lambda function. They want the lowest latency and cost, and they do not need API keys, request validation, WAF integration or private endpoints.

  • AAn API Gateway HTTP API
  • BAn API Gateway REST API
  • CAn Application Load Balancer with a Lambda target
  • DAn API Gateway WebSocket API

Correct answer: A An API Gateway HTTP API

HTTP APIs are the cheaper, lower-latency option for straightforward proxying to Lambda. REST APIs cost more and exist for the richer feature set — API keys and usage plans, request validation, WAF, private endpoints — none of which is needed here. WebSocket APIs are for two-way connections.

Choosing between HTTP APIs and REST APIs
Question 46Development with AWS Services

When an order is placed, three separate systems must each receive a copy of the event and process it at their own pace, with no system able to slow the others down.

  • APublish to an Amazon SNS topic with three Amazon SQS queues subscribed, one per system.
  • BWrite to a single SQS queue that all three systems poll.
  • CHave the producer call each system's API in sequence.
  • DWrite the event to S3 and let each system poll the bucket.

Correct answer: A Publish to an Amazon SNS topic with three Amazon SQS queues subscribed, one per system.

The fan-out pattern gives each consumer its own queue, so a slow or broken consumer only backs up its own queue and can retry independently. With one shared queue each message goes to a single consumer. Calling APIs in sequence couples the producer to all three systems.

Common Amazon SNS scenarios: fanout
Question 47Development with AWS Services

A Lambda function must run every weekday at 06:00 UTC to generate a report. What is the standard way to schedule it?

  • AAn Amazon EventBridge rule with a cron schedule expression targeting the function.
  • BA `while` loop inside the function with a sleep statement.
  • CAn SQS delay queue with a 24-hour delay.
  • DAn EC2 instance running crontab that invokes the function.

Correct answer: A An Amazon EventBridge rule with a cron schedule expression targeting the function.

EventBridge scheduled rules (or EventBridge Scheduler) support cron and rate expressions and invoke the function directly — serverless, with no infrastructure. Lambda has a 15-minute maximum runtime so loops cannot span days, SQS delays cap at 15 minutes, and an EC2 cron host is a server to maintain.

Schedule expressions for EventBridge rules
Question 48Development with AWS Services

An audit service must react to every insert, update and delete in a DynamoDB table, in the order the changes happened for a given item.

  • AEnable DynamoDB Streams on the table and attach a Lambda function as an event source.
  • BQuery the table every minute for items with a recent `updatedAt` value.
  • CEnable point-in-time recovery and compare restores.
  • DUse a DynamoDB global secondary index on `updatedAt`.

Correct answer: A Enable DynamoDB Streams on the table and attach a Lambda function as an event source.

DynamoDB Streams captures item-level changes in order per partition key and Lambda can consume them within seconds. Polling misses deletes and intermediate states entirely. PITR is a backup feature, and an index does not deliver change events.

DynamoDB Streams and AWS Lambda triggers
Question 49Development with AWS Services

A developer adds ElastiCache in front of a database. The application should read from the cache and, on a miss, read the database and populate the cache. Which strategy is this, and what is its main drawback?

  • ALazy loading — data in the cache can become stale, and every cache miss costs an extra round trip.
  • BWrite-through — every write is slower because it updates the cache too.
  • CWrite-behind — writes can be lost if the cache fails before flushing.
  • DRead-through with TTL — the cache never holds stale data.

Correct answer: A Lazy loading — data in the cache can become stale, and every cache miss costs an extra round trip.

Reading the cache first and filling it on a miss is lazy loading (cache-aside). Only requested data is cached, but entries go stale unless a TTL or an explicit invalidation is added, and the first request after a miss pays for both lookups. Write-through keeps the cache fresh at the cost of slower writes.

ElastiCache caching strategies
Question 50Development with AWS Services

Twelve Lambda functions share the same 40 MB of helper libraries. The team wants to stop bundling that code into every deployment package.

  • APublish the libraries as a Lambda layer and attach the layer to each function.
  • BUpload the libraries to S3 and download them at the start of each invocation.
  • CCreate a twelve-function CloudFormation macro.
  • DIncrease each function's memory so the larger package loads faster.

Correct answer: A Publish the libraries as a Lambda layer and attach the layer to each function.

A layer is a shared archive that Lambda extracts into /opt for any function that references it, so shared code is deployed and versioned once. Downloading from S3 per invocation adds latency and cost to every call. The other options do not address packaging.

Working with Lambda layers
Question 51Security

A policy must allow an IAM user to terminate EC2 instances only when they have signed in with multi-factor authentication. What should be added to the policy?

  • AA Condition with `aws:MultiFactorAuthPresent` set to true
  • BA Condition with `aws:SecureTransport` set to true
  • CA Principal element naming the IAM user
  • DA NotAction element listing ec2:TerminateInstances

Correct answer: A A Condition with `aws:MultiFactorAuthPresent` set to true

`aws:MultiFactorAuthPresent` is the global condition key that tests whether MFA was used for the request. `aws:SecureTransport` checks for TLS. Principal appears in resource-based policies rather than identity policies, and NotAction would allow everything except that action.

AWS global condition context keys
Question 52Security

An application must encrypt a 100 MB file with a KMS key. What actually happens, given that KMS cannot directly encrypt data that large?

  • AThe application calls GenerateDataKey, encrypts the file locally with the plaintext data key, stores the encrypted data key alongside the file, and discards the plaintext key — envelope encryption.
  • BKMS streams the file through its API and returns the ciphertext.
  • CThe file must be split into 4 KB chunks and each chunk sent to KMS separately.
  • DKMS keys cannot be used for files; only Secrets Manager can encrypt them.

Correct answer: A The application calls GenerateDataKey, encrypts the file locally with the plaintext data key, stores the encrypted data key alongside the file, and discards the plaintext key — envelope encryption.

KMS Encrypt is limited to 4 KB, so larger data uses envelope encryption: GenerateDataKey returns a plaintext key and an encrypted copy of it, you encrypt locally with the plaintext key, keep the encrypted key with the data, and decrypt it through KMS later. The AWS Encryption SDK and services such as S3 do this for you.

Envelope encryption in AWS KMS
Question 53Security

An S3 bucket must be allowed to invoke a Lambda function on object upload. Which permission is required, and where does it go?

  • AA resource-based policy on the Lambda function allowing s3.amazonaws.com to call lambda:InvokeFunction, with a source ARN condition.
  • BAn `s3:GetObject` statement added to the function's execution role.
  • CAn IAM user with programmatic access shared with the S3 service.
  • DA bucket policy allowing lambda:InvokeFunction.

Correct answer: A A resource-based policy on the Lambda function allowing s3.amazonaws.com to call lambda:InvokeFunction, with a source ARN condition.

The execution role controls what the function may do; a resource-based policy controls who may invoke it. For an S3 trigger you add a permission statement on the function for the S3 service principal, scoped by source ARN. The function separately needs s3:GetObject in its execution role to read the object.

Using resource-based policies for Lambda
Question 54Security

A subscriber-only video course delivers dozens of files per lesson through CloudFront. Access must be restricted per subscriber without generating a separate signed link for every file.

  • AUse CloudFront signed cookies, which grant access to multiple restricted files matching a path pattern.
  • BUse a CloudFront signed URL for each file.
  • CRestrict the distribution by IP address for each subscriber.
  • DMove the files to a public bucket and obfuscate the file names.

Correct answer: A Use CloudFront signed cookies, which grant access to multiple restricted files matching a path pattern.

Signed cookies are the documented answer when you want to grant access to many files at once and keep existing URLs unchanged; signed URLs are for individual files. IP restrictions break for mobile users, and obfuscated names in a public bucket are not access control.

Choosing signed URLs or signed cookies
Question 55Security

A Lambda function stores a third-party API key in an environment variable. Security asks that the value not be readable in plaintext by anyone who can view the function configuration.

  • AEnable helpers for encryption in transit so the variable is encrypted with a customer managed KMS key and decrypted in code at runtime.
  • BRely on the default encryption at rest, which already hides the value in the console.
  • CBase64-encode the value before saving it.
  • DMove the value into the function's description field.

Correct answer: A Enable helpers for encryption in transit so the variable is encrypted with a customer managed KMS key and decrypted in code at runtime.

Lambda always encrypts environment variables at rest, but the console shows the decrypted value to anyone with GetFunctionConfiguration. Using a customer managed key with the encryption helpers keeps the stored value ciphertext, so it can only be read by a principal allowed to use the key. Base64 is encoding, not encryption.

Securing Lambda environment variables
Question 56Security

A mobile app must call an API Gateway REST API using credentials that expire, and the backend must know which end user made each call. Which flow is correct?

  • AThe user signs in to a Cognito user pool; the app sends the ID or access token to a Cognito authorizer on the API.
  • BThe app ships an IAM access key pair and signs each request.
  • CThe app sends the API key from a usage plan as the user identity.
  • DThe app calls the API anonymously and passes the user ID in a query string.

Correct answer: A The user signs in to a Cognito user pool; the app sends the ID or access token to a Cognito authorizer on the API.

A Cognito user pool authorizer validates the token API Gateway receives and passes the user claims to the backend, and tokens expire on their own. Embedding IAM keys in a mobile app leaks them. API keys identify an application for throttling, not a user, and a user ID in a query string can be set to anything.

Control access with a Cognito user pool authorizer
Question 57Deployment

In AWS CodePipeline, how does the output of a build stage reach the deploy stage?

  • AAs an output artifact stored in the pipeline's S3 artifact bucket, which the next action declares as its input artifact.
  • BIt is passed in memory between stages by the CodePipeline service.
  • CEach stage rebuilds the source from the repository.
  • DThe build stage pushes directly to the deployment target.

Correct answer: A As an output artifact stored in the pipeline's S3 artifact bucket, which the next action declares as its input artifact.

Actions exchange artifacts through the pipeline's S3 bucket: one action writes an output artifact and the next names it as an input. That is why the pipeline needs an artifact bucket and, for cross-account pipelines, a shared KMS key.

CodePipeline input and output artifacts
Question 58Deployment

A developer wants to test a Lambda function and its API locally before deploying, using the same template that will be deployed.

  • AUse the AWS SAM CLI: `sam build`, then `sam local invoke` or `sam local start-api`.
  • BDeploy to a `dev` stage after every code change and test in the cloud.
  • CRun the handler with `node index.js` and mock every AWS SDK call by hand.
  • DUse CloudFormation change sets to preview the function's behaviour.

Correct answer: A Use the AWS SAM CLI: `sam build`, then `sam local invoke` or `sam local start-api`.

The SAM CLI runs functions in a local container that mimics the Lambda runtime and can emulate API Gateway, so the feedback loop is seconds and the template is the one you deploy. Change sets preview infrastructure changes, not code behaviour.

Testing Lambda functions locally with AWS SAM
Question 59Deployment

In an AWS CodeDeploy deployment to EC2 instances, which file defines the deployment lifecycle event hooks such as BeforeInstall and ApplicationStart, and where must it be?

  • Aappspec.yml in the root of the application revision bundle
  • Bbuildspec.yml in the root of the source repository
  • Ctemplate.yaml alongside the CloudFormation stack
  • DDockerfile in the application directory

Correct answer: A appspec.yml in the root of the application revision bundle

CodeDeploy reads appspec.yml (appspec.yaml for ECS/Lambda) from the root of the revision to learn which files to copy where and which scripts to run at each lifecycle event. buildspec.yml belongs to CodeBuild.

CodeDeploy AppSpec file reference
Question 60Deployment

A team wants to release a new version of an API Gateway stage to 10% of requests, watch metrics, then promote it — without creating a second stage.

  • AEnable a canary release on the stage and set the percentage of traffic sent to the canary deployment.
  • BCreate a second stage and split traffic with Route 53 weighted records.
  • CDeploy to the same stage and roll back if CloudWatch alarms fire.
  • DUse a stage variable that the integration reads to pick a version.

Correct answer: A Enable a canary release on the stage and set the percentage of traffic sent to the canary deployment.

API Gateway canary releases put a second deployment behind the same stage and send a configured percentage of requests to it, with separate metrics and logs, then promote the canary when it looks healthy. Weighted DNS is coarse and cached by resolvers, and deploying straight to the stage exposes all users at once.

Canary release deployments in API Gateway
Question 61Deployment

A team wants to define AWS infrastructure using TypeScript, with loops, conditionals and reusable classes, and still deploy through CloudFormation.

  • AThe AWS Cloud Development Kit (AWS CDK), which synthesizes CloudFormation templates from code.
  • BHandwritten CloudFormation JSON with the Fn::ForEach intrinsic only.
  • CThe AWS CLI with shell scripts for each resource.
  • DAWS Systems Manager Automation runbooks.

Correct answer: A The AWS Cloud Development Kit (AWS CDK), which synthesizes CloudFormation templates from code.

The CDK lets you write infrastructure in a general-purpose language and produces standard CloudFormation templates at synth time, so you keep drift detection, rollbacks and change sets. Shell scripts around the CLI are imperative with no state tracking.

What is the AWS CDK?
Question 62Deployment

An Elastic Beanstalk application needs an extra package installed and an environment variable set on every instance at deployment time, in a way that lives with the application source.

  • AAdd configuration files with a .config extension in an .ebextensions directory in the source bundle.
  • BLog in to each instance over SSH after deployment and install the package.
  • CCreate a custom AMI for every code change.
  • DAdd the commands to the buildspec.yml file.

Correct answer: A Add configuration files with a .config extension in an .ebextensions directory in the source bundle.

.ebextensions configuration files are versioned with the application and applied by Beanstalk during deployment, so every new instance is configured identically. Manual SSH does not survive scaling, custom AMIs per change are slow, and buildspec.yml belongs to CodeBuild.

Advanced environment customization with .ebextensions
Question 63Troubleshooting and Optimization

A report-generation Lambda function behind API Gateway takes about 45 seconds. Clients receive a 504 error after roughly 29 seconds, although CloudWatch shows the function completing successfully.

  • AAPI Gateway's integration timeout is the limit being hit — return a job ID immediately and process asynchronously, then let the client poll or receive a notification.
  • BIncrease the Lambda function timeout to 60 seconds.
  • CIncrease the Lambda memory to 10 GB.
  • DEnable API Gateway caching on the stage.

Correct answer: A API Gateway's integration timeout is the limit being hit — return a job ID immediately and process asynchronously, then let the client poll or receive a notification.

API Gateway REST APIs have a maximum integration timeout (29 seconds by default), so any synchronous call longer than that fails at the gateway even though the function finishes. The pattern is to accept the request, do the work asynchronously, and let the client retrieve the result. Changing Lambda settings does not move the gateway's limit.

Amazon API Gateway quotas
Question 64Troubleshooting and Optimization

During an incident a developer must find every ERROR entry mentioning a particular order ID across several Lambda log groups from the last three hours, and count them by function.

  • ARun a CloudWatch Logs Insights query across the selected log groups, filtering on the order ID and using stats to group the results.
  • BDownload the log streams and grep them locally.
  • CEnable X-Ray and read the service map.
  • DCreate a metric filter and wait for new data to arrive.

Correct answer: A Run a CloudWatch Logs Insights query across the selected log groups, filtering on the order ID and using stats to group the results.

Logs Insights queries multiple log groups over a time range with filter and stats commands, which is exactly this task. Downloading logs is slow and manual. X-Ray shows latency and traces rather than log text, and a metric filter only applies to events arriving after it is created.

Analyzing log data with CloudWatch Logs Insights
Question 65Troubleshooting and Optimization

A DynamoDB table is throttled even though consumed capacity across the table is well below what is provisioned. CloudWatch shows one partition key receiving most of the traffic.

  • AIt is a hot partition — redesign the partition key to spread requests, for example by adding a random or calculated suffix.
  • BProvision more read capacity units for the table.
  • CSwitch all reads to strongly consistent reads.
  • DAdd a local secondary index on the same partition key.

Correct answer: A It is a hot partition — redesign the partition key to spread requests, for example by adding a random or calculated suffix.

Capacity is spread across partitions, so one very popular key can be throttled while the table looks idle overall. The fix is key design that distributes traffic; write sharding with a suffix is the documented technique. Strongly consistent reads consume more capacity, and an LSI shares the same partition key.

Designing partition keys to distribute workload
Question 66Troubleshooting and Optimization

After a Lambda function is attached to a VPC so it can reach an RDS instance, its calls to Amazon S3 begin timing out. The function code did not change.

  • AA Lambda function in a VPC has no internet access by default — add a gateway VPC endpoint for S3, or route the subnets through a NAT gateway.
  • BIncrease the function's memory so the SDK initializes faster.
  • CAdd s3:GetObject to the function's execution role.
  • DMove the function to a public subnet and assign it an Elastic IP.

Correct answer: A A Lambda function in a VPC has no internet access by default — add a gateway VPC endpoint for S3, or route the subnets through a NAT gateway.

Once a function runs in your VPC, its traffic follows your route tables, and private subnets have no path to the S3 public endpoint. A gateway endpoint for S3 is free and keeps the traffic on the AWS network; a NAT gateway also works but costs more. Lambda ENIs cannot use a public IP, so a public subnet does not help.

Giving Lambda functions access to resources in a VPC

Ready to try it under exam conditions?

Reading answers is not the same as recalling them with a clock running. Take the same 66 questions as a timed mock exam — 130 minutes, no feedback until you submit, then a score broken down by exam domain so you know what to study.

Start the timed DVA-C02 test →