AWS Certified Developer - Associate (DVA-C02) · AWS

Security

12 practice questions covering 26% of the official AWS Certified Developer - Associate (DVA-C02) blueprint. Every item includes a worked explanation of the correct answer.

View all 4 domains in AWS Certified Developer - Associate (DVA-C02)

Syllabus Coverage & Domain Overview

Security is the largest-weighted area after development with AWS services, at 26 percent of the DVA-C02 scored content. The official outline splits it into three tasks: implementing authentication and authorization for applications and AWS services, implementing encryption with AWS services, and managing sensitive data in application code. The emphasis throughout is on what a developer builds into an application, not on how an administrator runs an account.

The first task covers federated access through identity providers, bearer tokens, programmatic access, assuming IAM roles, defining IAM permissions, fine-grained authorization inside the application, and authentication between services in a microservices design. The distinctions that matter are between a user directory that signs people in and issues tokens, and a mechanism that exchanges an identity for temporary AWS credentials. You also need to know when a role is assumed instead of a long-lived key being used, how cross-account access depends on both a trust policy and a permissions policy, and how a permissions boundary or similar guardrail limits what a developer-created role can ever do. Applications running on AWS compute should get credentials from a role, never from keys stored in code or configuration.

The second task covers encryption at rest and in transit, certificate management (the outline names AWS Private CA as an example), client-side versus server-side encryption, using and rotating keys, and cross-account encryption. Be clear on who holds the key and who performs the encryption in each option. Know how envelope encryption works, why a data key is used for large payloads instead of sending the payload to the key service, and how key policies and grants decide which principals, including those in another account, may use a key. Server-side options with service-managed keys, customer managed keys and customer-supplied keys differ in control, auditability and operational burden.

The third task covers classifying data such as personal and health information, encrypting environment variables, using secret management services, and sanitizing or masking sensitive data. The usual comparison is between a dedicated secrets service with built-in rotation and a general-purpose parameter store, and the choice often turns on rotation requirements, cost and the type of secret.

Questions are usually short scenarios with a stated compliance or operational requirement, such as no long-lived credentials, automatic rotation, an audit trail for every use of a key, or access from another account. Several options will often work technically, and the right answer is the one that meets every stated constraint with the least custom code. Common traps include granting broad permissions where least privilege is asked for, forgetting that cross-account access needs permission on both sides, confusing authentication with authorization, and picking a manual approach where a managed feature already does the job. Watch for answers that put secrets in code, in plain environment variables or in logs.

To prepare, work through each task in a real account. Create a role and assume it from another account, set up a user directory and trace the tokens it issues, encrypt an object under a customer managed key and read the key policy, and rotate a database secret. Then read the official exam guide task by task and make sure you can explain each named skill in your own words.

In the official AWS Certified Developer - Associate (DVA-C02) examination blueprint, Security carries a weightage of 26%. Out of the total examination duration of 2 hr 10 min, candidates should budget approximately 34 min for questions from this domain to maintain pace across the paper.

How to Master Security for AWS Certified Developer - Associate (DVA-C02)

Our 12 published questions in Security are written for PrepIQ Hub and checked as set out in our editorial policy. Each item is written to the medium difficulty level of the AWS exam:

  • Targeted Topic Drills: Launch Topic Practice mode to work exclusively through Security items and review the step-by-step derivation after each submission.
  • Negative Marking Discipline: The AWS Certified Developer - Associate (DVA-C02) applies no negative marking penalty, so practice eliminating the three distractors systematically on every Security item.
  • Benchmark Target: Aim for at least 72% accuracy in Security drills before moving to full-paper simulations.

Security worked examples

Security questions from the AWS Certified Developer - Associate (DVA-C02) syllabus, answered in full. Try each one before opening the explanation.

  1. Example 1 · Security · hard

    A central platform security team allows application developers to create their own IAM execution roles for AWS Lambda functions, but must guarantee that no developer-created IAM role can ever exceed a maximum privilege ceiling (for example, developers may grant s3:* and dynamodb:*, but even if a developer attaches AdministratorAccess to a new Lambda role, the role must never be able to call iam:* or organizations:*). Which IAM feature enforces this maximum permission ceiling on delegated role creation?

    • AAttach an IAM Permissions Boundary policy to each developer-created Lambda role
    • BStore the Lambda function deployment zip in an unencrypted public S3 bucket
    • CUse an Amazon S3 Bucket ACL instead of IAM execution roles on the function
    • DReplace IAM roles with hardcoded AWS root account access keys in env variables
    Show answer and explanation

    Correct answer: A. Attach an IAM Permissions Boundary policy to each developer-created Lambda role

    Why

    An IAM Permissions Boundary is a managed policy attached to an IAM user or role that defines the maximum permissions that entity can ever have. The effective permissions are the intersection of the identity-based policy and the permissions boundary — preventing privilege escalation when developers create new Lambda execution roles.

    • B. Store the Lambda function deployment zip in an unencrypted public S3 bucket — Public S3 buckets decrease security and have no effect on IAM role privilege escalation.
    • C. Use an Amazon S3 Bucket ACL instead of IAM execution roles on the function — S3 Bucket ACLs are legacy object-storage controls and cannot restrict iam:* or organizations:* API calls.
    • D. Replace IAM roles with hardcoded AWS root account access keys in env variables — Using root access keys violates every AWS security best practice and bypasses IAM boundaries.
  2. Example 2 · Security · medium

    A mobile fitness app needs: (1) a managed user directory supporting sign-up, sign-in, MFA, and social login (Sign in with Apple/Google) that issues OIDC JWT tokens to call an Amazon API Gateway endpoint, and (2) a way for signed-in premium users to obtain temporary, limited-privilege AWS STS credentials so the mobile app can upload workout videos directly to a user-specific prefix in an Amazon S3 bucket (s3://workouts-bucket/${cognito-identity.amazonaws.com:sub}/*). How should Amazon Cognito be configured?

    • AUse a Cognito Identity Pool alone for password sign-up and a User Pool for STS S3 keys
    • BUse a Cognito User Pool for sign-in/JWTs and a Cognito Identity Pool for STS S3 keys
    • CEmbed long-lived IAM User access keys inside the mobile app binary for S3 uploads
    • DUse AWS KMS asymmetric key policies to issue OAuth 2.0 refresh tokens to mobile users
    Show answer and explanation

    Correct answer: B. Use a Cognito User Pool for sign-in/JWTs and a Cognito Identity Pool for STS S3 keys

    Why

    Amazon Cognito User Pools act as the user directory/IdP that handles sign-up, sign-in, and MFA and issues JWTs for API Gateway (B), while Amazon Cognito Identity Pools (Federated Identities) exchange a User Pool JWT (or social IdP token) for temporary AWS STS credentials mapped to an IAM role for direct AWS service access like S3 (C).

    • A. Use a Cognito Identity Pool alone for password sign-up and a User Pool for STS S3 keys — This reverses the two components: User Pools manage user sign-up/passwords, whereas Identity Pools vend temporary STS AWS credentials.
    • C. Embed long-lived IAM User access keys inside the mobile app binary for S3 uploads — Embedding static IAM credentials in a client mobile binary is a critical security vulnerability.
    • D. Use AWS KMS asymmetric key policies to issue OAuth 2.0 refresh tokens to mobile users — AWS KMS manages cryptographic keys, not user sign-up directories or federated STS sessions.
  3. Example 3 · Security · hard

    A regulated enterprise stores files in an Amazon S3 bucket encrypted with an AWS KMS Customer Managed Key (SSE-KMS). Auditors require that: (1) every individual encrypt/decrypt call be logged in AWS CloudTrail with the specific key ARN, (2) administrators can rotate the backing cryptographic key material every 365 days automatically, and (3) a cross-account Lambda function can be granted decrypt access via the key's resource policy. Which two statements accurately distinguish SSE-KMS (Customer Managed Key) from SSE-S3 (AES-256 Amazon S3-managed keys)? (Select two.)

    • ASSE-S3 allows cross-account Key Policies and logs object decrypts in KMS CloudTrail
    • BSSE-KMS (CMK) supports custom Key Policies for cross-account access and key rotation
    • CSSE-KMS requires the client browser to send the raw 256-bit key in HTTP headers (SSE-C)
    • DSSE-KMS records Decrypt and GenerateDataKey audit events in AWS CloudTrail
    Show answer and explanation

    Correct answers: B. SSE-KMS (CMK) supports custom Key Policies for cross-account access and key rotation; D. SSE-KMS records Decrypt and GenerateDataKey audit events in AWS CloudTrail

    Why

    Unlike SSE-S3, SSE-KMS with a Customer Managed Key (CMK) allows you to configure a custom Key Policy (required for cross-account access) and enable automatic or on-demand key rotation (B), and it logs every individual Encrypt, Decrypt, and GenerateDataKey invocation in AWS CloudTrail (plus enforces KMS request-per-second quotas, which can be optimized by enabling S3 Bucket Keys) (D).

    • A. SSE-S3 allows cross-account Key Policies and logs object decrypts in KMS CloudTrail — SSE-S3 uses an AWS-owned S3 key with no user-configurable Key Policy and no per-key KMS CloudTrail events.
    • C. SSE-KMS requires the client browser to send the raw 256-bit key in HTTP headers (SSE-C) — Sending raw keys in HTTP headers describes SSE-C (Customer-Provided Keys), not SSE-KMS.
  4. Example 4 · Security · hard

    A developer needs to encrypt a 50 MB sensitive PDF file locally on an application server before uploading it to an on-premises archive, using an AWS KMS Customer Managed Key (CMK). However, the AWS KMS Encrypt API operation accepts a maximum plaintext payload of 4,096 bytes (4 KB). Which two steps implement AWS KMS Envelope Encryption to encrypt the 50 MB file? (Select two.)

    • ASplit the 50 MB PDF into 13,000 chunks of 4 KB and call kms:Encrypt 13,000 times
    • BCall kms:GenerateDataKey to obtain a plaintext data key and an encrypted data key
    • CEncrypt the 50 MB file locally with the plaintext key and store the encrypted key
    • DExport the raw KMS root key material in cleartext to the server's /tmp directory
    Show answer and explanation

    Correct answers: B. Call kms:GenerateDataKey to obtain a plaintext data key and an encrypted data key; C. Encrypt the 50 MB file locally with the plaintext key and store the encrypted key

    Why

    Because kms:Encrypt is limited to 4 KB, files larger than 4 KB use Envelope Encryption: (B) call kms:GenerateDataKey to receive both a plaintext data key and an encrypted data key (CiphertextBlob) (B), and (C) use the plaintext data key locally to encrypt the 50 MB file, store the encrypted data key alongside the encrypted file, and immediately wipe the plaintext data key from memory (C).

    • A. Split the 50 MB PDF into 13,000 chunks of 4 KB and call kms:Encrypt 13,000 times — Making 13,000 network calls to kms:Encrypt throttles the KMS API quota and adds extreme latency.
    • D. Export the raw KMS root key material in cleartext to the server's /tmp directory — AWS KMS never exports the raw key material of a KMS-generated CMK in cleartext.
  5. Example 5 · Security · easy

    A healthcare microservice connects to an Amazon RDS for MySQL database. Compliance requires that the database master password be automatically rotated every 30 days without any manual developer intervention or application redeployment. Which AWS service natively stores the database credentials and executes an automated Lambda rotation schedule integrated with Amazon RDS?

    • AAWS Systems Manager Parameter Store Standard tier with plaintext string parameters
    • BHardcoding the password inside a CloudFormation Outputs value
    • CAWS Secrets Manager with native automatic RDS credential rotation enabled
    • DAmazon S3 Object Lock in Compliance mode storing an immutable static .env file
    Show answer and explanation

    Correct answer: C. AWS Secrets Manager with native automatic RDS credential rotation enabled

    Why

    AWS Secrets Manager is the service built for this requirement. It stores database credentials encrypted with AWS KMS and can rotate them on a schedule, such as every 30 days. For Amazon RDS engines including MySQL, rotation is native: Secrets Manager deploys an AWS-provided rotation Lambda function that connects to the database, changes the password, and updates the secret through staged versions. The application retrieves the secret at runtime with the GetSecretValue API call, so it always receives the current password without code changes or redeployment. That satisfies the 'no manual intervention' and 'no redeployment' constraints in the question. The common trap is picking Systems Manager Parameter Store because it also holds configuration and can use SecureString encryption. However, Parameter Store has no built-in rotation mechanism for database passwords, so you would have to build and schedule that logic yourself. For the exam, remember that automatic rotation of database credentials points to Secrets Manager.

    • A. AWS Systems Manager Parameter Store Standard tier with plaintext string parameters — Parameter Store Standard tier can hold plaintext String parameters or encrypted SecureString parameters, but it has no native rotation feature for RDS passwords. Rotation would need custom code and scheduling, and a plaintext String parameter gives no protection for a credential.
    • B. Hardcoding the password inside a CloudFormation Outputs value — CloudFormation Outputs publish values from a stack and are visible in the console and API to anyone who can describe the stack. Hardcoding a password there exposes it, and it does nothing to rotate the RDS master password.
    • D. Amazon S3 Object Lock in Compliance mode storing an immutable static .env file — S3 Object Lock in Compliance mode makes object versions immutable (write-once-read-many) for a retention period. That is the opposite of rotating a credential, and storing a static .env file does not change the RDS password or integrate with RDS.
  6. Example 6 · Security · medium

    An AWS Lambda function in Account A (111122223333) needs to read objects from an Amazon S3 bucket in Account B (444455556666) by assuming an IAM role named arn:aws:iam::444455556666:role/CrossAccountS3Reader in Account B. When the Lambda function calls the AWS STS AssumeRole API, what does AssumeRole return, and how must the two accounts' IAM policies be configured?

    • AReturns a permanent root X.509 cert; disables IAM in Account B
    • BReturns temporary AccessKeyId, SecretAccessKey, and SessionToken via Trust Policy
    • CReturns a Cognito User Pool JWT password hash; requires VPC Peering between Account A and B
    • DReturns an unencrypted KMS master key; requires an S3 Bucket ACL set to public-read-write
    Show answer and explanation

    Correct answer: B. Returns temporary AccessKeyId, SecretAccessKey, and SessionToken via Trust Policy

    Why

    sts:AssumeRole returns a set of temporary security credentials consisting of an AccessKeyId, SecretAccessKey, and SessionToken (valid for 15 minutes to 12 hours). For cross-account role assumption to succeed, Account A's Lambda execution role must have an identity-based policy allowing sts:AssumeRole on Account B's role ARN, AND Account B's role must have a Trust Policy (AssumeRolePolicyDocument) allowing Account A's principal to assume it.

    • A. Returns a permanent root X.509 cert; disables IAM in Account B — STS never returns root certificates or disables IAM.
    • C. Returns a Cognito User Pool JWT password hash; requires VPC Peering between Account A and B — STS AssumeRole operates over the IAM/STS control plane without VPC peering or Cognito passwords.
    • D. Returns an unencrypted KMS master key; requires an S3 Bucket ACL set to public-read-write — Cross-account STS role assumption keeps the S3 bucket completely private.

Every worked example on this page passed our independent verification before publication — how that works is set out in our editorial policy. Spotted an error? Tell us through the contact page and we will correct it.

All 6 Security questions with answers

All Syllabus Domains in AWS Certified Developer - Associate (DVA-C02)

AWS and Amazon Web Services are trademarks of Amazon.com, Inc. PrepIQ Hub is not affiliated with, endorsed by, or sponsored by Amazon Web Services.