DVA-C02 · 26% of the exam
Security practice questions
10 free Security questions for the AWS Certified Developer – Associate (DVA-C02) exam, each with the correct answer and an explanation for every option.
What this domain covers
Authentication, authorisation and encryption from the application side: who the code runs as, how users sign in, and how data and secrets are protected.
- Exam weight
- 26%
- On a real exam
- ≈ 17 questions
- In our bank
- 149 questions
Topics that come up most
- IAM roles for Lambda, ECS and EC2
- Cognito user pools vs identity pools
- KMS envelope encryption
- Secrets Manager and Parameter Store from code
- Signed URLs and cookies
How to study it
Know which credential each compute service uses by default, and never pick an answer that embeds long-lived keys in code.
Sample Security questions
Try each one before opening the answer. Original questions written to the official exam objectives.
Question 1
A developer is configuring the security group for a fleet of application servers in an Auto Scaling group. Instead of a CIDR range, the inbound rule names the load balancer's security group as the source. What is the main benefit of this approach?
- AThe rule allows traffic from whatever instances are associated with the referenced group, so it stays valid when their private IP addresses change.
- BThe rule copies the referenced group's inbound rules into this group, so both groups enforce one shared rule set.
- CThe rule allows traffic from the referenced group's instances using their public or Elastic IP addresses across the internet.
- DThe rule can deny traffic from the referenced group's instances, which a rule based on a CIDR range cannot express.
Show answer and explanation
Answer: A) The rule allows traffic from whatever instances are associated with the referenced group, so it stays valid when their private IP addresses change.
When a rule names a security group as the source, it allows traffic from the private IPs of whatever instances belong to that group right now. The rule keeps working as instances scale in, scale out, or get replaced.
- ACorrect. When a security group is the source, the rule applies to all instances associated with that group and allows traffic from their private IP addresses. You don't need to edit the rule when instances are replaced or get new IPs.
- BIncorrect. AWS docs state that no rules from the referenced security group are added to the security group that references it.
- CIncorrect. Security group referencing works with the private IP addresses of the associated instances' network interfaces, not their public or Elastic IP addresses.
- DIncorrect. Security groups support only allow rules, whatever the source type. You can't write deny rules in a security group.
Question 2
A company stores database credentials in an AWS Secrets Manager secret in us-east-1 and replicates the secret to us-west-2 for disaster recovery. Both Regions are healthy. An application running in us-west-2 must change the credential value. What should the developer do?
- AWrite the new value to the primary secret in us-east-1, because the replica can't be updated independently of its primary and receives the change through replication
- BCall PutSecretValue on the replica secret in us-west-2, and Secrets Manager will synchronize the new value back to the primary secret in us-east-1
- CTurn on rotation for the replica secret in us-west-2 so that it can generate its own values while staying linked to the primary secret
- DCall StopReplicationToReplica from us-east-1, update the secret in us-west-2, and then rely on Secrets Manager to relink the two secrets automatically
Show answer and explanation
Answer: A) Write the new value to the primary secret in us-east-1, because the replica can't be updated independently of its primary and receives the change through replication
A Secrets Manager replica can't be updated independently of its primary, except for its encryption key, so normal updates go to the primary and propagate to the replicas. Only promoting the replica with StopReplicationToReplica, called from the replica Region, makes it an independent standalone secret.
- ACorrect. A replica secret has the same value and metadata as its primary and can't be updated independently, except for its KMS encryption key. Changes made to the primary secret, including rotated values, propagate to the replicas.
- BIncorrect. Replication only goes from the primary to its replicas. A replica can't be updated independently, so there is no write path that syncs a change back to the primary.
- CIncorrect. When rotation is turned on for the primary, Secrets Manager rotates the secret in the primary Region and the new value propagates to the replicas. To turn on rotation for a replica itself, you must first promote it to a standalone secret, which disconnects it from the primary.
- DIncorrect. StopReplicationToReplica must be called from the replica's Region, and it promotes the replica to a standalone secret. After that, changes to the primary no longer replicate to it, and the secrets are not relinked automatically. Promotion is meant for scenarios such as disaster recovery, not routine updates.
Question 3
A developer finds that an IAM user's long-term access key ID and secret access key were committed to a public Git repository two days ago. What is the most appropriate response?
- ADeactivate the exposed key, issue a new key to legitimate workloads, and review CloudTrail for calls made with the old key
- BPush a new commit that removes the key, make the repository private, and keep using the same key
- CReset the IAM user's console password and enable MFA for that user, leaving the access key active
- DReplace the plaintext key in the repository with a version encrypted by AWS KMS in a new commit
Show answer and explanation
Answer: A) Deactivate the exposed key, issue a new key to legitimate workloads, and review CloudTrail for calls made with the old key
A leaked long-term access key stays usable by anyone until it is revoked. The right response is to deactivate and replace the key and then use CloudTrail to investigate what the key was used for. Editing or hiding the repository doesn't remove the exposure.
- AAnyone who has the key has the same access as the IAM user, and long-term keys stay valid until they are manually revoked. Deactivating the key stops misuse right away. A replacement key keeps legitimate workloads running, and CloudTrail shows what was done with the key while it was exposed. Delete the old key after confirming it is no longer needed.
- BGit history and any existing clones or forks still contain the key, which may already have been copied. The key stays valid until it is revoked, so hiding the file doesn't remove the exposure.
- CProgrammatic requests signed with the access key don't need the console password. Enabling MFA doesn't block access-key calls unless policies specifically require MFA. The exposed key would remain usable.
- DThe plaintext key is still in the commit history and still valid. Encrypting a future copy does nothing about the credential that was already exposed, so it must be deactivated and replaced.
Question 4
A mobile app signs users in with a username and password against an Amazon Cognito user pool. A new security requirement says every user must also enter a code from an authenticator app or a code sent by SMS message on every sign-in. Which configuration meets this requirement?
- ASet the user pool's MFA enforcement to Required and enable the SMS message and authenticator app (TOTP) methods
- BSwitch to the Plus feature plan and turn on threat protection in audit-only enforcement mode
- CCreate an identity pool that uses the user pool as its authentication provider for the app
- DShorten the app client's refresh token expiration so users must re-enter passwords more often
Show answer and explanation
Answer: A) Set the user pool's MFA enforcement to Required and enable the SMS message and authenticator app (TOTP) methods
Setting user pool MFA to Required, with the SMS and TOTP methods enabled, makes every user present a second factor after the password. Threat protection, identity pools, and token lifetimes don't enforce this on every sign-in.
- AWith MFA set to Required, every user must complete an additional SMS, email, or TOTP code on each sign-in. Enabling the SMS and authenticator app methods matches the factors in the requirement.
- BAudit-only mode just monitors activity, assigns risk levels, and publishes logs and metrics. Even in full-function mode, adaptive authentication requires MFA only for risky sign-ins, not for every sign-in.
- CAn identity pool exchanges user pool tokens for temporary AWS credentials. It doesn't add another authentication factor to the user pool sign-in.
- DA shorter token lifetime only makes users sign in more often with the same single factor. It never asks for a code from an authenticator app or SMS message.
Question 5
A developer stores a third-party API key as a Lambda environment variable. The function uses the default AWS managed key for encryption at rest, and the console's encryption helpers for client-side encryption are not enabled. Which is a real security risk of this setup?
- AAny principal allowed to read the function's configuration can see the key in clear text, and the value can also show up in deployment templates or tooling output.
- BThe key is stored unencrypted on Lambda's storage, because no customer managed KMS key was selected for encryption at rest on the function.
- CLambda writes every environment variable value to the function's CloudWatch Logs log group at the start of each invocation by default.
- DInvocations fail unless the execution role is granted kms:Decrypt on the default key, so the key is exposed to anyone who can edit the role.
Show answer and explanation
Answer: A) Any principal allowed to read the function's configuration can see the key in clear text, and the value can also show up in deployment templates or tooling output.
Lambda environment variables are encrypted at rest, but with the default key anyone who can read the function configuration sees them in clear text, and they can leak through deployment artifacts. For credentials, AWS recommends Secrets Manager (or at least client-side encryption with a customer managed key).
- AWith the default AWS managed key, no extra KMS permissions are needed to view environment variables. Anyone who can read the function configuration sees the value decrypted, and values defined in IaC or CI/CD pipelines can show up in templates and output. AWS recommends Secrets Manager for credentials like this.
- BLambda always encrypts environment variables at rest with an AWS KMS key and uses an AWS managed key by default. A customer managed key is optional and adds control over the key; it isn't required for encryption at rest.
- CLambda doesn't log environment variable values automatically. Values reach CloudWatch Logs only if the function code prints them.
- DNeither users nor the execution role need KMS permissions to use the default encryption key. The execution role needs kms:Decrypt only when encryption helpers are used for client-side encryption.
Question 6
What does it mean that an IAM policy statement's Resource element uses a wildcard ("*") for an S3 action like s3:GetObject?
- AThe statement applies to objects in every S3 bucket the account can access, not just a specific bucket or prefix
- BThe statement is automatically denied by IAM for being too broad
- CIt has no effect and is ignored by IAM
- DIt restricts the action to only the requester's own uploaded objects
Show answer and explanation
Answer: A) The statement applies to objects in every S3 bucket the account can access, not just a specific bucket or prefix
- AA wildcard Resource means the permission isn't scoped to a specific bucket/prefix — broadening it far beyond least privilege, since it would apply to any matching S3 resource in scope, not one particular bucket.
- BIAM doesn't automatically reject a wildcard Resource — it will actually grant broadly scoped access exactly as written, which is why using it carelessly is a real security risk, not a syntax error.
- CA wildcard Resource is meaningfully evaluated by IAM and does grant broad access — it isn't simply ignored.
- DA bare wildcard doesn't scope access to "only objects I uploaded" — that kind of restriction requires a specific condition or resource pattern, not a plain wildcard.
Question 7
An application uses an Amazon Cognito user pool on the Essentials feature plan to sign up local users. Passwords must be at least 12 characters, include at least one number and one special character, and not match any of the user's last 5 passwords. Which solution meets these requirements with the LEAST development effort?
- ASet a custom password policy on the user pool with minimum length, required character types, and the number of previous passwords to block
- BConfigure the password rules in the Cognito identity pool linked to the user pool, then set the identity pool as the default authentication provider
- CUpdate the IAM account password policy for the AWS account to set the length, complexity, and reuse rules that Cognito users must follow
- DAdd a pre sign-up Lambda trigger that checks the password rules and keeps hashes of each user's previous passwords in a DynamoDB table
Show answer and explanation
Answer: A) Set a custom password policy on the user pool with minimum length, required character types, and the number of previous passwords to block
Cognito user pool password policies natively set minimum length and required character types. With the Essentials or Plus feature plan, they can also block reuse of up to 24 passwords in total (the current one plus 23 earlier ones).
- ACorrect. A custom user pool password policy sets the minimum length and the required character types (numbers, special characters, uppercase, lowercase). On the Essentials or Plus plan, 'Prevent use of previous passwords' blocks reuse of the current password plus up to 23 earlier ones. No custom code is needed.
- BIncorrect. Identity pools exchange identities for temporary AWS credentials. They don't store or validate user passwords. The password policy is a user pool setting.
- CIncorrect. The IAM account password policy applies only to IAM users in the AWS account. It has no effect on users in a Cognito user pool.
- DIncorrect. This means writing and maintaining custom code and storage for something the user pool password policy already supports, so it is not the least development effort.
Question 8
An application authenticates users with an Amazon Cognito user pool and exchanges their ID tokens for temporary AWS credentials through a Cognito identity pool. Users in the Admins group must receive broader AWS permissions than users in the Members group. Which configuration achieves this?
- AAssign a distinct IAM role to each user pool group, and set the identity pool's authenticated role selection to Choose role from token
- BAttach IAM permission policies directly to each user pool group, and keep the identity pool's default authenticated role
- CAdd each group's IAM role ARN as a custom OAuth scope on the user pool app client for the matching group
- DEnable guest access on the identity pool and configure a separate unauthenticated role for each user pool group
Show answer and explanation
Answer: A) Assign a distinct IAM role to each user pool group, and set the identity pool's authenticated role selection to Choose role from token
Linking an IAM role to each Cognito user pool group and setting the identity pool to choose the role from the token gives each group its own permissions. Group roles travel in the ID token's cognito:roles and cognito:preferred_role claims.
- AEach user pool group can be linked to an IAM role. Those roles are passed in the ID token's cognito:roles and cognito:preferred_role claims. When the identity pool uses Choose role from token, it issues credentials for the role that matches the user's group.
- BUser pool groups don't hold IAM policies; a group is linked to an IAM role through its ARN. If the identity pool keeps only its default authenticated role, every authenticated user receives that same role.
- COAuth scopes in access tokens authorize access to resource servers such as APIs. The identity pool doesn't use scopes to choose an IAM role for temporary credentials.
- DThe unauthenticated role applies to guest users who haven't signed in, and an identity pool has only one. It can't tell authenticated users apart by group membership.
Question 9
A developer turns on log file integrity validation for an AWS CloudTrail trail. What capability does this setting provide?
- ADetecting whether delivered log files were modified or deleted by checking signed digest files
- BEncrypting delivered log files with a customer managed AWS KMS key rather than with SSE-S3
- CPreventing any principal, including the root user, from deleting log files in the S3 bucket
- DConfirming in real time that every API call was recorded before CloudTrail delivers the log
Show answer and explanation
Answer: A) Detecting whether delivered log files were modified or deleted by checking signed digest files
CloudTrail log file integrity validation delivers hourly digest files containing SHA-256 hashes, signed with RSA, so you can later prove whether log files were changed or deleted after delivery. It doesn't encrypt logs or prevent deletion.
- AOnce validation is enabled, CloudTrail hashes each log file with SHA-256 and delivers an hourly digest file signed with SHA-256 with RSA. You can then validate the files (for example, with the AWS CLI) to find out whether they were modified, deleted or left unchanged after delivery.
- BSSE-KMS encryption is a separate trail setting. Log files are already encrypted with SSE-S3 when SSE-KMS isn't enabled. Integrity validation is about tamper detection, not encryption.
- CIntegrity validation detects changes or deletions but does not prevent them. Preventing deletion requires S3 controls such as bucket policies, MFA Delete or Object Lock.
- DValidation works after delivery against the delivered log and digest files. Enabling the setting only causes digest files to be delivered; you run the validation separately.
Question 10
A developer creates a pipeline with the AWS CodePipeline console's Create pipeline wizard and accepts the default artifact store settings. How are the pipeline artifacts in the Amazon S3 artifact bucket encrypted at rest?
- AWith SSE-KMS, using the AWS managed key for Amazon S3 (aws/s3) in the account
- BWith SSE-S3, using Amazon S3 managed keys and no AWS KMS key at all
- CNot encrypted until a customer managed KMS key is chosen in pipeline settings
- DClient-side, by CodePipeline using a data key stored in AWS Secrets Manager
Show answer and explanation
Answer: A) With SSE-KMS, using the AWS managed key for Amazon S3 (aws/s3) in the account
When a pipeline is created with the console wizard, CodePipeline encrypts artifacts with SSE-KMS using the AWS managed aws/s3 key. You can choose a customer managed key instead, and a cross-account pipeline requires one.
- ACorrect. The wizard creates the artifact bucket, and CodePipeline uses server-side encryption with AWS KMS and the AWS managed key for Amazon S3 (alias aws/s3). The same SSE-KMS process decrypts artifacts when they are retrieved.
- BIncorrect. CodePipeline's default is SSE-KMS with the aws/s3 AWS managed key, not SSE-S3. The documented example bucket policy even denies uploads that don't request aws:kms encryption.
- CIncorrect. A customer managed key is optional (for example, for scheduled rotation or cross-account pipelines). Without one, the wizard's default still encrypts artifacts with the AWS managed key.
- DIncorrect. CodePipeline relies on Amazon S3 server-side encryption with AWS KMS. It does not encrypt artifacts client-side with keys kept in Secrets Manager.
Security: FAQs
How much of the DVA-C02 exam is Security?
Security is 26% of the DVA-C02 exam by the official exam guide's weighting, which on a 65-question form works out to roughly 17 questions. The real exam's exact split varies by form.
What does the Security domain cover?
Authentication, authorisation and encryption from the application side: who the code runs as, how users sign in, and how data and secrets are protected.
How should I study Security for DVA-C02?
Know which credential each compute service uses by default, and never pick an answer that embeds long-lived keys in code.
Where can I practise more Security questions?
This page has 10 free Security questions with answers. CertRidge's DVA-C02 question bank has 149 questions in this domain. Every practice exam result breaks your score down by domain, and Review Mode re-drills the questions you missed.
Get Security exam-ready
The full DVA-C02 bank has 149 Security questions. Timed practice exams match the real exam's length and domain weights, every result shows your score per domain, and Review Mode re-drills the questions you missed.
Not affiliated with AWS; questions are original and never copied from the real exam.