CertifyDeck

DVA-C02 · Sample questions

DVA-C02 sample questions with answers and explanations

10 real questions from the CertifyDeck DVA-C02 bank, spread across the domains of the official AWS Certified Developer - Associate skills outline, with the correct answer and a full explanation of why the other options are wrong. They are original questions written from the public syllabus, not exam dumps, and they are the same style you will find in the practice tests and mock exams.

  1. Question 1Domain: SecurityEasy

    A developer has an Amazon API Gateway REST API. Users of a single-page app sign in to an Amazon Cognito user pool. Each API method must accept only requests that carry a valid token from that user pool, with the LEAST custom code. What should the developer do?

    • A.Create an API key and usage plan, and have the app send the API key in the x-api-key header of each call.
    • B.Set the methods to AWS_IAM authorization and have the app send the user pool token as the request signature.
    • C.Create a COGNITO_USER_POOLS authorizer and have the app send the user pool token in the Authorization header.
    • D.Add a resource policy that allows calls only from the app's domain and reject requests without an Origin header.
    Show answer and explanation

    Correct answer: C. Create a COGNITO_USER_POOLS authorizer and have the app send the user pool token in the Authorization header.

    Explanation

    A REST API authorizer of type COGNITO_USER_POOLS lets API Gateway validate the identity or access token that the client sends, typically in the Authorization header, without any custom code. AWS_IAM authorization requires requests signed with AWS credentials, not a user pool token. An API key identifies a client for usage plans and is not proof of user authentication, and a resource policy based on the caller's origin does not validate any token.

    Official references

  2. Question 2Domain: SecurityEasy

    An application connects to an Amazon RDS database with a username and password. Company policy requires the password to change automatically on a schedule, and the application must always read the current value at runtime. Which solution will meet these requirements with the LEAST operational overhead?

    • A.Store the credentials in AWS Secrets Manager and turn on automatic rotation for the secret.
    • B.Store the password as a Parameter Store SecureString parameter and update it with a scheduled script.
    • C.Encrypt the password with a KMS key that has automatic key rotation enabled and store the ciphertext.
    • D.Store the password in an encrypted Lambda environment variable that uses a customer managed key.
    Show answer and explanation

    Correct answer: A. Store the credentials in AWS Secrets Manager and turn on automatic rotation for the secret.

    Explanation

    Secrets Manager is the service AWS recommends for database credentials and provides automatic rotation with native database integrations, updating both the secret and the database. Parameter Store has no credential rotation, so a SecureString parameter would need a custom script that the team must build and run. KMS key rotation changes the key material that protects the ciphertext, not the database password itself.

    Official references

  3. Question 3Domain: SecurityMedium

    A SaaS application stores all tenants' orders in one DynamoDB table whose partition key is the tenant ID. A developer must ensure at the IAM level that each request can only read items of the calling tenant, and the solution must work for any number of tenants without creating a role per tenant. Which solution will meet these requirements?

    • A.Grant the service role full access to the table and filter the query results by tenant ID in the code.
    • B.Create one IAM role per tenant whose permissions policy names that tenant's ID in a dynamodb:LeadingKeys condition.
    • C.Assume a shared role with a TenantID session tag and match dynamodb:LeadingKeys to ${aws:PrincipalTag/TenantID}.
    • D.Add a dynamodb:Attributes condition to the service role that lists the attributes each tenant can read.
    Show answer and explanation

    Correct answer: C. Assume a shared role with a TenantID session tag and match dynamodb:LeadingKeys to ${aws:PrincipalTag/TenantID}.

    Explanation

    The dynamodb:LeadingKeys condition key restricts access to items whose partition key matches a value, and referencing ${aws:PrincipalTag/TenantID} lets one role serve every tenant because the tenant ID arrives as a session tag when the role is assumed. A role per tenant also isolates the data but fails the requirement to avoid creating roles for each tenant. dynamodb:Attributes limits which attributes can be accessed, not which items, and filtering in code gives no IAM-level enforcement.

    Official references

  4. Question 4Domain: Development with AWS ServicesEasy

    A mobile application must let users upload photos directly to an Amazon S3 bucket. The users must not receive any AWS credentials, and the photo files must not pass through the application's backend. The backend runs as an AWS Lambda function. Which solution will meet these requirements?

    • A.Add a bucket policy that allows s3:PutObject for any principal so that the app can upload anonymously.
    • B.Embed the access keys of an IAM user that has s3:PutObject permission in the mobile application.
    • C.Have the Lambda function use the AWS SDK to create a presigned URL for a PUT and return it to the app.
    • D.Send each photo to the Lambda function through Amazon API Gateway and call PutObject from the function.
    Show answer and explanation

    Correct answer: C. Have the Lambda function use the AWS SDK to create a presigned URL for a PUT and return it to the app.

    Explanation

    A presigned URL lets someone upload an object without having AWS security credentials or permissions of their own; it is limited by the permissions of the identity that created it and is valid only until it expires, and the client sends the file straight to S3 with an HTTP PUT. Routing every photo through API Gateway and Lambda works functionally but fails the requirement that files bypass the backend. Embedding IAM user keys puts long-term credentials in the app, and a bucket policy open to any principal lets anyone write to the bucket.

    Official references

  5. Question 5Domain: Development with AWS ServicesMedium

    A development team tests a Lambda function locally with sam local invoke. In production, the function fails because its execution role cannot write to an Amazon DynamoDB table, a problem that the local tests did not detect. The team wants automated tests that validate permissions between resources before code is promoted to production. What should the developer do?

    • A.Pass the table name to the local tests through the --env-vars option of sam local invoke.
    • B.Deploy the stack to a test environment in AWS and run integration tests against the deployed resources.
    • C.Generate more sample events with sam local generate-event and add them to the local tests.
    • D.Replace the DynamoDB calls with mocks in the unit tests so that the test suite runs faster.
    Show answer and explanation

    Correct answer: B. Deploy the stack to a test environment in AWS and run integration tests against the deployed resources.

    Explanation

    Local testing does not validate everything, such as permissions between resources in the cloud; tests that run against a deployed test environment cover security policies and configuration, and tools such as sam remote invoke or sam sync help with that workflow. Environment variables, mocks and extra sample events all keep the tests local or simulated, so the IAM problem would still go undetected.

    Official references

  6. Question 6Domain: Development with AWS ServicesMedium

    A DynamoDB table uses the current date as its partition key, so every write of a day goes to the same partition key value and requests are throttled. Items are read only by a nightly reporting job that reads all the items of a day; they are never read individually. Which solution will distribute the writes?

    • A.Add a random suffix to the date, and query each suffix in the job and merge results.
    • B.Add a local secondary index to the table that uses the item creation time as its sort key.
    • C.Use strongly consistent reads in the nightly reporting job for the same table.
    • D.Use the item creation time, rounded to the hour, as the partition key of the table.
    Show answer and explanation

    Correct answer: A. Add a random suffix to the date, and query each suffix in the job and merge results.

    Explanation

    Write sharding with a random suffix, such as the date followed by a number in a fixed range, spreads the writes of each day across many partition key values; the trade-off is that the reader must query every suffix and merge the results, which fits a job that reads whole days. A local secondary index keeps the same partition key, and a creation time rounded to the hour still sends all current writes to a single value.

    Official references

  7. Question 7Domain: DeploymentMedium

    A developer has an AWS CloudFormation template in which the Code property of an AWS::Lambda::Function resource points to a local folder and the BodyS3Location property of an AWS::ApiGateway::RestApi resource points to a local OpenAPI file. A CI script must deploy the template by using the AWS CLI. Which approach will meet these requirements?

    • A.Run aws cloudformation create-change-set with the local template so that CloudFormation uploads the files.
    • B.Run aws cloudformation package to upload the local artifacts to S3, then deploy the template it returns.
    • C.Run aws cloudformation validate-template, which uploads the local artifacts, and then deploy the template.
    • D.Run aws cloudformation deploy directly, because CloudFormation reads local paths on the machine that runs it.
    Show answer and explanation

    Correct answer: B. Run aws cloudformation package to upload the local artifacts to S3, then deploy the template it returns.

    Explanation

    The aws cloudformation package command uploads local artifacts referenced in properties such as Code of AWS::Lambda::Function and BodyS3Location of AWS::ApiGateway::RestApi to an S3 bucket and returns a copy of the template with the S3 locations, which is then deployed. CloudFormation itself works with artifacts in S3, not with paths on the build machine, so deploying or creating a change set from the raw template does not upload the files. Validating a template checks its syntax and uploads nothing.

    Official references

  8. Question 8Domain: DeploymentEasy

    A developer must update a production AWS CloudFormation stack with a modified template. Before anything is changed, the team must see which resources CloudFormation will add, modify, or replace, and then decide whether to proceed. What should the developer do to meet these requirements?

    • A.Create a change set from the modified template, review it, and execute it only if the changes are acceptable.
    • B.Run the update with rollback disabled so that the team can inspect any changes before they are reverted.
    • C.Run validate-template on the modified template to list the resources that the stack update will replace.
    • D.Set a stack policy that denies Update:* so that CloudFormation reports the planned changes instead of applying them.
    Show answer and explanation

    Correct answer: A. Create a change set from the modified template, review it, and execute it only if the changes are acceptable.

    Explanation

    A change set lets the team preview how proposed changes affect running resources, including whether resources will be added, modified, deleted or replaced, and CloudFormation changes the stack only when the change set is executed. Disabling rollback applies the changes first, so it does not provide a preview. validate-template only checks that the template is valid JSON or YAML, and a stack policy blocks updates to protected resources without reporting the planned changes.

    Official references

  9. Question 9Domain: Troubleshooting and OptimizationMedium

    An AWS Lambda function processes messages from two Amazon SQS queues through two event source mappings. Bursts in the low-priority queue use so much concurrency that messages from the high-priority queue wait. The developer must cap the concurrency that only the low-priority queue can use. What should the developer do to meet this requirement?

    • A.Configure provisioned concurrency on an alias of the function and point both event source mappings to it.
    • B.Reduce the batch size of the event source mapping for the low-priority queue so each invocation gets fewer messages.
    • C.Set MaximumConcurrency in the scaling configuration of the event source mapping for the low-priority queue.
    • D.Configure reserved concurrency on the function with a value equal to the cap for the low-priority queue.
    Show answer and explanation

    Correct answer: C. Set MaximumConcurrency in the scaling configuration of the event source mapping for the low-priority queue.

    Explanation

    Maximum concurrency is an event source-level setting: each SQS event source mapped to a function can have its own value, which prevents one queue from using all of the function's concurrency. Reserved concurrency applies to the whole function, so setting it to the low-priority cap would also limit the high-priority queue. Provisioned concurrency pre-initializes environments to reduce cold starts but does not cap a queue, and a smaller batch size can increase the number of invocations instead of limiting them.

    Official references

  10. Question 10Domain: Troubleshooting and OptimizationMedium

    An Amazon API Gateway REST API has caching enabled on its prod stage. A GET method returns data for the tenant identified by the X-Tenant-Id request header. After caching was enabled, some tenants started to receive data that belongs to other tenants. What should the developer do to fix this issue while keeping the cache?

    • A.Reduce the TTL of the stage cache so that each cached response is kept for a shorter time.
    • B.Ask clients to send the Cache-Control: max-age=0 header so that each request refreshes the entry.
    • C.Add method.request.header.X-Tenant-Id to the cache key parameters of the method integration.
    • D.Flush the stage cache every time a tenant reports that it received data from another tenant.
    Show answer and explanation

    Correct answer: C. Add method.request.header.X-Tenant-Id to the cache key parameters of the method integration.

    Explanation

    API Gateway can use method or integration parameters, including custom headers, as cache keys, and caches the responses for each key value separately, so adding the tenant header to the cache key parameters keeps one cached response per tenant. Flushing the cache or shortening the TTL only reduces how long a wrong response is served. Sending Cache-Control: max-age=0 makes every request bypass and replace the cached entry, which defeats the purpose of the cache.

    Official references

How to use these DVA-C02 sample questions

Answer each question before opening the explanation, and write down why you discarded the other options. On DVA-C02, most mistakes come from choosing an option that is technically possible but does not meet every requirement in the scenario.

These 10 questions are a taste of the format, not a diagnostic. To know which domains you fail, practice by domain for free and take a timed mock exam that mirrors the official weights and duration.

Practice DVA-C02 with hundreds more questions

Start for free, no sign-up or card. Every question includes an explanation like the ones above, and the mock exam reproduces the official DVA-C02 format.