Explore / AWS Certified Developer - Associate (DVA-C02) Exam Prep / Practice questions
AWS Certified Developer - Associate (DVA-C02) practice questions
10 questions from the bank behind this course's timed mock. Free to read and to answer, no account needed, and each has its answer and an explanation. They belong to AWS Certified Developer - Associate (DVA-C02) Exam Prep.
Answer them one at a time →Read lesson 1 free
Question 1
A developer is setting up a laptop to work against a development account. The developer wants a named profile called dev, with the Region and output format stored in ~/.aws/config and the access keys stored in ~/.aws/credentials. Which pair of section headers defines this profile correctly so that the AWS CLI and the AWS SDKs can use it?
- [dev] in ~/.aws/config and [profile dev] in ~/.aws/credentials
- [default] in ~/.aws/config and [profile dev] in ~/.aws/credentials
- [profile dev] in both ~/.aws/config and ~/.aws/credentials
- [profile dev] in ~/.aws/config and [dev] in ~/.aws/credentials
Show the answer
Answer: D. [profile dev] in ~/.aws/config and [dev] in ~/.aws/credentials
Named profiles need the word "profile" in the config file header, but the credentials file uses only the bare profile name. Using [profile dev] in both files is the nearest mistake: the credentials file would then not hold keys under the name dev.
Question 2
A developer's order service sends messages to an Amazon SQS standard queue with SendMessageBatch, 10 entries per request. Every call returns without raising an exception, yet an audit shows that a small number of orders never reach the queue. The developer must stop losing orders with the least change to the design. What should the developer do?
- Inspect the Failed list in each SendMessageBatch response and resend the entries it reports
- Recreate the queue as a FIFO queue so that every send is processed exactly once
- Increase the queue's visibility timeout so that the messages are not hidden before the consumers can read them
- Configure a redrive policy on the queue so that the missing messages are moved to a dead-letter queue
Show the answer
Answer: A. Inspect the Failed list in each SendMessageBatch response and resend the entries it reports
A batch call can succeed overall while individual entries fail, so the producer must read the Failed list and retry those entries. A dead-letter queue only catches messages that were received repeatedly without being deleted; it cannot hold a message that was never accepted into the queue.
Question 3
A developer runs a checkout function behind Amazon API Gateway. To remove cold-start latency, the developer tries to configure provisioned concurrency of 20 on the function's $LATEST version, and the request is rejected. The function's reserved concurrency is not set and the account has plenty of unused concurrency. What should the developer do to meet the goal?
- Raise the function timeout to 900 seconds so execution environments are never shut down
- Set reserved concurrency of 20 on the function so that 20 execution environments are kept initialized
- Increase the function's memory to 10,240 MB so the Init phase no longer counts as a cold start
- Publish a version of the function, point an alias at it, and configure provisioned concurrency on that alias
Show the answer
Answer: D. Publish a version of the function, point an alias at it, and configure provisioned concurrency on that alias
Provisioned concurrency cannot be set on $LATEST; it applies only to a published version or an alias, where it keeps environments pre-initialized. Reserved concurrency only guarantees and caps capacity, it does not pre-warm anything, so cold starts would remain.
Question 4
A developer runs an order service that caches customer records in Amazon ElastiCache using write-through only: every database update also writes the record to the cache with a TTL. After a cache node fails and is replaced, the read path finds no entry for most customers and latency-sensitive pages break, because the code assumes every customer is in the cache. Which change makes the read path resilient to this with the LEAST impact on data freshness?
- Send the read path to the Aurora reader endpoint so that the Aurora Replicas refill the cache node
- Add lazy loading to the read path so that a cache miss queries the database and populates the cache, and keep the write-through updates
- Replace write-through with lazy loading only, and remove the cache update from the write path
- Remove the TTL from the write-through entries so that keys never expire from the replacement node
Show the answer
Answer: B. Add lazy loading to the read path so that a cache miss queries the database and populates the cache, and keep the write-through updates
Write-through leaves a new or replaced node with missing data until each item is next written, so combining it with lazy loading refills the node on misses while writes keep the cache fresh. Switching to lazy loading only would also survive the node loss, but it brings back stale data because nothing updates the cache when the database changes.
Question 5
A developer maintains an internal CLI tool that calls AssumeRoleWithSAML with DurationSeconds set to 28800 (8 hours). The IAM role's maximum session duration is 12 hours, and the call succeeds. However, the returned credentials consistently expire after about 2 hours. What is the MOST likely cause?
- The SAML assertion's SessionNotOnOrAfter value is about 2 hours out, and the session ends at whichever is shorter
- AssumeRoleWithSAML ignores DurationSeconds and always issues credentials with the default lifetime
- The IAM SAML provider is in a different account from the role, so STS shortens the session
- The role's maximum session duration must be raised above 12 hours before an 8-hour session is honored
Show the answer
Answer: A. The SAML assertion's SessionNotOnOrAfter value is about 2 hours out, and the session ends at whichever is shorter
A SAML session ends at DurationSeconds or the assertion's SessionNotOnOrAfter, whichever is shorter, so the IdP's setting is capping the session. The default-lifetime distractor fails because the default is 3,600 seconds (1 hour), not 2 hours, and DurationSeconds is honored up to the role's maximum.
Question 6
A developer must move thousands of database passwords, each encrypted directly with AWS KMS under customer managed key A, so that they are protected by customer managed key B instead. A security requirement states that the plaintext passwords must never be present in the migration script's memory. Which approach meets the requirement with the correct permissions?
- Call ReEncrypt for each ciphertext, with kms:Decrypt allowed on key A and kms:Encrypt allowed on key B
- Call GenerateDataKeyWithoutPlaintext on key B and store the returned CiphertextBlob in place of each existing ciphertext
- Call ReEncrypt for each ciphertext, with kms:ReEncryptFrom allowed on key A and kms:ReEncryptTo allowed on key B
- Call Decrypt for each ciphertext and then Encrypt with key B, with kms:Decrypt allowed on key A and kms:Encrypt allowed on key B
Show the answer
Answer: C. Call ReEncrypt for each ciphertext, with kms:ReEncryptFrom allowed on key A and kms:ReEncryptTo allowed on key B
ReEncrypt decrypts and re-encrypts entirely inside KMS, so the script never sees plaintext, and it is authorised by kms:ReEncryptFrom on the source key and kms:ReEncryptTo on the destination key. Decrypt followed by Encrypt would work but returns the plaintext to the script, and kms:Decrypt plus kms:Encrypt are not the permissions ReEncrypt checks.
Question 7
A team's self-hosted build agent runs continuously. Its startup script runs `aws ecr get-login-password | docker login --username AWS --password-stdin` against the team's Amazon ECR registry once, when the agent boots. Pushes succeed on the day the agent starts, but every build on the following day fails with an authentication error. The agent's IAM role and the repository settings have not changed. What is the MOST appropriate fix?
- Change the repository's tag mutability from IMMUTABLE to MUTABLE so the agent can push again without re-authenticating
- Move the `get-login-password` and `docker login` step to the start of every build, because the authorization token is valid for only 12 hours
- Add the `ecr:PutImage` and layer-upload permissions to the agent's IAM role, because the push permissions are missing
- Replace the command with `aws ecr get-login`, which returns a long-lived credential for build servers
Show the answer
Answer: B. Move the `get-login-password` and `docker login` step to the start of every build, because the authorization token is valid for only 12 hours
The ECR authorization token expires after 12 hours, so a login done once at boot is stale the next day; logging in at the start of each build fixes it. Missing push permissions is the nearest distractor, but it would have failed the first day's pushes too, and the role has not changed.
Question 8
A developer promoted deployment dep9k2 to the prod stage of a REST API an hour ago, and it is returning wrong responses. The previous deployment, dep7x1, worked correctly. Since then, colleagues have made more untested edits to the API's resources in the console. The developer must restore the previous behaviour as quickly as possible without publishing the untested edits. What should the developer do?
- Run aws apigateway create-deployment with --stage-name prod and a description that references dep7x1
- Run aws apigateway create-deployment without --stage-name, so the prod stage falls back to the last working snapshot
- Run aws apigateway update-stage on prod with a patch operation that replaces /deploymentId with dep7x1
- Undo the faulty edits in the console and save each method, so the prod stage picks up the corrected configuration
Show the answer
Answer: C. Run aws apigateway update-stage on prod with a patch operation that replaces /deploymentId with dep7x1
A stage is only a pointer to an immutable deployment, so rollback means repointing prod's deploymentId at the earlier snapshot, dep7x1. Running create-deployment with --stage-name prod would snapshot the current working copy, including the colleagues' untested edits, and the description has no effect on what is deployed.
Question 9
A developer adds a manual approval action at the start of the Prod stage of an AWS CodePipeline pipeline and configures an Amazon SNS topic to notify the release manager. The release manager is on leave and nobody responds to the notification. The developer wants to know what will happen to the waiting execution if the approval is never answered. What is the outcome?
- The execution waits indefinitely until someone approves or rejects it, because approval actions have no timeout.
- The approval action is automatically approved after seven days so that the pipeline is not blocked.
- The execution is automatically rolled back to the last successful execution of the Staging stage after 24 hours.
- The approval action is marked as failed after seven days, so the execution does not proceed to the production deploy action.
Show the answer
Answer: D. The approval action is marked as failed after seven days, so the execution does not proceed to the production deploy action.
An unanswered manual approval times out after seven days and is treated the same as a rejection: the action fails and the deploy action behind it never runs. It does not wait forever, and CodePipeline never approves on a reviewer's behalf.
Question 10
A developer exposes a Lambda function through an edge-optimized Amazon API Gateway REST API using a Lambda proxy integration. A report-generation request takes about 40 seconds. Clients receive HTTP 504 with the message "Endpoint request timed out". The developer raises the Lambda function timeout from 30 to 60 seconds, but the 504 errors continue. What is the cause?
- The function is being throttled on concurrency, and API Gateway returns 504 once the SDK has used up its retry attempts
- The request exceeds the API Gateway integration timeout of 29 seconds, which the Lambda timeout does not change and which cannot be raised on an edge-optimized API
- The function returns a response whose body is a JSON object instead of a string, so API Gateway cannot map it to an HTTP response
- The function's resource-based policy does not allow apigateway.amazonaws.com to invoke it, so the request waits until it times out
Show the answer
Answer: B. The request exceeds the API Gateway integration timeout of 29 seconds, which the Lambda timeout does not change and which cannot be raised on an edge-optimized API
A 504 "Endpoint request timed out" means the integration ran past API Gateway's integration timeout (29 seconds by default for REST APIs, and not raisable on edge-optimized APIs), so API Gateway has hung up regardless of the Lambda timeout. A malformed proxy response is the nearest distractor, but that produces a 502, not a 504.
The full timed mock
65 questions in 130 minutes, with a pass mark of 72%. Each paper is drawn from a bank of questions written for the mock alone, and these 10 are left out of it. Full access opens it, with every level of the course.
LevelUpWith is independent of the organisation that sets this exam. These questions were written for this course; they are not taken from the exam.