Answers & explanations
DVA-C02 Practice Exam 2: every answer explained.
All 65 questions from this set, with the correct answer marked and a full explanation of why it is right — and why each plausible alternative is not. 7 of them are multi-answer, which the AWS Certified Developer Associate exam uses heavily. Read it as a study sheet, or take the set under timed conditions first and come back.
Every question here is original, written for this site to match the style and difficulty of the real exam. None are reproduced from an actual exam — that would breach the certification agreement and would not teach you anything.
- Q1
A smart-meter provider named Voltline starts an AWS Step Functions Standard workflow named reading-normalize for every meter reading it receives. The workflow validates the payload, converts units in an AWS Lambda function, and writes the result to an Amazon DynamoDB table with a PutItem call keyed on meterId and readingTime. Each execution finishes in under 3 seconds, peak traffic reaches 4,500 new executions per second, StartExecution calls are throttled at peak, and per-state-transition charges dominate the monthly bill.
Every step is safe to run more than once, and nobody looks up an individual execution in the console after it finishes; failure details written to Amazon CloudWatch Logs are enough. Which change handles the peak rate at the lowest cost?
- A Keep the Standard workflow and request higher StartExecution and StateTransition quotas for the account in that Region.
- B Recreate reading-normalize as an asynchronous Express workflow and send its execution history to a CloudWatch Logs log group. Correct
- C Keep the Standard workflow and merge validation, conversion and the database write into a single Task state.
- D Keep the Standard workflow and feed it through Amazon EventBridge Pipes from an SQS queue to smooth the peaks.
Why B
Express workflows are built for high-volume, short-lived executions: they run for up to five minutes, accept far higher start rates than Standard workflows, and are billed by request count and duration instead of per state transition. Asynchronous Express executions are at-least-once, which is acceptable because every step is idempotent, and their history goes to CloudWatch Logs rather than the console, which is what the team wants. Raising the Standard quotas lets executions start but keeps the per-transition pricing that drives the bill. Merging the steps into one Task state trims a few transitions but leaves the Standard start-rate throttling and per-transition billing in place and loses per-step retries. Feeding executions through Pipes from a queue only delays the throttled starts, adding latency without lowering cost.
- Q2
A fitness company is building a React single-page application named stride-web, served from Amazon S3 through CloudFront, and a companion iOS app. Both sign users in with an Amazon Cognito user pool through its managed login pages and then call the company API with the resulting tokens.
A security review rejected the first design, which used the implicit grant and returned tokens in the URL fragment, and it also rejected a proposal to ship the app client secret inside the JavaScript bundle and the iOS binary.
Which configuration lets both apps obtain tokens securely while following current OAuth 2.0 guidance for public clients?
- A Create an app client without a client secret, enable the authorization code grant, and have each app send a PKCE code challenge and later redeem the code with its code verifier. Correct
- B Create an app client with a client secret, enable the authorization code grant, and have each app download the secret at startup from an unauthenticated API before redeeming the code.
- C Keep the implicit grant but shorten the ID and access token validity to five minutes, so that a token leaked from the URL fragment or the browser history expires quickly.
- D Enable the client credentials grant on an app client without a secret, and have each app request tokens directly from the token endpoint with the user's chosen scopes.
Why A
Code running in a browser or on a phone cannot keep a secret, so the recommended flow for these public clients is the authorization code grant with Proof Key for Code Exchange: the app sends a hashed code challenge on the authorize request and proves possession of the matching code verifier when it redeems the code, so an intercepted authorization code is useless, and the app client has no secret to leak. Downloading the secret from an unauthenticated API just hands the secret to anyone who calls that API, which is the same exposure as embedding it. Shortening token lifetimes under the implicit grant still delivers tokens in the URL fragment, where browser history, logs and referrers can capture them, and the implicit grant is no longer recommended. The client credentials grant is for machine-to-machine access, requires a client secret, and issues tokens that represent the app rather than a signed-in user.
- Q3 Choose 2
A logistics startup builds the container image for a Node.js service named route-planner in AWS CodeBuild and pushes it to Amazon ECR, from where Amazon ECS runs it on AWS Fargate. The Dockerfile starts FROM node:22, runs COPY . . to copy the whole repository, then npm ci (which installs the TypeScript compiler and test tools from devDependencies) and npm run build, and finally starts node dist/server.js. The repository holds a 400 MB .git directory, a local node_modules folder and 300 MB of recorded test fixtures. The resulting image is 1.6 GB, and new tasks spend more than a minute pulling it during scale-out.
Which two changes reduce the size of the image that the tasks pull, without changing application code?
- A Add an Amazon ECR lifecycle policy that expires untagged images older than 14 days so the repository holds fewer image versions.
- B Turn on the local Docker layer cache in the CodeBuild project so unchanged layers are reused from earlier builds instead of rebuilt.
- C Use a multi-stage build that compiles in a node:22 stage and copies only dist and production dependencies into a slim runtime stage. Correct
- D Append a final RUN instruction that deletes the TypeScript compiler, test tools and fixtures after the build step has finished.
- E Add a .dockerignore file that excludes .git, node_modules, the test fixtures and local environment files from the build context. Correct
Why C and E
A multi-stage build keeps only the layers of the final stage, so the compiler, devDependencies and full base image stay in a discarded builder stage while the runtime stage ships a slim base, the compiled dist folder and production dependencies. A .dockerignore file keeps .git, node_modules and the fixtures out of the build context, so COPY . . can no longer bake them into a layer. An ECR lifecycle policy only removes old images from the repository to save storage; the image each task pulls is unchanged. The CodeBuild layer cache makes builds faster but produces exactly the same layers. A later RUN that deletes files only adds a layer that hides them, because the earlier layers still contain the files and are still pulled.
- Q4
A print-on-demand company runs an AWS Lambda function named pdf-stitch on python3.13 with 1,024 MB of memory and a 30-second timeout. Two invocations failed overnight. The REPORT line for the first shows Duration 30000.00 ms and Max Memory Used 388 MB. The REPORT line for the second shows Duration 6412.37 ms and Max Memory Used 1024 MB, and the runtime exited before the handler returned. Neither invocation logged an exception from the application code.
Which diagnosis and remedy match the evidence in the two REPORT lines?
- A Both invocations ran out of memory, so raising the memory setting to 2,048 MB fixes both failures because CPU also scales with it.
- B Both invocations timed out, so raising the timeout to 120 seconds fixes both failures without changing the memory setting.
- C The first invocation timed out while using little memory, and the second ran out of memory early, so each one needs a different fix. Correct
- D The first invocation ran out of memory and the second timed out, so the first needs more memory and the second a longer timeout.
Why C
A Duration equal to the configured 30,000 ms with Max Memory Used far below Memory Size is the signature of a timeout, while Max Memory Used equal to Memory Size on an invocation that ended well before the timeout is the signature of an out-of-memory exit, so the first needs a longer timeout or a faster dependency and the second needs more memory or a smaller working set. Raising memory for both treats the first invocation as a memory problem although it used only 388 MB of 1,024 MB. Raising the timeout for both ignores that the second stopped after 6.4 seconds, far inside the limit. Swapping the diagnoses reads each signal backward: the run that hit 30 seconds was not short of memory, and the run that hit 1,024 MB was not near the timeout.
- Q5
A digital archive called Folio Vault stores 4.2 million scanned page images under one prefix of an Amazon S3 bucket named folio-scans. A developer must run an existing AWS Lambda function named page-ocr once against every image and keep a per-image record of success or failure. A first attempt used a Step Functions Standard workflow whose inline Map state iterated over a key list built by another Lambda function; it failed because the list exceeded the 256 KiB state payload limit, and smaller test runs hit the 25,000-event execution history limit.
Which approach processes every image in parallel with the least custom code?
- A Split the key list into chunks of 1,000 keys and start a separate Standard execution with an inline Map for each chunk.
- B Write a Lambda function that lists the prefix and invokes page-ocr asynchronously once for every key that it finds.
- C Use a Distributed Map state with an S3 ItemReader on the prefix, a MaxConcurrency value, and a ResultWriter to S3. Correct
- D Keep the inline Map state, raise its MaxConcurrency to 0, and store the key list in a Pass state Result field instead.
Why C
A Distributed Map state reads its items directly from S3 with an ItemReader, so the 4.2 million keys never pass through the state payload, and it runs each batch of items as a separate child workflow with its own history, so the parent execution stays far below the 25,000-event limit. MaxConcurrency controls how many child workflows run at once (up to 10,000), and a ResultWriter writes per-item success and failure results to S3. Chunking the list into many Standard executions means writing and operating custom splitting and tracking code. A listing-and-invoking Lambda function needs its own pagination, throttling and result tracking, and listing millions of keys and invoking for each risks its 15-minute timeout. An inline Map keeps every iteration in one history, and a Pass state Result is part of the definition and state data, so both limits still apply.
- Q6 Choose 2
A logistics software vendor sells a scheduling app whose web front end signs users in through an Amazon Cognito user pool with managed login, and whose REST API in Amazon API Gateway uses a Cognito user pool authorizer. A large customer, Tidewater Haulage, wants its 2,300 dispatchers to sign in with the corporate identity provider they already use, which supports SAML 2.0, and has sent the vendor its metadata document.
The vendor must never store or handle the dispatchers’ passwords, and the API must keep receiving user pool tokens with no change to its authorizer.
Which two actions should the developer take?
- A Add the corporate SAML provider to a Cognito identity pool as an authentication provider, and give the authenticated role permission to invoke the API.
- B Add a SAML identity provider to the user pool from the customer's metadata document, mapping the email and name assertion attributes to user pool attributes. Correct
- C Enable the SAML provider on the front end's app client, and register the user pool's SAML response URL and entity ID with the customer's identity provider. Correct
- D Create an IAM SAML identity provider from the metadata document, and have the front end call AssumeRoleWithSAML and sign each API request with the returned keys.
- E Configure a user migration Lambda trigger that checks each dispatcher's password against the customer's directory and creates the user in the pool at first sign-in.
Why B and C
A user pool federates a SAML 2.0 identity provider natively: creating the SAML provider in the pool from the metadata document, with attribute mapping from assertion attributes to user pool attributes, lets Cognito create a federated user and issue its own ID and access tokens, so the existing user pool authorizer keeps working. The provider must then be enabled on the app client so managed login offers it, and the customer's identity provider must trust the pool by registering its saml2/idpresponse URL and its urn:amazon:cognito:sp entity ID. An identity pool with a SAML provider issues temporary AWS credentials, not user pool tokens, so the authorizer would reject the requests. AssumeRoleWithSAML likewise returns IAM credentials for SigV4 signing, which a Cognito authorizer does not accept. A user migration trigger receives each password through Cognito, which breaks the rule that the vendor never handles them, and it is a one-time migration rather than single sign-on.
- Q7
A publishing company runs a Django application named newsroom-cms on AWS Elastic Beanstalk, on the Python 3.13 running on 64bit Amazon Linux 2023 platform branch. On every application deployment, each instance must run python manage.py collectstatic and python manage.py compilemessages. Both commands import Django, so they can run only after the platform has installed the packages listed in requirements.txt, and they must finish before the new version replaces the running one, so that a failing command aborts the deployment while the old version keeps serving.
The team wants to keep both commands in one shell script inside the source bundle.
Where in the source bundle should the team place the script so that Elastic Beanstalk runs it at the correct point of each application deployment?
- A In an .ebextensions configuration file, as an entry in the commands section that calls the script.
- B In the .platform/hooks/prebuild directory, as an executable script whose first line is #!/bin/bash.
- C In the Procfile, as an additional named process that runs the script alongside the web process.
- D In the .platform/hooks/predeploy directory, as an executable script whose first line is #!/bin/bash. Correct
Why D
On Amazon Linux 2023 platforms, files in .platform/hooks/predeploy run after the platform has set up the application, including the requirements.txt packages, and before the new version moves to its final location, and a nonzero exit aborts the deployment. Hooks in .platform/hooks/prebuild run before the application is set up, so Django is not installed yet. The commands section of an .ebextensions file runs earlier still, before the application and web server are set up; only its container_commands section runs after setup in the staging directory, just before predeploy hooks, and would also work, but platform hooks are the mechanism these platforms recommend: a plain executable file with no YAML wrapper. A Procfile entry defines a long-running process started after deployment, so a one-off script would run too late and be relaunched whenever it exits.
- Q8
A hospital pharmacy system publishes MedicationOrder events whenever a prescription is created, amended or canceled. A dispensing-robot controller, a billing service and an audit archive each consume the events from their own Amazon SQS FIFO queue. For any one prescription, every consumer must apply events in the order they were published, and a producer retry after a network timeout must never cause a consumer to process the same amendment twice. Today the producer calls SendMessage once per queue, and partial failures leave the three queues out of step.
Which design delivers each event to all three consumers in order and without duplicates, with the least producer code?
- A Publish to an SNS standard topic and subscribe the three existing SQS FIFO queues to it with raw message delivery turned on.
- B Publish to an SNS FIFO topic with content-based deduplication and prescription ID as the group ID, and subscribe the three FIFO queues. Correct
- C Publish to an SNS FIFO topic and replace the three FIFO queues with SQS standard queues that are subscribed to the topic.
- D Publish to an Amazon EventBridge custom event bus with one rule per consumer that targets that consumer's FIFO queue.
Why B
An SNS FIFO topic orders messages within each message group and deduplicates publishes within a five-minute window, using content-based deduplication or an explicit deduplication ID, so a retried Publish of the same event is accepted but not delivered again,, and it delivers to subscribed SQS FIFO queues in that same order, so one Publish call reaches all three consumers in prescription order. Using the prescription ID as the group keeps each prescription ordered while different prescriptions flow in parallel. An SNS standard topic cannot have SQS FIFO queues subscribed to it, so that design cannot be built. SNS FIFO topics can deliver to SQS standard queues, but standard queues offer best-effort ordering and at-least-once delivery, losing both guarantees at the consumer. EventBridge does not guarantee delivery order across events, so rules targeting the queues can enqueue amendments out of sequence.
- Q9
A brokerage runs an AWS Lambda function named quote-engine whose traffic climbs from about 2,000 invocations an hour overnight to 60,000 an hour after the market opens. A CloudWatch alarm on the Errors metric with the Sum statistic and a threshold of 50 per 5 minutes fires every morning, even though only about 0.1 percent of invocations fail. The on-call rotation has started ignoring it.
The team wants to be paged only when more than 2 percent of invocations fail in a 5-minute period, at any traffic level.
Which alarm configuration meets this requirement?
- A An anomaly detection alarm on the Errors metric with the Sum statistic, so the expected band learns the daily traffic pattern and widens each morning.
- B A composite alarm that enters ALARM only when an alarm on Errors above 50 and an alarm on Invocations above 5,000 are both in ALARM.
- C A metric math expression of 100 times Errors divided by Invocations, both with the Sum statistic over 5 minutes, alarming above 2. Correct
- D An alarm on the Errors metric with the Sum statistic and the threshold raised to 1,200 per 5 minutes, sized for the morning peak.
Why C
A metric math expression that divides the Sum of Errors by the Sum of Invocations over the same period yields the failure percentage directly, so the threshold of 2 means the same thing at 2,000 invocations an hour as at 60,000, and the alarm evaluates the expression rather than either raw metric. Anomaly detection still models the raw error count, so it judges whether the count is unusual for the time of day, not whether more than 2 percent of calls failed. A composite alarm only combines the states of other alarms with AND, OR and NOT; it cannot compute a ratio, and both child alarms still use raw thresholds. Raising the count threshold to 1,200 silences the mornings but lets an overnight failure rate of 50 percent pass unnoticed, because 1,000 errors in 2,000 calls never reaches it.
- Q10
A media company runs a REST service named catalog-svc on Amazon ECS. The service validates Amazon Cognito user pool JWTs itself with the aws-jwt-verify library, and it allows a write only when the token grants the custom scope catalog/write, which is defined on a resource server in the user pool.
The browser app signs in through managed login with the authorization code grant and receives an ID token, an access token and a refresh token. It currently sends the ID token in the Authorization header, and every write is rejected because the token has no scope claim, although the user's email and cognito:groups claims are present.
Which token should the app send to catalog-svc for authorization, without adding any Lambda triggers?
- A The ID token, after configuring the app client to request the catalog/write scope, so that the granted scope is added to the claims of the ID token.
- B The access token, because it carries the scope and client_id claims and a token_use of access, marking it as the token meant for authorizing API calls. Correct
- C The refresh token, because it stays valid for 30 days and the service can present it to the token endpoint to look up the user's granted scopes on each request.
- D The ID token, because its aud claim equals the app client ID, which lets the service confirm that the token was issued for this particular application.
Why B
The access token is the one meant for resource servers: it carries the granted OAuth scopes, including custom resource server scopes such as catalog/write, plus client_id and token_use set to access, and libraries such as aws-jwt-verify check exactly those claims when configured for access tokens. Requesting the scope on the app client does not put it into the ID token, because Cognito writes scopes only to the access token, and the ID token describes who the user is for the client app. The refresh token is an opaque, encrypted value that only the Cognito token endpoint can read, so the service cannot validate it locally, and redeeming it on every request would mint new tokens rather than authorize a call. The ID token's aud claim does identify the app client, but that proves which app the user signed in to, not what the caller is permitted to do, and it still contains no scope.
- Q11
A fintech team runs a nightly reconciliation job named ledger-sync as a standalone Amazon ECS task on AWS Fargate with the Linux platform. Profiling shows that the job needs about 7.5 GB of memory but is mostly I/O-bound, and half a vCPU would be enough. The task definition sets requiresCompatibilities to FARGATE, the task-level cpu to 512 and the task-level memory to 8192, and its single container sets memory to 7680.
The RegisterTaskDefinition call fails with a ClientException stating that no Fargate configuration exists for the given values.
Which change lets the task definition register and run the job at the lowest cost?
- A Keep the task-level values and set the container-level cpu to 512 and memoryReservation to 7680 so the container limits match the task.
- B Remove the task-level cpu and memory values and size the task through the container-level cpu and memory settings only.
- C Keep the task-level memory at 8192 and raise the task-level cpu to 2048, which supports between 4 GB and 16 GB of memory.
- D Keep the task-level memory at 8192 and raise the task-level cpu to 1024, which supports between 2 GB and 8 GB of memory. Correct
Why D
Fargate bills for the task-level size and accepts only fixed CPU and memory pairs: 512 CPU units allow 1 GB to 4 GB, while 1024 units (1 vCPU) allow 2 GB to 8 GB, so 1024 with 8192 is the smallest valid size that still gives the job its 7.5 GB, and the 7,680 MiB container limit fits inside it. Changing only the container-level cpu and memoryReservation leaves the invalid 512/8192 task-level pair in place, so registration still fails. Fargate requires task-level cpu and memory, so a definition that sizes only its containers is rejected for the FARGATE launch type. A task-level cpu of 2048 with 8 GB is also a valid pair and would run, but it pays for twice the vCPU the job needs, which fails the lowest-cost requirement.
- Q12
A ticket-resale marketplace runs a Node.js web application on an Amazon EC2 Auto Scaling group behind an Application Load Balancer. Login sessions and shopping carts are held in each instance's memory, so target group stickiness is enabled. During flash sales the group scales from 4 to 30 instances and back, and customers whose instance is terminated during scale-in are logged out and lose their carts. Newly launched instances also receive little traffic for minutes, because existing customers stay pinned to the old ones.
Which change lets any instance serve any request without losing carts during scale-in?
- A Store session and cart data in Amazon ElastiCache or a DynamoDB table keyed by session ID, and turn off target group stickiness. Correct
- B Lengthen the stickiness duration and raise the target group deregistration delay so that sessions drain first.
- C Write session data to a file on an Amazon EBS volume attached to each instance and snapshot the volume hourly.
- D Add a scale-in lifecycle hook that copies the in-memory sessions to a surviving instance before termination completes.
Why A
Moving session and cart state to a shared store such as ElastiCache (Valkey or Redis OSS) or a DynamoDB table keyed by session ID makes every instance interchangeable: any instance can read the session, a terminated instance takes nothing with it, and with stickiness off the load balancer spreads load to new instances immediately. A DynamoDB TTL attribute or a cache TTL can expire abandoned sessions. A longer stickiness duration and deregistration delay only postpone the loss, because in-flight connections drain but the memory holding the sessions is still destroyed at termination, and stickiness keeps starving new instances. An EBS file is still per-instance state, and hourly snapshots do not make it readable by other instances. A lifecycle hook that copies sessions between instances is custom, fragile code that still leaves the tier stateful.
- Q13
A property management SaaS keeps the data of all 1,800 of its landlord customers in shared tables in an Amazon Aurora PostgreSQL database, with a tenant_id column on every table. The API runs on Amazon ECS, connects through a connection pool in which every connection uses one database role named app_rw, which neither owns the tables nor has the BYPASSRLS attribute, and every request already carries a verified tenant ID.
Last month a developer left the tenant_id condition out of a new report query, and one landlord briefly saw another landlord's leases. The company wants the database itself to filter rows by tenant, so that a forgotten condition cannot leak data, without splitting the schema per tenant.
Which approach meets these requirements with the least operational overhead?
- A Enable IAM database authentication and create one database user per tenant, so that each request opens a connection with an authentication token for its own tenant's user.
- B Add a default scope to the ORM models that appends the tenant_id condition to every query, and add a unit test that fails whenever a raw SQL query omits the condition.
- C Create a separate view for each tenant that filters on its tenant_id, and grant each tenant's own database role access to only the views that belong to that tenant.
- D Enable row-level security with a policy on each table comparing tenant_id to current_setting('app.tenant_id'), set per transaction with SET LOCAL by the API. Correct
Why D
PostgreSQL row-level security lets one policy per table restrict every SELECT, UPDATE and DELETE to rows whose tenant_id matches a session setting, and setting app.tenant_id with SET LOCAL scopes the value to the current transaction, so a pooled connection never carries one tenant's value into another request; because app_rw neither owns the tables nor holds BYPASSRLS, the policies apply to it, whereas an owning role would also need FORCE ROW LEVEL SECURITY. IAM database authentication controls who may connect, not which rows a query returns, and 1,800 database users would defeat the shared connection pool. An ORM default scope with a unit test still lives in application code, so a raw query or a missed test reintroduces exactly the leak that occurred. Per-tenant views and roles would mean thousands of views to create and migrate, and the single pooled role app_rw cannot switch to a different role for each request without extra connection handling.
- Q14
A ride-hailing analytics team exposes POST /trip-events on an Amazon API Gateway REST API. The AWS Lambda function behind it does nothing except forward the request body to an Amazon SQS queue named trip-events-intake, from which a separate worker fleet loads a data warehouse. During city-wide events the endpoint jumps from 200 to 9,000 requests per second for a few minutes, the forwarding function hits the account concurrency limit, and the resulting throttles also starve unrelated functions in the account.
Which change absorbs the bursts and removes the forwarding function with the least operational overhead?
- A Set reserved concurrency on the forwarding function so that it can no longer consume the whole account limit.
- B Replace the queue with an Amazon Kinesis data stream and keep the forwarding function writing records to it.
- C Turn on API Gateway stage caching for POST /trip-events so that repeated requests skip the forwarding function.
- D Replace the Lambda integration with an AWS service integration that calls SQS SendMessage using an IAM role. Correct
Why D
A REST API can call SQS directly through an AWS service integration: API Gateway assumes an IAM role allowed to call sqs:SendMessage and a mapping template places the request body in the message, so the queue absorbs the burst and no function concurrency is consumed at all. The worker fleet keeps reading at its own pace. Reserved concurrency protects other functions, but the forwarding function is still capped and returns throttling errors to callers during the spike, and the function still exists to operate. Swapping the queue for a Kinesis data stream keeps the same forwarding function and its concurrency problem, and adds shard management. Stage caching is meant for idempotent reads, and every trip event is a distinct write that must reach the queue, so caching would drop events rather than buffer them.
- Q15
A travel booking site runs an AWS Lambda function named fare-quote on the python3.13 runtime. Amazon API Gateway invokes the function through an alias named live, which points to published version 14. To move to a new pricing service, a developer edited the PRICING_URL environment variable in the Lambda console and saved the change.
An hour later, production requests still go to the old pricing service, while test invocations of the unqualified function in the console use the new one.
Which action makes production use the new pricing service while keeping the alias-based release process?
- A Run update-function-configuration with the version 14 qualifier to set PRICING_URL on that version, so the live alias picks it up.
- B Publish a new version from $LATEST, which captures the updated environment variable, and then point the live alias at that version. Correct
- C Wait for the execution environments of version 14 to be recycled, after which newly started environments read the updated value.
- D Point the API Gateway integration at the unqualified function ARN so that requests run $LATEST and see each saved change.
Why B
A published Lambda version is an immutable snapshot of the code and the configuration, including environment variables, so the console edit changed only $LATEST; publishing a new version captures the new PRICING_URL, and moving the live alias to it switches production without touching API Gateway, while version 14 stays available for rollback. Configuration updates apply only to $LATEST, so a version qualifier cannot be used to edit version 14 in place. Recycled execution environments for version 14 are rebuilt from the same frozen snapshot and keep the old value forever. Pointing the integration at the unqualified ARN would serve the new value, but it abandons the alias, sends every unpublished change straight to production and removes the one-step rollback.
- Q16
An agritech company streams soil-sensor readings into an Amazon Kinesis data stream with four shards and the default 24-hour retention. An AWS Lambda function named telemetry-ingest consumes the stream through an event source mapping with a batch size of 100. Over the last two days the IteratorAge metric, Maximum statistic, has climbed from about 2 seconds to 47 minutes, and dashboards built from the processed data now lag by the same amount. The function reports no Errors and no Throttles, and its average Duration has grown since a new enrichment lookup was added.
What does the rising IteratorAge indicate about this pipeline?
- A Producers are being throttled with ProvisionedThroughputExceeded errors on PutRecords, so new readings reach the stream late.
- B The stream retention period is too short, so records are expiring before the function reads them and the age reflects the gaps.
- C The event source mapping keeps retrying one failing batch, which blocks the shard until the batch succeeds or its records expire.
- D The function processes records slower than they arrive, so each batch is older, and data is lost if the age reaches 24 hours. Correct
Why D
IteratorAge is the age of the last record in each batch the function has just processed, so a steady climb with no errors or throttles means the consumer is falling behind the producers, here because the new enrichment lookup lengthened each invocation; if the age reaches the 24-hour retention period, unread records expire and are lost. Producer throttling would show in the stream's WriteProvisionedThroughputExceeded metric and delays a record before it enters the stream, which IteratorAge does not measure. Expiring records are a future consequence of the lag, not its cause, and the age is still under an hour. A batch retried in a loop would show in the Errors metric, which has stayed at zero.
- Q17
A legal-tech startup offers POST /contracts/analyze on an Amazon API Gateway Regional REST API with a Lambda proxy integration. Analyzing a large contract takes between 2 and 12 minutes and finishes inside the function's 15-minute timeout, but clients receive 504 errors because the integration timeout is at its default of 29 seconds. The company's mobile app also drops its connection regularly when users move between cellular cells during long waits.
Which design lets clients receive their results reliably with the fewest changes to the analysis logic?
- A Return 202 with a job ID after queuing the work, run the analysis asynchronously, and add GET /jobs/{id} for polling. Correct
- B Request an integration timeout increase to 15 minutes so that the synchronous call can wait for the whole contract analysis.
- C Move the endpoint to an HTTP API, whose longer integration timeout covers the full duration of each analysis.
- D Switch the integration to an asynchronous Lambda invocation so that API Gateway responds within the default timeout.
Why A
The asynchronous request/response pattern decouples the client from the long-running work: the POST stores a job record, starts the analysis (for example through a queue, an asynchronous invocation or a Step Functions execution) and immediately returns 202 Accepted with a job ID, and the client polls GET /jobs/{id} until the stored status shows the result. A dropped mobile connection costs nothing, because the result is waiting when the app polls again. The 29-second default is not a ceiling: since June 2024 Regional and private REST APIs can raise it through a quota request (at the cost of account throttle quota), and REST response streaming can keep a response open for up to 15 minutes. Either way, though, each client holds one connection open for up to 12 minutes, so any cellular drop loses the result, which fails the reliability requirement that polling meets with no change to the analysis logic. HTTP APIs cap the integration timeout at 30 seconds. An asynchronous invocation returns quickly but gives the client no job ID or way to fetch the finished analysis.
- Q18
A game studio already uses AWS IAM Identity Center, connected to its corporate directory, for console access to 14 AWS accounts. Its 60 developers also use the AWS CLI and run local scripts with the AWS SDK for Python, and each developer currently has an IAM user with an access key stored in the shared credentials file.
An audit found access keys more than two years old and asked the team to eliminate long-lived developer credentials.
Which approach gives the developers CLI and SDK access with short-term credentials and the least operational overhead?
- A Have each developer run aws configure sso to create a named profile per account and permission set, sign in with aws sso login, and select the profile with AWS_PROFILE. Correct
- B Keep the IAM users, enforce MFA on them, and have each developer call aws sts get-session-token every morning to write temporary keys into a separate named profile.
- C Set up IAM Roles Anywhere with a private certificate authority, issue each laptop an X.509 certificate, and configure its credential helper as a credential_process command.
- D Rotate every developer's access key every 30 days with a scheduled Lambda function that creates a new key pair and emails it to the IAM user's owner.
Why A
Because the studio already runs IAM Identity Center, aws configure sso writes an sso-session and a named profile for each account and permission set, aws sso login opens the corporate sign-in in a browser, and both the CLI and boto3 then obtain role credentials that expire automatically, with no IAM users or access keys left to manage. Requiring MFA with get-session-token still depends on each IAM user keeping a long-lived access key to call it, which is exactly what the audit flagged. IAM Roles Anywhere does issue temporary credentials, but it adds a certificate authority, certificate distribution and renewal, and trust anchors and profiles, duplicating identities that Identity Center already holds. Rotating keys every 30 days leaves long-lived credentials in place, and emailing secret keys creates a new path for them to leak.
- Q19
An online grocer keeps a freeform JSON configuration profile named checkout-limits in the AWS AppConfig hosted configuration store, and a fleet of AWS Lambda functions reads it through the AWS AppConfig Agent Lambda extension. Last month an operator saved a version in which maxBasketItems was the string "fifty" instead of a number and deployed it with an all-at-once strategy, and checkout failed for 20 minutes.
The team wants AppConfig itself to refuse to deploy any version in which maxBasketItems is not an integer from 1 to 200 or a required key is missing, so that a bad version never reaches any function, without changing function code.
Which approach meets these requirements with the least operational overhead?
- A Add a CloudWatch alarm on checkout errors as a deployment monitor so AppConfig rolls the deployment back when the alarm enters ALARM.
- B Replace the all-at-once strategy with a linear strategy and a 30-minute bake time so that a bad version reaches only part of the fleet.
- C Add validation logic to each function that rejects a malformed configuration and keeps using the last configuration that parsed.
- D Attach a JSON Schema validator to the profile that requires maxBasketItems as an integer from 1 to 200 and lists the required keys. Correct
Why D
A configuration profile can carry up to two validators, JSON Schema or Lambda, and AppConfig runs them when StartDeployment is called, so a version that violates the schema's type, minimum, maximum or required rules fails validation and AppConfig refuses to deploy it to any environment, even though saving the hosted version itself succeeds; the schema is declarative and needs no code. An alarm used as a deployment monitor reacts only after the bad version has reached functions and broken enough checkouts to trip the alarm, then rolls back. A linear strategy with bake time limits the blast radius, but some functions still receive the broken version. Validation inside each function changes function code, which the requirement rules out, and it runs after the bad version has already been deployed.
- Q20
A live auction platform named BidHall must push each new bid to every browser watching an auction within one second. The team has built an Amazon API Gateway WebSocket API with $connect, $disconnect and placeBid routes, each backed by an AWS Lambda function. The placeBid function records the bid in an Amazon DynamoDB table, but it has no way to reach the other watchers, whose browsers send nothing after connecting.
How should the developer deliver each new bid to the connected watchers with the least additional infrastructure?
- A Have each browser call placeBid every second with an empty bid so that the reply carries the latest bids.
- B Store connection IDs per auction on $connect, delete them on $disconnect, and POST to each through @connections. Correct
- C Publish each bid to an Amazon SNS topic that has every browser connection ID subscribed as an HTTPS endpoint.
- D Return the bid from placeBid in a route response so that API Gateway broadcasts it to every open connection on the API.
Why B
API Gateway WebSocket APIs give each client a connection ID, and a backend pushes to a client by calling the @connections callback URL for that ID (PostToConnection in the API Gateway Management API) with execute-api:ManageConnections permission. Recording connection IDs per auction on $connect and removing them on $disconnect gives placeBid the list to fan out to, and a 410 GoneException identifies stale IDs to delete. Making browsers send empty bids every second turns the push channel back into polling, multiplies invocations, and a route response is returned only to the caller anyway. A connection ID is not an addressable HTTPS endpoint, so it cannot be subscribed to an SNS topic. A route response goes only to the connection that sent the message; API Gateway has no built-in broadcast to all connections.
- Q21
A freight-billing team runs an Amazon ECS service named ledger-sync that writes unstructured text log lines such as ERROR Failed to post invoice INV-88213 for carrier 4471 after 3 retries to a CloudWatch Logs log group. During an incident the group receives about 40,000 error lines an hour, and almost every line is unique because it embeds invoice numbers, carrier IDs and retry counts. The developers do not yet know which message formats exist.
Which CloudWatch Logs Insights query groups the error lines into recurring message templates and shows how many lines match each, without defining the formats in advance?
- A filter @message like /ERROR/ | pattern @message | sort @sampleCount desc | limit 25 Correct
- B filter @message like /ERROR/ | stats count(*) as lines by @message | sort lines desc
- C filter @message like /ERROR/ | parse @message 'invoice * for carrier *' as inv, carrier | stats count(*) by carrier
- D filter @message like /ERROR/ | dedup @message | fields @timestamp, @message | sort @timestamp desc
Why A
The pattern command clusters log events that share a text structure and replaces the parts that vary, such as invoice numbers and carrier IDs, with tokens, returning each template as @pattern with its @sampleCount and @ratio, so sorting on @sampleCount ranks the recurring messages without any format being declared first. Grouping with stats count(*) by @message treats every distinct line as its own group, and because each line embeds unique IDs the counts are almost all 1. The parse query only extracts fields from lines that match the one format it names, so it counts a single known template and drops everything else. The dedup query removes exact duplicate messages, which barely exist here, and it returns raw lines with no grouping or counts.
- Q22
A developer at a ride-hailing company deploys a container named fare-calc to Amazon ECS on EC2. The task definition sets a task role that allows dynamodb:Query on the FareRules table, and the container instances have an instance profile with permissions only for the ECS agent. The application uses the AWS SDK for Java 2.x with the default credential provider chain and no credentials in code.
Every query fails with AccessDeniedException naming the IAM user ci-builder. Inside a running task, aws sts get-caller-identity also returns ci-builder, the env command shows AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY set by ENV lines in the Dockerfile, and the image contains no .aws directory.
What explains the behavior, and what fixes it without changing application code?
- A The SDK queries the instance metadata service before container credentials, so remove the instance profile from the container instances to let the task role take effect.
- B Move the ci-builder keys from the ENV lines into a shared credentials file in the image, because the chain reads that file only after the task role credentials.
- C The SDK uses container credentials only when the code builds a container provider explicitly, so set AWS_CONTAINER_CREDENTIALS_RELATIVE_URI in the task definition.
- D Environment variables come before container credentials in the default chain, so remove the ENV lines from the Dockerfile and redeploy so the SDK uses the task role. Correct
Why D
The default chain stops at the first provider that returns credentials, and it checks environment variables before the shared profile files, then container credentials, then the instance metadata service, so the ci-builder keys baked into the image win over the task role; removing them lets the chain reach the container credentials endpoint that ECS exposes for the task role. Instance metadata is the last provider, after container credentials, so removing the instance profile changes nothing here and would break the ECS agent. Moving the keys into a shared credentials file in the image changes nothing, because the profile file is also read before container credentials, so the SDK would still sign as ci-builder. ECS already sets AWS_CONTAINER_CREDENTIALS_RELATIVE_URI for every task with a task role, and the default chain uses it without any explicit provider, so setting it again has no effect while the environment keys remain.
- Q23
A healthcare scheduling team has a Python 3.13 AWS Lambda function named slot-reminder whose handler reads appointments from Amazon DynamoDB with a boto3 client and publishes reminders with an Amazon SNS client. Its unit tests currently call a shared development account: they fail in AWS CodeBuild when credentials expire, leave test records behind and take 4 minutes.
The team wants unit tests that run in-process in under a minute with no AWS credentials or network access, return canned DynamoDB responses, and fail if the code sends unexpected parameters to the SNS Publish call.
Which approach meets these requirements with the least additional infrastructure?
- A Wrap the boto3 clients with botocore's Stubber, queue canned responses with expected request parameters, and call assert_no_pending_responses. Correct
- B Start a LocalStack container in the CodeBuild environment and point the boto3 clients at its endpoint through an endpoint URL override.
- C Run the handler with sam local invoke and an event file so that it executes in a local Lambda container instead of the shared account.
- D Give CodeBuild an IAM role in a dedicated test account and delete the records that the tests create in a teardown step after each run.
Why A
botocore's Stubber intercepts calls on a client inside the test process: add_response queues a canned reply together with expected_params, a call with different parameters raises an error, and assert_no_pending_responses proves every expected call happened, all without credentials or network; moto, or aws-sdk-client-mock for JavaScript, fills the same role. LocalStack can emulate both services offline, but it is an extra container that must run beside the tests, and it does not check the parameters sent to Publish. sam local invoke runs the handler in a local Lambda container, yet the SDK calls inside it still go to real AWS endpoints with real credentials. A dedicated test account isolates the data but keeps the network calls, the credential dependency and the slow runs.
- Q24
A food-delivery app uses an AWS AppSync GraphQL API backed by an Amazon DynamoDB data source. Couriers' phones call an updateCourierLocation mutation on the API every few seconds, and the customer app polls a getOrder query every 5 seconds to move the courier marker on a map. Polling has become the largest line on the AppSync bill, and customers see the marker jump in 5-second steps.
Which change pushes location updates only to the customers tracking that order, with the least new infrastructure?
- A Build an API Gateway WebSocket API that a DynamoDB Streams Lambda function uses to push each location change.
- B Send each location change to the customer's phone as an Amazon SNS mobile push notification addressed to its device token.
- C Add a subscription field annotated with @aws_subscribe on the updateCourierLocation mutation, filtered on an orderId argument. Correct
- D Turn on AppSync server-side caching for getOrder so that the repeated polling requests are served from the cache.
Why C
AppSync subscriptions are triggered by mutations made through the same API: annotating a subscription field with @aws_subscribe(mutations: ["updateCourierLocation"]) makes AppSync push each mutation result over its managed WebSocket connection, and an orderId argument (or an enhanced subscription filter) ensures each customer receives only the courier for their order. Because couriers already call the mutation through AppSync, no new service is needed. A separate WebSocket API with a stream-driven function would work, but it duplicates connection management and authorization that AppSync already provides. Mobile push notifications are for user-visible alerts and are not designed for a continuous stream of map coordinates every few seconds. Server-side caching cuts resolver cost but keeps the polling, and cached responses make the marker even staler.
- Q25
A nightly export job named ledger-export runs as an Amazon ECS task on AWS Fargate with the task role export-runner, and it calls AssumeRole for the role finance-reader in another account. The first run failed with AccessDenied, which the developer fixed by adding the export-runner role ARN as a principal in the trust policy of finance-reader.
An export takes about three hours, so the job passes DurationSeconds=14400, and the call now fails with a ValidationError about the requested duration. The MaxSessionDuration of finance-reader is still the default of one hour.
Which change lets the job complete without introducing long-lived credentials?
- A Raise MaxSessionDuration on the export-runner task role to 12 hours, so that the source session lasts long enough to permit a chained session of four hours.
- B Raise MaxSessionDuration on finance-reader to 14,400 seconds and keep requesting DurationSeconds=14400, so that the request fits the role's configured maximum.
- C Create an IAM user in the finance account, keep its access key in Secrets Manager, and call AssumeRole with the user keys so that the 12-hour maximum applies instead.
- D Request a DurationSeconds of 3,600 or less, and have the job assume finance-reader again before each session expires and refresh its SDK clients each time. Correct
Why D
Task role credentials are themselves a role session, so assuming finance-reader with them is role chaining, and IAM caps a chained session at one hour whatever the target role's MaxSessionDuration says; only a first assumption from user credentials and applications on EC2 using instance profiles are exempt. The trust policy fix was right, and the job must now work in hourly sessions, which the SDK's STS assume-role credentials provider handles by refreshing before expiry. Raising the MaxSessionDuration of finance-reader to four hours would admit a 14,400-second request from a non-chained caller, but this chained request still fails. The MaxSessionDuration of the task role does not limit sessions that ECS obtains for the task, and it has no bearing on the chaining cap. An IAM user in the finance account would avoid chaining, but its access key is exactly the long-lived credential the requirement rules out, and storing it in Secrets Manager does not make it temporary.
- Q26
A single-page app served from app.parcelpost.example calls an Amazon API Gateway REST API on a different domain. The Lambda proxy functions return Access-Control-Allow-Origin headers, and successful calls work. When a request fails inside API Gateway itself, however, such as a 401 from the Amazon Cognito authorizer, a 403 for a missing API key, or a 429 from usage plan throttling, the browser reports only a CORS error, so the app cannot read the status code to show a sign-in prompt or a retry message.
Which change lets the app read these error responses with the least effort?
- A Add the Access-Control-Allow-Origin header to the error responses that each Lambda function returns in code.
- B Add Access-Control-Allow-Origin and related headers to the DEFAULT_4XX and DEFAULT_5XX gateway responses. Correct
- C Add an OPTIONS method with a mock integration on every resource that returns the CORS preflight headers.
- D Map 4XX status patterns in each method's integration response to add the CORS headers to error replies.
Why B
Errors raised by API Gateway before or instead of the integration, such as authorizer failures, missing API keys and throttling, are generated from gateway responses, and by default they carry no CORS headers. Adding Access-Control-Allow-Origin (and any other needed CORS headers) to the DEFAULT_4XX and DEFAULT_5XX gateway responses and redeploying the stage applies the headers to every such error at once, so the browser exposes the status code to the app. Adding headers in the Lambda error paths does nothing here, because these requests are rejected before any function runs. An OPTIONS method answers the preflight request only; the actual failed request still returns without the header. Integration response mappings are not used with Lambda proxy integrations, and requests rejected by the authorizer or throttling never reach an integration response.
- Q27
A media company keeps the Amazon EventBridge rules for its video-pipeline event bus in an AWS SAM template in a Git repository. Last week a developer changed a rule's pattern from prefix matching on detail.assetKey to an exact string, the rule stopped matching, and 3,000 uploads went unprocessed until a customer complained.
The team now keeps a folder of sample events, each with id, account, source, time, region, resources and detail-type, labeled as should-match or should-not-match. It wants an AWS CodeBuild step to check every pattern against these samples before the template is deployed, without creating any rules, event buses or targets.
Which approach meets these requirements?
- A Deploy each rule to a temporary event bus with a CloudWatch Logs target, send the samples with PutEvents, and check the log group.
- B Call the EventBridge TestEventPattern API for each pattern and sample, and fail the build when its Result differs from the label. Correct
- C Turn on schema discovery for the event bus, generate code bindings from the discovered schemas, and compile the consumers against them.
- D Run cfn-lint against the SAM template during the build so that it validates each AWS::Events::Rule EventPattern before deployment.
Why B
TestEventPattern takes an event pattern and a sample event, which must include id, account, source, time, region, resources and detail-type, and returns a Result of true or false, so a build script can assert each labeled sample and fail on any mismatch without creating a single resource. Deploying rules to a temporary bus with a log target would test real matching, but it creates exactly the rules, buses and targets the team wants to avoid and adds delivery delays to the build. Schema discovery records the structure of events that arrive on a bus and generates code bindings; it never evaluates a pattern. cfn-lint checks that the template and the EventPattern property are well formed, but it cannot tell whether a pattern matches a given event.
- Q28
A travel-booking site exposes a REST API named fare-search through Amazon API Gateway, with an HTTP integration to a service running on Amazon ECS behind an internal Application Load Balancer and a Lambda TOKEN authorizer on every method. Customers report searches taking over two seconds, and the prod stage's Latency metric shows a p99 of 2,350 ms. The team does not know whether the time is spent in API Gateway processing or in the backend service.
Which approach locates the slow tier using only data that API Gateway already publishes, without enabling new features or redeploying the stage?
- A Turn on execution logging at the INFO level for the stage and read the per-request timing entries that API Gateway writes for each call.
- B Graph IntegrationLatency p99 beside Latency p99 for the stage; a small gap points to the backend, a large one to API Gateway and its authorizer. Correct
- C Compare the Average and p99 statistics of the stage's Latency metric; a wide spread between them shows the delay comes from API Gateway.
- D Compare the stage's CacheHitCount and CacheMissCount metrics; a high miss count shows the requests are waiting on the backend service.
Why B
Latency measures from the moment API Gateway receives the request until it returns the response, while IntegrationLatency covers only the time between relaying the request to the backend and receiving its answer, so the difference between the two at the same percentile is time spent before and after the backend call, and both are published by default. Because every method here uses a Lambda TOKEN authorizer, that gap includes the authorizer function's run time as well as API Gateway's own processing, so a large gap points first at the authorizer, which its own Duration metric can confirm. Execution logging would also expose timings, but enabling it changes the stage configuration and adds logging cost, which the constraint rules out. The spread between Average and p99 Latency describes how the latency is distributed, not which tier contributes it. The cache hit and miss metrics are published only when stage caching is enabled, and even then a miss says nothing about how long the backend took.
- Q29
A ticketing platform publishes order events to an Amazon SNS topic named order-events in us-east-2. A developer subscribed a new standard Amazon SQS queue named loyalty-points, which uses SSE-SQS encryption, to the topic, and the subscription is confirmed, but no messages ever arrive in the queue.
The queue has no access policy yet, and the security team requires that only the order-events topic be able to send messages to it.
Which change delivers the messages while meeting the security requirement?
- A Add a statement to the topic access policy that allows the principal sqs.amazonaws.com to perform sns:Publish, with aws:SourceArn set to the loyalty-points queue ARN.
- B Create an IAM role that trusts sns.amazonaws.com and allows sqs:SendMessage on the queue, and set it as the subscription role on the SQS subscription to the topic.
- C Add a queue policy that allows the principal sns.amazonaws.com to perform sqs:SendMessage, with an ArnEquals condition on aws:SourceArn set to the order-events topic ARN. Correct
- D Add a queue policy that allows the principal sns.amazonaws.com to perform sqs:SendMessage on the queue, and switch its encryption to the AWS managed key aws/sqs.
Why C
SNS delivers to SQS by calling SendMessage as the sns.amazonaws.com service principal, so the queue resource policy must allow that, and an ArnEquals condition on aws:SourceArn limits the grant to the order-events topic, which prevents any other topic, including one in another account, from using SNS to write to the queue. A statement on the topic policy controls who may publish to the topic, and SQS never publishes, so it leaves the queue denying delivery. SNS has no delivery role for SQS endpoints; a subscription role exists for Amazon Data Firehose subscriptions, and delivery to a queue is authorized only by the queue policy. Allowing sns.amazonaws.com without a source condition lets every topic send, and the AWS managed key aws/sqs would break delivery outright, because its key policy cannot be edited to let SNS use the key.
- Q30
A payroll provider sends payout instructions from a Java service to an Amazon SQS FIFO queue named payouts.fifo that has content-based deduplication enabled. Each message body is a JSON document containing the payout ID, the amount, and a sentAt timestamp that the service sets when it builds the message. When a SendMessage call times out, the service's retry wrapper rebuilds the message and sends it again, and the finance team has found employees paid twice for the same payout ID within a minute.
Which change stops these duplicate payouts with the fewest code changes?
- A Set MessageGroupId to the payout ID so that SQS delivers no more than one message for each message group.
- B Raise the queue's DelaySeconds to 60 so that a retried send waits until the first message has been fully processed.
- C Set MessageDeduplicationId to the payout ID on every SendMessage call, overriding content-based deduplication. Correct
- D Turn off content-based deduplication and rely on the FIFO queue's built-in exactly-once processing instead.
Why C
Content-based deduplication derives the deduplication ID from a SHA-256 hash of the message body, and the rebuilt message carries a new sentAt timestamp, so each retry hashes differently and is accepted as new. An explicit MessageDeduplicationId takes precedence over the content hash, so using the payout ID makes SQS accept the retry but not deliver it again within the five-minute deduplication interval. A message group ID controls ordering, not deduplication; every message in a group is still delivered, one after another. A queue delay postpones delivery of both copies equally and removes neither. FIFO exactly-once processing is itself the deduplication mechanism: with content-based deduplication off, every send must supply a deduplication ID, so the change fails or relies on the same missing key.
- Q31
A shipping company runs an AWS Step Functions Standard workflow named shipment-intake. Its Task state EnrichAddress invokes an AWS Lambda function and uses InputPath, Parameters, ResultSelector and ResultPath. After a recent edit, the states after EnrichAddress receive the normalized address under the wrong key. A full execution takes about 20 minutes and calls three partner APIs before it reaches EnrichAddress.
A developer wants to run only EnrichAddress with an input captured from a failed execution and see the data after each input and output processing step, without creating or updating a state machine and without running the earlier states.
Which approach meets these requirements most efficiently?
- A Call the TestState API with the EnrichAddress definition, the captured input and the DEBUG inspection level, then read inspectionData. Correct
- B Start an execution of a copy of the state machine with the captured input and read each state's input and output in the event history.
- C Run the workflow in Step Functions Local with a mocked Lambda response, and compare the output of each state with the expected value.
- D Invoke the Lambda function with sam remote invoke and the captured input, then work out by hand what ResultPath should produce from it.
Why A
TestState runs a single state definition, or one named state from a full definition, with the input provided and without creating or updating a state machine; at the DEBUG level its inspectionData shows the input, afterInputPath, afterParameters, the task result, afterResultSelector and afterResultPath, which pinpoints the field that writes the wrong key. Running a copy of the state machine creates a new resource and starts at the first state, so the 20-minute run and the partner calls happen again. Step Functions Local is unsupported, lacks feature parity, and still needs a local emulator and a full workflow run. Invoking the function with sam remote invoke shows only the raw Lambda response and none of the state's processing, leaving the faulty step to guesswork.
- Q32
A genomics lab runs analysis workers on Amazon ECS that poll an Amazon SQS standard queue named sample-jobs. A job takes anywhere from 90 seconds to 5 hours, and its length cannot be predicted from the message. With a 15-minute visibility timeout, long jobs reappear and are started again by a second worker. Raising the timeout to 6 hours stopped that, but now a job held by a crashed worker stays invisible for up to 6 hours before anyone retries it.
Which approach prevents duplicate processing while letting a crashed worker's job be retried within minutes?
- A Set the visibility timeout to the 12-hour maximum and have workers delete each message as soon as they receive it.
- B Move to an SQS FIFO queue so that a received message cannot be given to a second worker until it is deleted.
- C Add a dead-letter queue with maxReceiveCount set to 1 so that a reappearing job is moved aside, not reprocessed.
- D Keep a short visibility timeout and have workers call ChangeMessageVisibility periodically to extend it while a job runs. Correct
Why D
A visibility heartbeat solves both problems: the worker keeps a short timeout, such as 10 minutes, and while the job is still running it calls ChangeMessageVisibility every few minutes to push the timeout out again, up to 12 hours from the original receipt. A healthy long job never reappears, and a crashed worker stops sending heartbeats, so its message becomes visible within minutes. Deleting messages on receipt removes the duplicate, but a crash then loses the job entirely. FIFO queues use the same visibility timeout model; a message whose timeout lapses becomes available again, so FIFO alone changes nothing. A dead-letter queue with a maxReceiveCount of 1 would move every long-running job aside the moment it reappears, and it would also stop a crashed worker's job from being retried at all.
- Q33
A healthcare analytics team has an AWS Lambda function named claims-normalizer whose execution role was created two years ago with the AmazonS3FullAccess and AmazonDynamoDBFullAccess managed policies attached. A CloudTrail trail records management events and S3 and DynamoDB data events for the account, and the function has run every day for the last 90 days.
A compliance review asks the developer to replace both managed policies with a least-privilege policy that contains only the actions the function has actually used.
Which approach produces a draft policy from the role's real activity with the least manual effort?
- A Run IAM Access Analyzer policy validation on the two attached managed policies, and apply its suggested changes to remove the overly broad actions from the role.
- B Use IAM Access Analyzer policy generation on the execution role with the trail and a 90-day window, then review the draft policy and fill in the resource ARNs. Correct
- C Run the IAM policy simulator against the role for every S3 and DynamoDB action, and keep each action that the simulator reports as allowed for the role.
- D Open the role's last accessed data in the IAM console, and write a new policy by hand from the services and actions that the console lists for the period.
Why B
Access Analyzer policy generation reads the CloudTrail events recorded for a role over a chosen window of up to 90 days and returns a policy listing the actions the role actually called, with resource placeholders to tighten before attaching it, which is the activity-based least-privilege draft the review asks for. Policy validation checks a policy for grammar errors, security warnings and best-practice suggestions; it knows nothing about which actions were used, so it cannot shrink a full-access policy to the used set. The policy simulator reports whether actions are allowed, and with full-access policies attached every action is, so it would keep everything. Last accessed data is real usage information, but turning it into a policy is manual authoring, which the generator already does from the same trail.
- Q34
A developer at a genomics lab runs a provisioning script that uses the AWS SDK for Python (Boto3) to call the Amazon EC2 RunInstances API with an IAM role. The call fails with an UnauthorizedOperation error, and the error text includes a long Encoded authorization failure message. The role's identity-based policy appears to allow ec2:RunInstances, and the account belongs to an organization that applies service control policies. The developer has permission to call sts:DecodeAuthorizationMessage.
Which step reveals the denied action, the resource and whether an explicit deny caused the failure, with the least effort?
- A Simulate the role's policies for ec2:RunInstances with the IAM policy simulator, entering the same AMI, subnet and instance type the script used.
- B Search CloudTrail event history for the failed RunInstances event and read its errorMessage field for the denying policy statement.
- C Retry the RunInstances call with the DryRun parameter set to true and read the extra detail that the dry-run response returns.
- D Pass the encoded message to aws sts decode-authorization-message and read the action, resource, conditions and explicit deny. Correct
Why D
DecodeAuthorizationMessage turns the encoded text that EC2 returns into JSON stating whether the request was allowed, whether an explicit deny matched, and the principal, action, resource and condition key values that were evaluated, which answers all three questions from the failure the developer already has. The policy simulator evaluates the policies it is shown and the request context typed into it, so it can miss the exact tags and condition values the script sent and needs manual setup. CloudTrail records the failed call with an errorCode and errorMessage, but for EC2 that message carries the same encoded blob rather than naming the denying statement. A DryRun call only reports whether the request would have succeeded, returning UnauthorizedOperation again with the same encoded message.
- Q35
A sports-streaming company deploys one AWS CloudFormation template named match-stats to its dev, staging and prod accounts, with a parameter EnvType whose allowed values are dev, staging and prod. Only prod needs an Amazon SNS topic named stats-pager and the CloudWatch alarm that publishes to it, and only in prod must the AWS Lambda function stats-ingest receive the topic ARN in a PAGER_TOPIC_ARN environment variable.
The team must keep a single template for all three environments.
Which template change meets these requirements?
- A Define an IsProd condition with Fn::Equals on EnvType, add Condition: IsProd to the topic and alarm, and pick the variables with Fn::If. Correct
- B Add a Mappings section keyed by EnvType with a CreatePager value of true or false, and read it with Fn::FindInMap on the topic and alarm.
- C Add a Rules section with an assertion that EnvType equals prod for the topic and alarm, so that other environments skip those resources.
- D Move the topic and alarm into a nested stack and pass EnvType to it, so that the nested stack creates them only when the value is prod.
Why A
A condition built with Fn::Equals on EnvType and attached to a resource through its Condition attribute makes CloudFormation create that resource only when the condition is true, and Fn::If on the same condition returns a Variables map containing PAGER_TOPIC_ARN with a Ref to the topic in prod and a map without it elsewhere, which is also the only safe way to reference a resource that may not exist. Mappings return values for properties but cannot decide whether a resource exists, so a CreatePager flag would still create the topic everywhere. A Rules assertion validates parameter values and fails the whole stack operation when it is false; it never skips resources. A nested stack adds a second template and would still need its own condition to skip the resources.
- Q36
A developer is writing a Python boto3 script for a media company's nightly cleanup. The script lists every object under an Amazon S3 prefix that holds about 380,000 objects, then creates a temporary Amazon DynamoDB table named cleanup-tmp and writes a manifest into it. In testing the script only ever finds the first 1,000 objects, and the first PutItem fails with ResourceNotFoundException because the table is still being created. A colleague's draft fix adds a while loop on NextContinuationToken and a sleep-and-retry loop around PutItem.
Which change fixes both problems with the least custom code?
- A Use the list_objects_v2 paginator to iterate every page, and call the table_exists waiter before writing to the table. Correct
- B Pass MaxKeys=500000 to list_objects_v2, and catch ResourceNotFoundException to retry PutItem with exponential backoff.
- C Configure the clients with adaptive retry mode and max_attempts of 10 so that both calls are retried until they work.
- D Call list_objects instead of list_objects_v2, and poll describe_table in a loop until the reported TableStatus becomes ACTIVE.
Why A
SDK paginators handle continuation tokens for any paginated operation, so iterating the list_objects_v2 paginator yields every page until all 380,000 keys are returned, and SDK waiters poll a describe call on a built-in schedule, so the table_exists waiter returns only when the table is ACTIVE and ready for writes. Both replace hand-rolled loops with tested SDK code. MaxKeys is capped at 1,000 per call, so a larger value still returns one page, and retrying PutItem on errors is the same sleep loop in a different form. Adaptive retry mode retries throttling and transient errors, but it never fetches the next page of a listing, and ResourceNotFoundException is not a retryable error. The older list_objects call also returns at most 1,000 keys per page, and polling describe_table by hand recreates exactly what the waiter already does.
- Q37
A legal-tech startup's document collaboration app runs on 30 AWS Lambda functions behind Amazon API Gateway and signs users in with an Amazon Cognito user pool. Rules such as 'a partner can edit any matter in their own practice group' and 'an external reviewer can read a document only while their engagement is active' are coded as if statements copied into each function, and changing one rule means redeploying many functions.
The team wants the rules defined in one place as policies that can be changed and tested without redeploying code, with each function asking a single authorization question per request.
Which solution meets these requirements with the least custom code?
- A Map Cognito groups to IAM roles through an identity pool, and grant each role IAM permissions for the API Gateway methods that the members of its group may call.
- B Store the rules as a JSON document in AWS AppConfig, and write a shared Lambda layer that evaluates the rules against the user and document of each request.
- C Move the if statements into one API Gateway Lambda authorizer that loads the metadata of each document and returns an IAM policy that allows or denies the method.
- D Write the rules as Cedar policies in a Verified Permissions policy store, and have each function call IsAuthorized with the principal, action and resource. Correct
Why D
Amazon Verified Permissions stores fine-grained rules as Cedar policies in a policy store, evaluates them with one IsAuthorized call per request, using entity attributes such as practice group and context such as engagement dates, and lets the team change and test policies without touching function code. IAM roles mapped from Cognito groups can allow or deny API methods, but they cannot express rules about individual documents, practice groups or engagement dates, because those are application records rather than AWS resources. An AppConfig document with a shared evaluator layer centralizes the data but means writing and maintaining a policy engine. A single Lambda authorizer moves the if statements to one place, yet the rules are still code that must be redeployed to change, and it has to fetch document metadata for every method call.
- Q38
An insurance company runs a REST API named claims-api in Amazon API Gateway with execution logging enabled at the INFO level on the prod stage. Its analytics team wants exactly one JSON log line per request containing the request ID, the client source IP, the response status, the integration latency and the authorizer principal ID, so that a log pipeline can parse the lines without custom regular expressions. The current execution logs write many unstructured lines per request.
Which stage logging change produces the required log lines with the least ongoing processing?
- A Lower execution logging on the prod stage to the ERROR level, so that API Gateway writes only one summary line for each request that it handles.
- B Enable full request and response data logging alongside execution logging, so that every log entry carries the complete request and response.
- C Enable detailed CloudWatch metrics on the prod stage, so that latency, status and caller details are published separately for every method.
- D Enable access logging on the prod stage with a JSON format built from $context variables, such as $context.requestId and $context.status. Correct
Why D
Access logging writes one line per request in a format the team defines, so a JSON template with $context.requestId, $context.identity.sourceIp, $context.status, $context.integrationLatency and $context.authorizer.principalId produces exactly the structured record the pipeline needs. Lowering execution logging to ERROR keeps the same unstructured, API Gateway-defined lines and drops every successful request, so most requests leave no record at all. Full request and response data logging adds bodies and headers to the execution logs, making them larger, noisier and more sensitive without making them structured. Detailed CloudWatch metrics publish aggregated counts and latencies per method, not a record per request, and they never carry a source IP or principal ID.
- Q39
A retail analytics team deploys an AWS SAM template with about 40 resources through AWS CodePipeline, and a broken template takes 7 minutes to fail in the deploy stage. The last three failures were an AWS::DynamoDB::Table with a BillingMode of ON_DEMAND, an AWS::SQS::Queue property misspelled as VisibilityTimout, and a Fn::GetAtt that requested an attribute the queue resource does not have. Each was found only when CloudFormation tried to create the resources.
The team wants the build stage to catch these kinds of errors in seconds, before anything is deployed, using the SAM CLI already installed in the build image.
Which command should the build stage run?
- A sam validate, which confirms that the file is a well-formed AWS SAM template without applying any additional linting rules.
- B sam validate --lint, which runs cfn-lint on the template and checks resource property names, allowed values and attribute references. Correct
- C aws cloudformation validate-template, which sends the template to CloudFormation and checks its syntax ahead of a deployment.
- D sam build, which resolves each function's CodeUri and dependencies and stops when it finds a resource it cannot build.
Why B
The --lint flag makes sam validate run cfn-lint, which checks every resource against the CloudFormation resource specification, so it reports the misspelled VisibilityTimout property, the ON_DEMAND value outside BillingMode's allowed values of PAY_PER_REQUEST and PROVISIONED, and the Fn::GetAtt to an attribute the resource type does not expose, all locally in seconds. Plain sam validate checks only that the file is a valid AWS SAM template that the SAM transform can process, so property-level errors on standard CloudFormation resources pass. aws cloudformation validate-template checks that the template is valid JSON or YAML with a correct overall structure, not that property names and values are right. sam build packages function code and dependencies and does not inspect resource properties.
- Q40 Choose 2
A broadcaster's ingest service uploads finished program masters, typically 6 GB to 40 GB each, from an on-premises server to an Amazon S3 bucket named masters-archive. The service calls PutObject once per file, and every file larger than 5 GB is rejected. An earlier experiment with chunked uploads crashed partway through dozens of files, and the bucket's storage bill now includes several terabytes that never appear in any object listing.
Which two actions make the uploads succeed and stop the charges for the leftover data? (Select TWO.)
- A Enable S3 Transfer Acceleration on the bucket so that the large PutObject calls complete within the size limit.
- B Upload each file with multipart upload, for example through the SDK transfer manager with parallel part uploads. Correct
- C Enable S3 Versioning on the bucket so that an interrupted upload can resume from the last saved object version.
- D Add a lifecycle rule with AbortIncompleteMultipartUpload so that unfinished uploads are removed after a few days. Correct
- E Move the bucket's objects to the S3 Intelligent-Tiering storage class so that the unlisted data shifts to a cheaper tier.
Why B and D
A single PutObject request is limited to 5 GB, while multipart upload splits a file into parts that upload in parallel, can be retried individually, and are assembled into one object by CompleteMultipartUpload, which is what the SDK transfer manager does automatically above a size threshold. Parts of uploads that were never completed or aborted are stored and billed but do not appear in object listings, and a lifecycle rule with AbortIncompleteMultipartUpload deletes them a set number of days after initiation, now and for future crashes. Transfer Acceleration speeds long-distance transfers through edge locations but does not raise the single-request size limit. Versioning keeps prior versions of completed objects and has no effect on incomplete uploads. Intelligent-Tiering applies to stored objects, and orphaned parts are not objects it can move.
- Q41 Choose 2
A payments processor exposes a REST API in Amazon API Gateway to 40 partner banks, which call it from their own systems. A new contract requires every request to authenticate with a client certificate issued by the processor’s private certificate authority.
The API has a Regional endpoint and is already reachable through a custom domain name, api.clearpay.example, that uses the TLS_1_2 security policy.
Which two actions enforce client certificate authentication on every request?
- A Upload a PEM truststore holding the private CA certificate chain to an S3 bucket, and enable mutual TLS on the custom domain with that truststore URI. Correct
- B Generate a client certificate for the API stage in API Gateway, and give each bank its PEM-encoded certificate to present when it sends requests to the API.
- C Add a Lambda authorizer that reads the certificate from a custom request header and rejects any request whose certificate the private CA did not issue.
- D Disable the default execute-api endpoint of the API, so that banks cannot reach it through a hostname that does not ask for a client certificate. Correct
- E Convert the custom domain name to an edge-optimized endpoint, so that CloudFront validates each client certificate at the edge location nearest the bank.
Why A and D
API Gateway enforces mutual TLS on a Regional custom domain name that uses TLS 1.2, validating each client certificate during the handshake against a PEM truststore stored in Amazon S3, so the truststore with the private CA chain is the core step. Mutual TLS applies only to the custom domain, however, and the default execute-api hostname still accepts requests without a certificate, so disabling it closes the bypass. A stage client certificate is the certificate API Gateway presents to the backend integration, the opposite direction, and it authenticates nothing about the banks. A Lambda authorizer reading a certificate from a header proves nothing, because a header can carry any certificate without the private key that a TLS handshake requires. Edge-optimized custom domains do not support mutual TLS, so the change would remove the capability instead of adding it.
- Q42
A mobile-gaming studio sends gameplay telemetry to an Amazon Kinesis data stream named match-telemetry, which runs in provisioned mode with 8 shards. Traffic is unpredictable: when a popular streamer features the game, writes climb from about 3 MB/s to 25 MB/s within minutes, which happens several times a month, while quiet days average under 2 MB/s. A scheduled UpdateShardCount job cannot react in time, so producers receive ProvisionedThroughputExceededException during spikes, and the shards sit mostly idle the rest of the week. Partition keys are random session IDs, so writes spread evenly.
Which change handles the spikes with the least ongoing capacity management?
- A Switch match-telemetry to on-demand capacity mode so that Kinesis scales shard capacity from observed traffic. Correct
- B Stay in provisioned mode and raise the stream to 25 shards so that every spike fits within provisioned capacity.
- C Register the consumers for enhanced fan-out so that each receives its own dedicated read throughput per shard.
- D Change the partition key to a constant game ID so that producers can batch more records per PutRecords call.
Why A
On-demand capacity mode is designed for unpredictable traffic: Kinesis manages the shards, accommodates up to double the peak write throughput seen in the previous 30 days and scales automatically within those bounds, and charges for data written and read rather than for provisioned shards, so no scaling jobs are needed. It does not promise zero throttling: a spike that more than doubles the prior peak within 15 minutes can still be throttled while capacity grows, so producers should keep retrying throttled writes. Provisioning 25 shards would cover the spikes but pays for idle shards most of the week and still leaves the team adjusting the count by hand as the game grows. Enhanced fan-out adds dedicated read throughput for consumers, while the errors here are on the write side. A constant partition key sends every record to a single shard, creating a hot shard and making throttling far worse.
- Q43 Choose 2
An insurance company has an Amazon API Gateway REST API named claims-api with a Regional endpoint in eu-west-1, deployed to a stage named v1. Partners must call it at claims.example-insure.com/claims instead of the default execute-api address, so that the backend can later move without partners changing anything. The company owns the domain, validates certificates through DNS, and its DNS team will create the alias record as soon as it receives the target domain name from API Gateway.
Which two actions should the developer take to meet these requirements with the least operational overhead?
- A Generate an API Gateway client certificate for the v1 stage and give it to the DNS team as the TLS certificate for the custom name.
- B Create a CloudFront distribution with the name as an alternate domain and the execute-api endpoint plus the v1 path as its origin.
- C Add a claims resource to the API with an HTTP proxy integration and redeploy the stage, so the path exists inside the API itself.
- D Request a public ACM certificate for the name in eu-west-1 and create a Regional custom domain name in API Gateway that uses it. Correct
- E Create an API mapping on the custom domain name that maps the base path claims to the v1 stage of the claims-api REST API. Correct
Why D and E
A Regional custom domain name needs an ACM certificate in the same Region as the API, so a DNS-validated certificate in eu-west-1 lets API Gateway serve the partner hostname and hand the DNS team a target domain name for the alias record, and an API mapping routes the claims base path to the v1 stage, so the backend can later be remapped without partners noticing. A client certificate is what API Gateway presents to a backend so the backend can verify the caller; it cannot serve TLS for a custom hostname. A self-managed CloudFront distribution could front the API, but it needs a certificate in us-east-1, cache and origin settings and path handling, which is more to operate. Adding a claims resource changes the API's routes, not the hostname partners call.
- Q44
A travel publisher runs its workloads in eu-west-1 and is putting an Amazon CloudFront distribution in front of an S3 origin for the domain media.wanderly.example. The developer requested a public certificate for that domain in AWS Certificate Manager in eu-west-1, validated it with DNS, and it shows as Issued.
When the developer edits the distribution to add media.wanderly.example as an alternate domain name, the certificate does not appear in the list of custom SSL certificates.
What should the developer do to serve the domain over HTTPS with automatic certificate renewal?
- A Upload the certificate and its private key to the IAM certificate store under the /cloudfront/ path, and select it as the custom certificate on the distribution.
- B Attach the eu-west-1 certificate to an Application Load Balancer origin, and add the alternate domain name to the distribution with its default CloudFront certificate.
- C Request a public certificate for media.wanderly.example in ACM in the us-east-1 Region, validate it with DNS records, and select it as the custom SSL certificate on the distribution. Correct
- D Grant the CloudFront service principal access to the certificate with an ACM resource policy, so that the distribution can use certificates from eu-west-1.
Why C
CloudFront is a global service that reads ACM certificates only from US East (N. Virginia), so the certificate must be requested or imported in us-east-1; a DNS-validated ACM certificate there renews automatically as long as its validation record stays in place. The IAM certificate store does work with CloudFront, but it needs the private key, which ACM does not release for this certificate, and certificates in IAM never renew automatically. A certificate on a load balancer origin secures only the connection from CloudFront to the origin, and CloudFront refuses an alternate domain name unless the distribution has a certificate that covers it. ACM offers no resource policy that lets CloudFront read certificates from another Region, so the eu-west-1 certificate can never appear in the distribution settings.
- Q45
A food-delivery platform has an order-intake service on Amazon ECS that sends messages to an Amazon SQS queue named dispatch-jobs, and the trace header for each request travels in the AWSTraceHeader message system attribute. A separate worker service on AWS Fargate polls the queue with ReceiveMessage and is instrumented with AWS Distro for OpenTelemetry, exporting to AWS X-Ray. In the X-Ray trace map, every trace ends at the queue, and the worker's processing appears in separate traces with new trace IDs.
Which change makes the worker's spans join the producer's traces?
- A Raise the X-Ray sampling rule for the worker service to 100 percent, so that every message the worker processes is recorded in a trace.
- B Record the producer's trace ID as an indexed annotation on each worker span, so a filter expression returns both traces for a request.
- C Request the AWSTraceHeader system attribute in ReceiveMessage, extract it with the ADOT X-Ray propagator and make it the parent of the worker span. Correct
- D Create an X-Ray group whose filter expression matches both services, so the producer's and the worker's segments are displayed together.
Why C
ReceiveMessage returns message system attributes only when they are requested, so the worker must ask for AWSTraceHeader, pass its value through the AWS X-Ray propagator to rebuild the producer's trace context, and start the processing span with that context as its parent, after which the spans carry the producer's trace ID; only Lambda consumers get this propagation automatically. A 100 percent sampling rule records more worker traces, but each still starts with a new trace ID because no context is read from the message. An annotation holding the producer's trace ID makes the two traces findable together with a filter expression, yet they remain two traces. An X-Ray group filters which traces appear in its view and in its metrics; it does not merge segments from different traces.
- Q46
A subscription-box retailer must send an HTTPS POST to a shipping partner's webhook every time an OrderPacked event arrives on its Amazon EventBridge custom event bus. The partner requires an OAuth 2.0 client-credentials token on every call and accepts at most 20 requests per second, returning 429 above that. The current AWS Lambda target fetches and caches the token, posts the event, and implements its own throttling and retries, and it has become the most frequently patched code in the service.
Which approach replaces the function with the least custom code?
- A Route OrderPacked events to an Amazon SNS topic that has the partner webhook subscribed as an HTTPS endpoint.
- B Target a Step Functions Express workflow whose HTTP Task calls the partner webhook with the partner credentials.
- C Target an API destination that uses an OAuth client-credentials connection and an invocation rate limit of 20. Correct
- D Target an SQS queue drained by a Lambda function with reserved concurrency of 20 that posts each event onward.
Why C
An EventBridge API destination is a rule target for an HTTP endpoint: its connection handles authorization, including OAuth client credentials, by obtaining and refreshing the token and storing secrets in AWS Secrets Manager, and the API destination's invocation rate limit holds delivery at 20 requests per second while EventBridge retries failures and can send exhausted events to a dead-letter queue. No function code remains. An SNS HTTPS subscription can throttle delivery, but it cannot obtain or attach an OAuth client-credentials token. A Step Functions HTTP Task can authenticate through an EventBridge connection, but it adds a workflow per event and has no invocation rate limit, so bursts still exceed what the partner accepts. A queue drained by a capped function keeps all of the token, posting and retry code the team wants to remove, and concurrency does not translate into a requests-per-second limit.
- Q47
A regional energy utility exposes an Amazon API Gateway REST API named meter-readings that receives readings from about 40,000 smart-meter gateways installed in homes. All gateways are in one country close to the API's Region, eu-central-1, and connect over the public internet through local internet providers. The API was created with the default edge-optimized endpoint type, and latency traces show every request passing through a CloudFront point of presence before it reaches the Region.
The team wants the lowest latency for these clients and does not need a CloudFront distribution in front of the API.
Which endpoint type best fits these clients?
- A Edge-optimized, because routing every request through the nearest CloudFront point of presence gives the lowest latency for any client.
- B Regional, because the clients are concentrated in the same geography as the Region and can reach it directly without a CloudFront hop. Correct
- C Private, because the gateways form a closed device fleet and a private endpoint keeps the API off the public internet for them.
- D Edge-optimized with stage caching turned on, because cached responses served from edge locations remove the extra network hop.
Why B
A Regional endpoint is meant for clients in or near the API's Region: requests go straight to eu-central-1 without the AWS-managed CloudFront distribution, which removes the extra hop for a client base concentrated in one country. Edge-optimized endpoints help geographically dispersed clients by carrying their traffic over the AWS network from the nearest point of presence; for clients already next to the Region, that detour adds latency rather than removing it. A private endpoint is reachable only from a VPC through an interface VPC endpoint, so home gateways on consumer internet connections could not call it at all. Stage caching stores responses in the API's Region, not at edge locations, so it cannot remove the CloudFront hop and suits read traffic rather than writes of new readings.
- Q48
A smart-meter company ingests readings into an Amazon S3 bucket named meter-raw at about 25 million new objects a day, using SSE-KMS with a customer managed key so that every use of the key is governed by its key policy and recorded in CloudTrail.
The KMS charge has become one of the largest items on the bill, and at peak hours some PutObject calls fail because of KMS request throttling. The security team will not give up the customer managed key.
Which change cuts the KMS request volume with the fewest application changes?
- A Change the default encryption of the bucket to SSE-S3, which encrypts objects with keys that Amazon S3 manages and so makes no KMS requests at all.
- B Request an increase to the KMS cryptographic request quota for the Region, so that the uploads stop being throttled during the peak hours of the day.
- C Enable S3 Bucket Keys in the default encryption settings of the bucket, so that S3 uses a bucket-level key from KMS to generate data keys for new objects. Correct
- D Change the default encryption of the bucket to DSSE-KMS with the same customer managed key, which applies two independent layers of encryption to each object.
Why C
With S3 Bucket Keys enabled, S3 obtains a short-lived bucket-level key from KMS and uses it to create the data keys for many objects, which AWS says can cut KMS request traffic and cost by up to 99 percent while the customer managed key and its key policy stay in charge; it is a bucket setting, so the uploading code does not change, and it applies to objects written after it is enabled. SSE-S3 removes the KMS requests by removing the customer managed key, which the security team has ruled out. A quota increase can stop the throttling, but every object would still cost a KMS request, so the bill would keep growing. DSSE-KMS performs more cryptographic work per object, and it does not support S3 Bucket Keys, so it would raise KMS usage rather than reduce it.
- Q49
A logistics company's platform team owns an AWS Lambda function named rate-card-lookup that returns freight prices as JSON. Its only callers are two internal services in the same AWS account, running on Amazon ECS with their own task roles, which already sign HTTP requests with SigV4 through the AWS SDK. The callers need an HTTPS endpoint; the team needs no request validation, usage plans, caching or custom domain, and the endpoint must reject unauthenticated callers.
Which option provides the endpoint with the least operational overhead?
- A Create an Amazon API Gateway REST API with a Lambda proxy integration and AWS_IAM authorization on the POST method.
- B Create a function URL with the NONE auth type and have the function compare a shared secret sent in a header.
- C Create a function URL with the AWS_IAM auth type, and grant the callers' task roles both Lambda invoke actions. Correct
- D Register the function as the target of an internal Application Load Balancer that has an HTTPS listener.
Why C
A Lambda function URL is a dedicated HTTPS endpoint built into the function, and with the AWS_IAM auth type Lambda rejects any request that is not SigV4-signed by a principal with permission. For callers in the same account, granting lambda:InvokeFunctionUrl and lambda:InvokeFunction in the task roles' identity policies is enough (function URLs created since October 2025 require both actions), so there is nothing else to deploy. An API Gateway REST API with IAM authorization also works, but it adds an API, stages and deployments that provide features the team said it does not need. A NONE function URL accepts requests from anyone who has the URL, and a hand-checked shared secret has to be stored, rotated and compared in code. An internal load balancer needs a VPC, a certificate and hourly charges, and it performs no IAM authentication.
- Q50 Choose 2
A pharmacy chain runs an AWS Lambda function named rx-refill on python3.13. The handler logs through the standard Python logging module with logger.debug, logger.info and logger.warning calls and never calls setLevel. The function writes plain text logs today. The team wants every application log line written as a JSON object with a level field that CloudWatch Logs Insights can filter on, and wants the production function to send only WARN and higher application logs while the staging function keeps DEBUG.
The change must be made in the function configuration, without editing or redeploying the function code.
Which two actions meet these requirements? (Select TWO.)
- A Set the log format in the function's logging configuration to JSON on both the staging and the production functions. Correct
- B Add an environment variable named LOG_LEVEL with the value WARN to the production function and DEBUG to the staging function.
- C Set the application log level in the logging configuration to WARN on production and to DEBUG on the staging function. Correct
- D Set the system log level in the logging configuration to WARN on production and to DEBUG on the staging function.
- E Add a subscription filter to the production log group whose filter pattern matches only WARN and ERROR log events.
Why A and C
Lambda advanced logging controls let the function configuration set the log format to JSON, which makes the Python runtime emit each logging call as a JSON object with level, message and request ID fields, and set an application log level, which Lambda enforces on supported runtime loggers without code changes; log-level filtering requires the JSON format, so both settings are needed. An environment variable named LOG_LEVEL does nothing unless code or a library reads it, and this handler reads nothing. The system log level filters the platform records Lambda itself writes, such as START and REPORT, and leaves application logs untouched. A subscription filter forwards matching events to a destination such as Kinesis or Lambda, while the log group still ingests and stores every DEBUG and INFO line.
- Q51
A ticketing company deploys an application named box-office to 12 Amazon EC2 instances in an AWS CodeDeploy in-place deployment group behind an Application Load Balancer. Capacity planning requires at least 9 instances to keep serving traffic at all times during a deployment, and releases should finish as quickly as that limit allows.
The deployment group uses CodeDeployDefault.OneAtATime, and a release now takes 70 minutes.
Which deployment configuration meets the capacity requirement and finishes fastest?
- A CodeDeployDefault.HalfAtATime, which deploys to up to half of the instances at a time while the other half keep serving.
- B CodeDeployDefault.AllAtOnce with load balancing enabled, so the instances are deregistered and updated together in one pass.
- C A custom deployment configuration with a minimum healthy hosts value of 75 percent of the fleet, which is 9 of the 12 instances. Correct
- D A custom deployment configuration with a minimum healthy hosts value of 25 percent, so that a quarter of the fleet updates at a time.
Why C
Minimum healthy hosts is the number of instances that must stay available, and CodeDeploy deploys to as many instances at once as that floor allows, so 75 percent of 12 keeps 9 serving and updates up to 3 at a time, about four times faster than one at a time. HalfAtATime keeps only 50 percent healthy, so 6 instances could be out of service together, which breaks the 9-instance floor. AllAtOnce tries to update every instance in one pass, which can leave no instance serving behind the load balancer. A minimum healthy hosts value of 25 percent does not mean deploying to a quarter at a time; it lets CodeDeploy take up to 9 instances out of service together, leaving only 3 serving. OneAtATime meets the floor but is the slowest option.
- Q52
A business-intelligence product generates CSV exports in a nodejs22.x AWS Lambda function exposed through a function URL. The function reads rows from an Amazon DynamoDB table page by page, builds the whole file in memory, and returns it. Exports larger than about 6 MB fail, the biggest reach 40 MB, and users wait up to 25 seconds before the first byte of even a modest export arrives.
Which change lets exports of these sizes start downloading quickly with the fewest architecture changes?
- A Set the function URL invoke mode to RESPONSE_STREAM and write each page of rows to the response stream as it is read. Correct
- B Raise the function memory to 10,240 MB so that it can assemble and return the complete 40 MB response much more quickly.
- C Gzip the finished CSV in memory before returning it so that the compressed body fits in the buffered response.
- D Put an Amazon CloudFront distribution in front of the function URL so that CloudFront caches every export.
Why A
Response streaming lets a function send its payload as it is produced: with the function URL invoke mode set to RESPONSE_STREAM and the handler wrapped in streamifyResponse on the Node.js managed runtime, each page of rows reaches the client immediately, improving time to first byte, and streamed responses can be up to 200 MB instead of the 6 MB buffered limit. After the first 6 MB, which streams without a bandwidth cap, the rate is capped at 2 MBps, so the first bytes arrive quickly while a 40 MB export still takes several more seconds to finish downloading. More memory adds CPU, but a buffered response is still limited to 6 MB, so 40 MB exports keep failing and users still wait for the whole file. Compressing the finished file still waits for the entire export and cannot guarantee that a large CSV shrinks below 6 MB. CloudFront caching helps only identical repeat requests, and each export is unique and still subject to the function's payload limit.
- Q53
An insurance company issues signed policy documents to 300 brokers, who must verify the authenticity of each document in their own systems. Those systems have no network access to AWS, and the brokers have no AWS accounts.
The issuing service runs on AWS Lambda, and the company security standard requires that the signing private key never leave a hardware security module or appear in application memory.
Which approach meets these requirements?
- A Create an HMAC KMS key, generate a tag for each document with GenerateMac, and give the brokers the key ID so that their systems can check each tag with VerifyMac.
- B Create an asymmetric KMS signing key, sign each document digest with the Sign API, and give the brokers the public key from GetPublicKey to verify offline. Correct
- C Create a symmetric KMS key, encrypt the hash of each document with the Encrypt API, and have the brokers decrypt the hash with the key and compare it to their own hash.
- D Create an asymmetric KMS key for signing, sign each document with the Sign API, and have the brokers call the Verify API through a cross-account grant on the key.
Why B
An asymmetric KMS key with the SIGN_VERIFY key usage keeps its private key inside the KMS hardware security modules, the Lambda function calls Sign on a digest of each document, and anyone holding the public key returned by GetPublicKey can verify the signature with standard cryptographic libraries and no AWS access. An HMAC key is symmetric and cannot be exported, so checking a tag requires calling VerifyMac in KMS, which brokers without AWS accounts or connectivity cannot do. Encrypting a hash with a symmetric key is not a signature scheme, and decrypting it would again require KMS access and the right to decrypt. Having brokers call Verify requires AWS credentials, network access and a grant, all of which they lack, even though the signing side of that design is correct.
- Q54 Choose 2
A travel-booking company runs a Spring Boot API on the java21 Lambda runtime behind Amazon API Gateway, which invokes the unqualified function ARN. Cold starts take 6 to 8 seconds because of framework initialization, and traffic is too spiky for provisioned concurrency sized at peak to be affordable. During initialization the function seeds a pseudorandom generator used to build booking-reference suffixes and opens a JDBC connection pool to its database.
Which two actions cut cold-start latency while keeping booking references unique and connections usable? (Select TWO.)
- A Turn on SnapStart, publish a version, and point API Gateway at an alias for that version instead of the bare ARN. Correct
- B Turn on SnapStart for $LATEST so that API Gateway can keep invoking the unqualified ARN without any change.
- C Add provisioned concurrency to the alias alongside SnapStart so that restored environments also stay warm.
- D Move the generator seeding and the connection pool into a static initializer block so that both are captured in the snapshot.
- E Register CRaC runtime hooks that reseed the generator and re-create the connection pool in afterRestore. Correct
Why A and E
SnapStart initializes the function when a version is published, snapshots the initialized execution environment, and resumes new environments from that snapshot, cutting framework start-up from seconds to as low as sub-second at no extra cost on Java runtimes; it works only on published versions and aliases that point to them. Because every environment resumes from the same memory, state created during initialization is shared, so an afterRestore runtime hook (the CRaC interface on Java) must reseed the generator and rebuild the connection pool after each restore. SnapStart cannot be enabled on $LATEST, so the unqualified ARN would get no benefit. SnapStart does not support provisioned concurrency. Moving the seeding and pool into static initialization puts them into the snapshot, which is exactly what makes references repeat across environments and connections go stale.
- Q55
A banking team uses an AWS CodePipeline V2 pipeline named core-ledger-release. Every merge carries a numbered database migration that must be applied in order, and skipping a revision breaks the next migration. The deploy stage contains a manual approval and takes about 25 minutes. On busy days the team merges several changes an hour, and the execution history shows some of them as Superseded without ever reaching the deploy stage.
Which pipeline setting ensures that every revision is deployed, one at a time, in the order it was merged?
- A Set the execution mode to QUEUED, so waiting executions line up at each locked stage and run in order without overtaking. Correct
- B Set the execution mode to PARALLEL, so every execution runs through all stages independently and none is superseded.
- C Keep SUPERSEDED mode and disable the inbound transition to the deploy stage until each running deployment has finished.
- D Keep SUPERSEDED mode and move the manual approval into its own stage, so every revision waits for approval before deploying.
Why A
In QUEUED mode, available on V2 pipelines, a stage still processes one execution at a time, but waiting executions form a queue in arrival order and never overtake one that started earlier, so every revision and its migration is deployed in sequence. PARALLEL mode runs executions independently and at the same time, so two migrations could hit the same database concurrently and finish out of order. In SUPERSEDED mode, an execution waiting at a disabled transition can still be superseded by a newer one, so disabling the transition skips revisions in the same way. Moving the approval into its own stage only adds another place where executions wait between stages, and waiting executions in SUPERSEDED mode are exactly the ones a newer run replaces.
- Q56
A telemetry service on AWS Lambda with the nodejs22.x runtime uses the AWS Encryption SDK for JavaScript with a KmsKeyringNode keyring to encrypt each sensor record, about 3,000 small records per second with the same encryption context, before writing it to Amazon DynamoDB. Every record triggers its own GenerateDataKey request, and during peaks the function logs ThrottlingException from KMS while the KMS charge keeps rising.
The security team accepts reusing a data key for up to 5 minutes or 10,000 records, whichever limit comes first.
Which change reduces the KMS requests within those limits with the least code?
- A Request a higher KMS request quota for GenerateDataKey in the Region, so that each record can keep using its own data key without being throttled.
- B Configure the AWS SDK client used by the keyring with the adaptive retry mode and more attempts, so that throttled GenerateDataKey requests succeed on retry.
- C Enable data key caching in the Encryption SDK with a local cache, and set a maximum age of 5 minutes and a maximum of 10,000 messages for each data key. Correct
- D Generate one data key when the function is deployed, store its plaintext in an encrypted environment variable, and encrypt every record with it using AES-GCM.
Why C
In the AWS Encryption SDK for JavaScript, data key caching wraps the KMS keyring in a NodeCachingMaterialsManager backed by a local cache, which reuses data keys within the maxAge and maxMessagesEncrypted thresholds set on it, so a 5-minute maximum age and a 10,000-message limit turn thousands of GenerateDataKey calls a second into a handful while the SDK still handles the envelope format. A quota increase removes the throttling but keeps one paid request per record, so the cost problem stays. Adaptive retries slow the function down until requests succeed; they do not remove any request, and at sustained peak load they add latency. A single data key generated at deployment has no age or message limit, sits in plaintext in the function configuration, and replaces the SDK with hand-written AES-GCM code, which breaks the agreed limits and adds custom cryptography.
- Q57
A ride-hailing company runs a synchronous AWS Lambda function named geo-lookup behind Amazon API Gateway, with an average duration of 400 ms that load tests show stays flat under load. A marketing campaign is expected to drive a peak of 2,500 requests per second for several hours. The account has the default Regional concurrency quota of 1,000, and other functions in the account use about 150 concurrent executions at the same time of day.
How much concurrency will geo-lookup need at the peak, and what must the team do before the campaign to avoid throttling?
- A About 2,500 concurrent executions, one per request arriving each second; request a quota increase to at least 3,000 and reserve 2,500 for geo-lookup.
- B About 1,000 concurrent executions, which with the other functions exceeds the 1,000 quota; raise the quota, then reserve for geo-lookup. Correct
- C About 400 concurrent executions, since each takes 400 ms; this fits in the current quota, so reserving 400 for geo-lookup prevents throttling.
- D About 6,250 concurrent executions, from 2,500 divided by 0.4 seconds; configure provisioned concurrency of 6,250 on the function alias instead.
Why B
Required concurrency is the request rate multiplied by the average duration in seconds, so 2,500 requests per second times 0.4 seconds is about 1,000 concurrent executions; added to the 150 the other functions use, that exceeds the default quota of 1,000, so the team must raise the quota first, and only then can reserved concurrency set aside capacity for geo-lookup while leaving the required 100 unreserved. Treating requests per second as concurrency ignores that each execution environment finishes a 400 ms request and takes another, serving 2.5 requests each second. Equating the duration in milliseconds with concurrency has no basis in the arithmetic. Dividing the rate by the duration inverts the formula and would provision six times the needed environments at a large standing cost.
- Q58
A fleet-maintenance app stores work orders in an Amazon DynamoDB table named WorkOrders, with partition key vehicleId and sort key openedAt holding an ISO 8601 timestamp. A dashboard shows each vehicle's work orders from the last 30 days. The code calls Query with the key condition vehicleId = :v and a FilterExpression of openedAt >= :since, using eventually consistent reads. Some vehicles have 12 years of history, and their queries consume far more read capacity than the handful of items returned.
Which change reduces the read capacity consumed with the fewest code changes?
- A Move the date condition into the KeyConditionExpression as vehicleId = :v AND openedAt >= :since. Correct
- B Add a ProjectionExpression so that the Query returns only the attributes that the dashboard displays.
- C Set Limit to 50 so that DynamoDB stops reading as soon as it has found 50 matching work orders.
- D Replace the Query with a parallel Scan that keeps the same FilterExpression across four segments.
Why A
A Query consumes read capacity for every item its key condition selects, and a FilterExpression is applied only afterward, so the current call reads and pays for 12 years of work orders and then discards most of them. Because openedAt is the sort key, a range condition on it belongs in the KeyConditionExpression, and DynamoDB then reads only the last 30 days of items for that vehicle. A ProjectionExpression trims the response, but capacity is still calculated on the full size of every item read. Limit caps the number of items evaluated before the filter runs, not the number of matches, so the dashboard would receive a partial page and need more calls. A Scan reads the entire table across every vehicle, which consumes far more capacity than even the current Query.
- Q59
A food-delivery company deploys an AWS Lambda function named courier-match through AWS CodePipeline with an AWS CodeDeploy action and an AppSpec file that shifts the prod alias to the new version using LambdaLinear10PercentEvery1Minute. Twice, a new version with a wrong Amazon DynamoDB table name received 10 percent of production traffic and failed customer requests before the alarm-based rollback started.
The team has written a function named courier-match-smoke that invokes the new version with a synthetic order and checks the response. It wants that check to run against the new version and stop the deployment before any production traffic shifts.
How should the team wire the smoke-test function into the deployment?
- A List it under the AfterAllowTraffic hook in the AppSpec file, and have it call PutLifecycleEventHookExecutionStatus with the test result.
- B List it under the ValidateService hook in the AppSpec file, and have it exit with a nonzero status when the synthetic order fails.
- C Create a CloudWatch alarm on the smoke-test function's Errors metric and add it to the deployment group's alarm-based rollback list.
- D List it under the BeforeAllowTraffic hook in the AppSpec file, and have it call PutLifecycleEventHookExecutionStatus with the test result. Correct
Why D
In a Lambda AppSpec file, the BeforeAllowTraffic hook runs after the new version is published but before the alias sends it any traffic, and the hook function reports Succeeded or Failed with PutLifecycleEventHookExecutionStatus, so a Failed status stops the deployment while the alias still points entirely at the old version. AfterAllowTraffic runs only after all traffic has shifted, so customers would already have hit the broken version. ValidateService is a lifecycle event of EC2 and on-premises deployments that runs scripts on instances; it does not exist in a Lambda AppSpec, and a Lambda hook signals its result through the API rather than an exit code. An alarm on the smoke-test function's errors still acts only through alarm-based rollback, which reacts after traffic shifting has begun.
- Q60
A banking app's token service signs session JWTs with an asymmetric RSA_3072 KMS key, and its code calls Sign with the alias alias/session-signer instead of a key ARN. Downstream services verify tokens offline against public keys published at a JWKS endpoint, choosing the key by the kid header of each token, which the service fills from the key ID that Sign returns.
A new regulation requires the signing key to be replaced every 12 months, and tokens are valid for at most 8 hours.
How should the developer rotate the signing key?
- A Enable automatic key rotation on the existing key with a rotation period of 365 days, so that KMS generates new key material each year under the same key ID.
- B Create an EventBridge Scheduler schedule that calls RotateKeyOnDemand on the key every 12 months, so that the key material changes while the alias stays the same.
- C Create a new asymmetric key, point the service configuration at its key ARN, and replace the old public key at the JWKS endpoint with the new one at the same moment.
- D Create a new RSA_3072 signing key, publish its public key at the JWKS endpoint, then repoint the alias with UpdateAlias and keep the old public key published. Correct
Why D
Asymmetric KMS keys, like HMAC keys and keys in custom key stores, support neither automatic nor on-demand rotation, and a symmetric key with imported key material cannot auto-rotate either, so the documented method is manual rotation: create a new key of the same type and key usage, then repoint the alias with UpdateAlias, which the code already uses; publishing the new public key first and leaving the old one for at least 8 hours means every token in flight still verifies. Automatic rotation with a 365-day period can be enabled only on symmetric encryption keys with KMS-generated key material, so the request fails on this key. RotateKeyOnDemand is likewise limited to symmetric encryption keys and fails on an asymmetric one. Switching to a key ARN needs a configuration change and deployment, and removing the old public key at once makes every unexpired token signed with it fail verification for up to 8 hours.
- Q61
An insurance claims platform stores 55 million claims in an Amazon DynamoDB table named Claims, keyed on claimId. At any moment roughly 3,000 claims are flagged for fraud review, and investigators need to list the flagged claims ordered by the date they were flagged. Today every item carries a status attribute of FLAGGED or CLEAR, and the review screen runs a Scan with a FilterExpression on status, which takes minutes and consumes heavy read capacity.
Which design lists the flagged claims efficiently at the lowest cost?
- A Create a GSI with status as the partition key and flaggedAt as the sort key, keeping status on every item.
- B Create a local secondary index with flaggedAt as its sort key, and query it with a FilterExpression on status.
- C Enable DynamoDB Streams and have a Lambda function copy flagged claims into a separate FlaggedClaims table.
- D Write reviewQueue and flaggedAt attributes only on flagged claims, remove them on clearance, and index both in a GSI. Correct
Why D
DynamoDB writes an item into a global secondary index only when the item has the index key attributes, so adding reviewQueue and flaggedAt to flagged claims alone creates a sparse index holding just the 3,000 flagged items. A Query on the index with reviewQueue as partition key returns them sorted by flaggedAt, and deleting the attributes on clearance removes the claim from the index automatically. A GSI keyed on a status attribute present on every item replicates all 55 million claims, paying index storage and writes for every claim, with the CLEAR value forming one enormous partition. A local secondary index can only be created with the table and shares the claimId partition key, so it cannot list claims across the table. A stream-fed copy table works, but it adds a function, its error handling and a second table to keep consistent.
- Q62
A news publisher serves its single-page application from an Amazon S3 bucket through an Amazon CloudFront distribution with a one-day default TTL. The application files app.js and styles.css keep the same names and are redeployed about 20 times a day. After each release, readers keep loading the old files for hours, both from CloudFront and from their browser caches. The distribution's cache policy does not include query strings in the cache key.
Which approach makes every release reach readers immediately while keeping a high cache hit ratio?
- A Publish content-hashed names such as app.3f9c2a.js with long cache lifetimes, and serve the index.html that references them with a short TTL. Correct
- B Keep the file names and create a CloudFront invalidation for the path /* at the end of every deployment, so edge locations fetch the new files.
- C Set the default, minimum and maximum TTL to 0 seconds for the distribution, so every request is revalidated with the S3 origin before serving.
- D Keep the file names and reference them from index.html with a release query string, such as app.js?v=20261003, that changes on each deployment.
Why A
A content-hashed file name is a new object to every cache, so CloudFront and browsers fetch it on first request and can keep each version for a year, while the small index.html that names the current files is the only object that needs a short TTL, giving instant releases and a high hit ratio. An invalidation of /* removes objects from CloudFront edge caches only; browsers still hold app.js under its one-day lifetime, and every deployment also discards the whole edge cache. A TTL of 0 makes CloudFront go back to S3 on every request, which collapses the hit ratio and adds latency for the static files. A release query string changes nothing at the edge here, because the cache policy leaves query strings out of the cache key, so CloudFront keeps serving the old object.
- Q63
An e-commerce team publishes a shared AWS Lambda layer named pdf-fonts that 18 functions use, and API Gateway invokes each function through an alias named live that points to a published version. To fix a font rendering bug, a developer ran publish-layer-version, which created version 9 of the layer.
The functions' configurations reference arn:aws:lambda:us-east-2:111122223333:layer:pdf-fonts:8, and the next morning invoices are still rendered with the bug.
What must the team do so that the functions use the fixed fonts?
- A Delete version 8 of the layer with delete-layer-version, so each function falls forward to the newest remaining version of pdf-fonts.
- B Update each function's $LATEST configuration to the version 9 layer ARN with update-function-configuration and leave the aliases.
- C Update each function's configuration to the version 9 layer ARN, then publish new function versions and move the live aliases to them. Correct
- D Change each function's layer reference to the ARN without a version suffix, so that Lambda always resolves the latest version of pdf-fonts.
Why C
Each layer version is immutable and has its own ARN, and a function configuration pins the exact version ARN it lists, so the functions must be updated to the version 9 ARN; because the aliases point to published versions, which freeze the layer list, the team must also publish new function versions and move the live aliases. Deleting version 8 only stops it from being added to new configurations, and functions that already use it keep working with their copy. Updating only $LATEST to the version 9 ARN fixes the unpublished configuration, but the live aliases still point at published versions whose layer list still names version 8, so production traffic keeps the bug. Lambda requires a versioned layer ARN in a function configuration, and there is no unversioned reference that resolves to the latest version automatically.
- Q64
An AWS Lambda function named quote-pricer handles about 400 invocations per second and reads a database password from AWS Secrets Manager by calling GetSecretValue at the start of every invocation. The Secrets Manager charge has grown, and the extra network call shows up in the p99 latency of the function.
The secret rotates every 30 days, and after a rotation the function must start using the new password within 5 minutes.
Which change meets these requirements with the least code?
- A Resolve the secret into an environment variable with a CloudFormation dynamic reference at deployment, and read the password from that variable in the handler.
- B Add the AWS Parameters and Secrets Lambda Extension layer, and read the secret from its local HTTP endpoint on port 2773, which caches values for 300 seconds by default. Correct
- C Move the GetSecretValue call into the initialization code outside the handler, so that each execution environment fetches the secret only once when it starts.
- D Cache the secret in an Amazon ElastiCache for Redis cluster, and have the function read it from the cache and fall back to Secrets Manager on a cache miss.
Why B
The AWS Parameters and Secrets Lambda Extension runs in the execution environment and serves secrets over a local HTTP endpoint on port 2773, authenticated with the X-Aws-Parameters-Secrets-Token header set from AWS_SESSION_TOKEN, and it caches each value for a default 300 seconds, so most invocations make no Secrets Manager call and a rotated password is picked up within 5 minutes. A dynamic reference resolves only when the stack deploys, stores the password in plaintext in the function configuration, and keeps the old value after rotation until the next deployment. Fetching the secret in initialization code calls Secrets Manager once per environment, but warm environments can live for hours and would keep using the old password after rotation. An ElastiCache cluster adds infrastructure and a network hop on every invocation, and it puts a copy of the secret in a second store to secure.
- Q65
An online pharmacy caches product records from an Amazon RDS for PostgreSQL database in Amazon ElastiCache for Valkey using lazy loading: on a cache miss the application reads the database and stores the record with no expiry. Pharmacists change prices and stock levels through an admin service that writes only to the database, so shoppers see stale prices for hours, and the cache keeps growing with records for discontinued products that nobody reads again.
Which caching change keeps prices current after updates and stops unused records from piling up in the cache?
- A Keep lazy loading alone and add a 5-minute TTL so that a stale record is refreshed on the first miss after expiry.
- B Add write-through so the admin service updates the cache when it writes the database, and set a TTL on every key. Correct
- C Replace ElastiCache with DynamoDB Accelerator so that updates written to the database pass through the cache.
- D Switch the cluster to Memcached on larger nodes so that the extra records no longer cause cache evictions.
Why B
Write-through updates the cache in the same code path that writes the database, so a price change is visible to shoppers immediately, and keeping lazy loading for misses fills in anything not yet cached. Adding a TTL to every key bounds how long any entry can be stale if a write ever bypasses the cache, and lets records that are never read again, such as discontinued products, expire instead of accumulating. Lazy loading with a 5-minute TTL only shortens the stale window; shoppers can still see an old price for up to five minutes after every change. DynamoDB Accelerator is a write-through cache for DynamoDB tables only and cannot sit in front of an RDS for PostgreSQL database. Moving to Memcached on bigger nodes changes the engine and the capacity but neither the staleness nor the unbounded growth.
Ready to try it without the answers in front of you?