SaveMyCert
Log in
5 of 5 free questions left today·for 30 a day
DVA-C03 · Domain 2

Security practice questions

Security is worth 26% of the DVA-C03 exam — the 2nd-heaviest of the 4 domains. Securing applications: identity federation, fine-grained access, IAM roles and programmatic access, presigned URLs, encryption and key management, certificates, sensitive-data handling and secrets — plus the security of AI services and agents used in applications. Official weighting 26%. 6 fully worked examples are further down this page, answers included.

Exam weight
26%
the 2nd-heaviest of the 4 domains
Questions
126
across 3 topics
Free, no account
5/day
a free account allows 30 a day
Explanations
Every option
right and wrong

Build a practice session

5 free questions left today.

Domains

How many?

Mode

Ready when you are

10 fresh questions drawn across 1 of 4 domains, in Learn mode.

Review what you missed

Every question you answer incorrectly, and every question you flag while practising, is saved here automatically. Finish a session and you can come back to re-drill just those.

6 sample Security questions, fully explained

Questions from the DVA-C03 bank mapped to domain 2, with the answer key and the reasoning behind every option. None of them repeat the examples on the main DVA-C03 practice page.

Question 1Security

A developer's GitHub Actions workflow deploys an application to AWS. The workflow authenticates with an IAM user's access key that is stored as a repository secret. A security review requires the team to remove every long-term AWS credential from the CI system while the workflow keeps deploying. What should the developer do?

Choose one.

  • a
    Create an IAM SAML identity provider for GitHub and have the workflow assume a deployment role with AssumeRoleWithSAML

    GitHub Actions issues OIDC tokens to workflows, not SAML assertions, so there is no SAML response for the workflow to present.

  • b
    Store the IAM user's access key in AWS Secrets Manager and have the workflow read it at the start of each run

    The workflow still needs credentials to read the secret, and the access key it retrieves is still a long-term credential.

  • c
    Create an IAM OIDC provider for GitHub and have the workflow assume a deploy role with web identity federation Correct

    GitHub issues the workflow a signed OIDC token. The workflow exchanges it for temporary credentials with AssumeRoleWithWebIdentity, so no access key is stored anywhere.

  • d
    Keep the IAM user's access key in the repository secret and rotate the key each day with a scheduled AWS Lambda function

    Frequent rotation shortens exposure but the stored key is still a long-term credential, which the review forbids.

The concept

External workloads that can present an OIDC token can obtain temporary AWS credentials through web identity federation.

Why that’s the answer

The requirement is no long-term credentials in CI. GitHub Actions can request an OIDC token for each job. With an IAM OIDC identity provider for token.actions.githubusercontent.com and a role that trusts it, the workflow calls AssumeRoleWithWebIdentity (for example through the aws-actions/configure-aws-credentials action) and receives short-lived credentials. Moving or rotating the access key keeps a long-term credential, and GitHub does not issue SAML assertions to workflows.

How to reason it out
  1. Identify that the requirement is to eliminate long-term keys, not to protect them better.
  2. Recall that GitHub Actions can issue an OIDC token to each job.
  3. Trust that token with an IAM OIDC identity provider and a role.
  4. Use AssumeRoleWithWebIdentity to get temporary credentials.

Exam tip: CI systems that issue OIDC tokens should assume a role with web identity federation instead of storing access keys.

DVA-C03 Authentication and Authorization: IAM, Cognito, STS and Signed URLs — the lesson that teaches this.

Question 2Security

A developer created a role for GitHub Actions deployments. Its trust policy allows sts:AssumeRoleWithWebIdentity for the federated principal token.actions.githubusercontent.com with one condition: StringEquals on token.actions.githubusercontent.com:aud set to sts.amazonaws.com. A reviewer warns that workflows outside the company could assume the role. Only the main branch of the example-org/app repository may assume it. Which entry should the developer add to the StringEquals condition?

Choose one.

  • a
    "token.actions.githubusercontent.com:sub": "repo:example-org/app:pull_request"

    This sub value matches only tokens from pull-request workflows, so deployments from the main branch fail the check and the requirement is not met.

  • b
    "token.actions.githubusercontent.com:sub": "repo:example-org/app:ref:refs/heads/main" Correct

    The sub claim identifies the repository and ref that requested the token. Matching it exactly limits the role to that repository's main branch.

  • c
    "token.actions.githubusercontent.com:sub": "repo:example-org/*:ref:refs/heads/main"

    StringEquals treats the asterisk literally, so no token matches and deployments break. Even with StringLike it would admit every repository in the organization.

  • d
    "sts:RoleSessionName": "example-org-app-main"

    The workflow chooses its own session name, so a caller from any repository could supply this value. It does not prove where the token came from.

The concept

In web identity federation, the trust policy must check the token's subject claim, not just its audience.

Why that’s the answer

With only the aud condition, any GitHub Actions workflow anywhere can obtain a token whose audience is sts.amazonaws.com, so the role is open to every GitHub repository. The sub claim carries repo:<owner>/<repo>:ref:<ref>, issued by GitHub and signed. Adding an exact StringEquals match on sub restricts the role to the main branch of example-org/app. A sub value for pull_request matches the wrong workflows, a wildcard does not work with StringEquals and would be too broad anyway, and the session name is caller-controlled.

How to reason it out
  1. See that the existing condition only checks the token audience.
  2. Identify the claim that names the repository and branch: sub.
  3. Use an exact match because only one branch of one repository is allowed.
  4. Reject conditions on values the caller controls or that wildcards make too broad.

Exam tip: For OIDC roles, aud says the token is for AWS; sub says who it is. Always pin sub.

DVA-C03 Authentication and Authorization: IAM, Cognito, STS and Signed URLs — the lesson that teaches this.

Question 3Security

A developer is adding access control to an Amazon API Gateway REST API. Users of the web front end already sign in through an Amazon Cognito user pool and receive JSON Web Tokens. The API must reject requests that lack a valid token from that user pool, and the team does not want to write or maintain any authorization code. What should the developer configure?

Choose one.

  • a
    A Lambda authorizer on the API methods that validates tokens from the existing user pool

    This works, but the team would write and maintain the token-validation function, which the stem rules out.

  • b
    IAM authorization on the API methods with permissions granted to the existing user pool

    IAM authorization requires SigV4-signed requests made with AWS credentials. The front end holds user pool tokens, not AWS credentials.

  • c
    An API key and usage plan on the API methods, issuing one key per user in the user pool

    API keys identify clients for throttling and quotas. They are not an authentication mechanism and do not validate user tokens.

  • d
    A Cognito user pool authorizer on the API methods that uses the existing user pool Correct

    API Gateway validates the user pool token itself, including signature and expiry, with no custom code.

The concept

API Gateway REST APIs have a built-in authorizer type for Amazon Cognito user pools.

Why that’s the answer

The users already hold Cognito user pool tokens, and the constraint is no authorization code. A COGNITO_USER_POOLS authorizer lets API Gateway check the token against the user pool directly. A Lambda authorizer would also work but is custom code to maintain. IAM authorization expects AWS-signed requests, and API keys are for usage plans rather than authentication.

How to reason it out
  1. Note where the tokens come from: a Cognito user pool.
  2. Note the constraint: no custom authorization code.
  3. Pick the built-in authorizer for that token source.
  4. Reject API keys, which are not authentication.

Exam tip: Cognito user pool tokens on a REST API: use the Cognito authorizer; reach for a Lambda authorizer only when you need custom logic.

DVA-C03 Authentication and Authorization: IAM, Cognito, STS and Signed URLs — the lesson that teaches this.

Question 4Security

A company's partners call an Amazon API Gateway REST API with bearer tokens issued by a third-party OAuth provider. Before a request reaches the backend, the API must validate the token and then look up the partner's subscription tier in an Amazon DynamoDB table to decide whether the requested resource is allowed. Which access control should the developer use?

Choose one.

  • a
    A REQUEST Lambda authorizer that validates the token and returns a policy based on the partner's tier Correct

    A Lambda authorizer runs custom code, so it can validate the third-party token, read DynamoDB and return an Allow or Deny policy for the method.

  • b
    A Cognito user pool authorizer configured with the third-party provider's issuer URL to check each token

    A Cognito user pool authorizer accepts tokens issued by Cognito user pools only. It cannot be pointed at another issuer.

  • c
    An HTTP API JWT authorizer that validates the token against the provider's issuer and audience

    A JWT authorizer can validate the third-party token, but it cannot look up the tier in DynamoDB before allowing the request. JWT authorizers are also an HTTP API feature, and this is a REST API.

  • d
    IAM authorization that requires each partner request to be signed with Signature Version 4

    IAM authorization requires SigV4-signed requests with AWS credentials. The partners present OAuth bearer tokens instead.

The concept

A Lambda authorizer is the API Gateway option for custom token types and authorization decisions that need extra data.

Why that’s the answer

Two requirements decide this: the tokens come from a non-Cognito provider, and authorization depends on data in DynamoDB. Only a Lambda authorizer runs arbitrary code before the integration, returning an IAM policy and principal ID. A JWT authorizer covers the token validation but not the lookup. The Cognito authorizer only trusts Cognito user pools, and IAM authorization needs AWS-signed requests.

How to reason it out
  1. Identify the token issuer: a third-party OAuth provider.
  2. Identify the extra decision: a DynamoDB lookup per partner.
  3. Choose the authorizer type that runs custom code.
  4. Check that each rejected option fails one of those two needs.

Exam tip: Custom token sources or data-driven authorization on API Gateway mean a Lambda authorizer.

DVA-C03 Authentication and Authorization: IAM, Cognito, STS and Signed URLs — the lesson that teaches this.

Question 5Security

A REST API uses a TOKEN Lambda authorizer with caching enabled (TTL 300 seconds). The authorizer returns an Allow policy whose Resource is the event's methodArn. Users report that after calling GET /profile, their calls to GET /orders return 403 for a few minutes, even though they may use both. The team wants each user's token to invoke the authorizer as few times as possible. What should the developer do?

Choose one.

  • a
    Set the authorizer's result TTL to 0 seconds so that every request runs the authorizer function

    This removes the 403 but disables caching, so the authorizer runs on every request, which is the opposite of the stated goal.

  • b
    Change to a REQUEST authorizer whose identity sources are the Authorization header and the method path

    Adding the path to the cache key would also fix the 403, but it creates a separate cache entry per path, so the authorizer runs more often than with one broad policy.

  • c
    Return a Deny policy for the methods the user may not call alongside the Allow policy for the methodArn

    The cached policy would still only allow the first method's ARN, so other allowed methods keep returning 403 until the cache expires.

  • d
    Return a policy that allows every method and resource the user may call instead of only the methodArn Correct

    The cached policy is reused for the same token on every method. A policy that covers all of the user's allowed resources is correct for whichever method hits the cache, and the authorizer still runs once per token per TTL.

The concept

API Gateway caches a Lambda authorizer's policy by the token and applies it to every method the token calls during the TTL.

Why that’s the answer

With a TOKEN authorizer, the cache key is the token. The first call caches a policy that allows only GET /profile, and API Gateway evaluates that cached policy for GET /orders, which it does not cover, so the request is denied until the entry expires. Returning a policy covering all of the caller's permitted resources (for example the API ARN with wildcards for the allowed methods) fixes it while keeping one authorizer call per token per TTL. A TTL of 0 and a per-path cache key both work but increase invocations, which breaks the constraint.

How to reason it out
  1. Recall that the TOKEN authorizer cache key is the token alone.
  2. See that the cached policy names only the first method's ARN.
  3. Make the policy valid for every method the user is allowed to call.
  4. Compare the workable fixes by authorizer invocations, the stated constraint.

Exam tip: With authorizer caching, return a policy that fits every method the token can reach, not just the methodArn.

DVA-C03 Authentication and Authorization: IAM, Cognito, STS and Signed URLs — the lesson that teaches this.

Question 6Security

A REST API method uses an Amazon Cognito user pool authorizer, and the developer configured the OAuth scope orders/read on the method. The single-page app signs users in through the user pool and calls the method with the user's ID token in the Authorization header. Every call returns 401 Unauthorized, although the tokens are valid and unexpired. What should the developer change?

Choose one.

  • a
    Send the user's refresh token in the Authorization header instead of the ID token

    Refresh tokens are only used to obtain new ID and access tokens from Cognito. API Gateway does not accept them for authorization.

  • b
    Allow the orders/read scope on the app client and keep sending the ID token in the header

    Allowing the scope on the app client lets it appear in the access token, but the ID token still has no scope claim, so the method keeps rejecting it.

  • c
    Send the identity pool's identity ID in the Authorization header instead of the ID token

    An identity ID is not a token and is not validated by a Cognito user pool authorizer.

  • d
    Send the user's access token in the Authorization header instead of the ID token Correct

    When a method has OAuth scopes, API Gateway checks the scope claim, which is in the access token. ID tokens carry identity claims, not scopes.

The concept

Cognito ID tokens prove identity; access tokens carry OAuth scopes for authorizing API calls.

Why that’s the answer

A Cognito authorizer accepts either token type, but once authorization scopes are set on the method, API Gateway requires a token whose scope claim includes one of them. Only the access token has scopes. The fix is to send the access token. Allowing the scope on the app client is needed for it to appear in the access token, but it does not change the ID token. Refresh tokens and identity IDs are not accepted.

How to reason it out
  1. Note that the method has OAuth scopes configured.
  2. Recall which Cognito token carries the scope claim: the access token.
  3. Send that token to the method.
  4. Reject changes that leave the ID token in place.

Exam tip: Scopes on a Cognito-authorized method mean the client must send the access token.

DVA-C03 Authentication and Authorization: IAM, Cognito, STS and Signed URLs — the lesson that teaches this.

What DVA-C03 domain 2 tests, topic by topic

The official exam guide breaks Security into 3 topics. The question bank follows the same split, so a weak topic shows up as a cluster of misses you can go back and read.

Published DVA-C03 practice questions per topic in Security
TopicWhat it coversQuestions
Implement authentication and authorization mechanisms for applications and AWS servicesOfficial DVA-C03 Task 2.1 skills: (1) Implement identity federation. (2) Implement access control (for example, fine-grained permissions, security tokens, MFA). (3) Configure programmatic access to AWS. (4) Use presigned URLs to provide secure, time-limited access (for example, by using Amazon S3 and Amazon CloudFront). (5) Make authenticated calls to AWS services. (6) Define permissions for IAM principals (for example, users, roles, services) and resources. (7) Assume an IAM role.42
Implement encryption and manage sensitive data by using AWS servicesOfficial DVA-C03 Task 2.2 skills: (1) Apply encryption at rest and in transit. (2) Manage certificates by using AWS services (for example, AWS Certificate Manager, AWS Private CA). (3) Select and apply client-side or server-side encryption. (4) Use encryption keys to encrypt and decrypt data. (5) Generate certificates and SSH keys for development purposes. (6) Identify, mask, and limit access to sensitive data (for example, personally identifiable information [PII], protected health information [PHI]) by using AWS services. (7) Use secret management services to secure sensitive data.42
Identify and mitigate security risks associated with using and integrating AI services into application developmentOfficial DVA-C03 Task 2.3 skills: (1) Request and manage access to AI services. (2) Use data privacy controls to transmit data to AI services (for example, by using VPC endpoints to establish private connectivity, ensuring that inputs and outputs are not used to train AI models). (3) Filter and control AI model inputs and outputs (for example, by applying content filtering, sensitive information detection, PII/PHI redaction, denied topic policies, prompt injection and manipulation protection). (4) Secure AI agent interactions (for example, by using tool-use authorization, session isolation, human-in-the-loop approval flows for sensitive actions). (5) Protect sensitive content in monitoring logs during interactions with AI services.42
Total126

Revise Security before you drill it

Other DVA-C03 domains

Security: your questions

Security is domain 2 of the DVA-C03 exam guide and carries 26% of the scored content — the 2nd-heaviest of the 4 domains. On a 65-question paper that works out to roughly 17 questions, though AWS does not publish an exact per-domain count and individual exam forms vary.

Source

The domain weight and topic list on this page come from the official DVA-C03 exam guide.