Courseiva
SecurityhardMultiple ChoiceObjective-mapped

DVA-C02 Security Practice Question

A developer is storing an API secret for a third-party service in AWS Secrets Manager. The secret needs to be accessed by an AWS Lambda function that runs in a VPC. The Lambda function must have the minimum required permissions. Which IAM policy statement should the developer attach to the Lambda execution role?

⚠ Common exam trap

It's easy for candidates to confuse aws:SourceIp with VPC-based access control, not realizing that Lambda functions in a VPC use private IPs and require VPC endpoint conditions (aws:SourceVpce or aws:SourceVpc) instead of IP-based conditions.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

A policy that grants secretsmanager:GetSecretValue for the specific secret ARN and includes a condition for aws:SourceVpce to restrict access to the VPC endpoint

It grants the minimum required permission (secretsmanager:GetSecretValue) scoped to the specific secret ARN, and uses the aws:SourceVpce condition key to restrict access to the VPC endpoint used by the Lambda function. This ensures that only requests originating from the specified VPC endpoint can retrieve the secret, aligning with the principle of least privilege and the requirement that the Lambda function runs in a VPC.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • A policy that grants secretsmanager:GetSecretValue for the specific secret ARN and includes a condition for aws:SourceVpce to restrict access to the VPC endpoint

    Why this is correct

    This policy correctly implements the principle of least privilege by granting access only to the specific secret identified by its Amazon Resource Name (ARN). Furthermore, the `aws:SourceVpce` condition key ensures that requests to retrieve the secret value must originate from the specified VPC endpoint, providing a critical layer of network-level security. This prevents unauthorized access attempts from outside the designated private network path, enhancing the overall security posture for confidential data.

  • A policy that grants secretsmanager:GetSecretValue for all secrets in the account

    Why it's wrong here

    Granting `secretsmanager:GetSecretValue` for all secrets (`*`) in the account is a severe violation of the principle of least privilege. This broad permission allows access to every secret, regardless of its sensitivity or purpose, creating a significant security vulnerability. Any compromise of the entity holding this policy could expose all stored credentials, leading to widespread data breaches across the entire account.

  • A policy that grants secretsmanager:GetSecretValue for the secret and includes a condition for aws:SourceIp

    Why it's wrong here

    Using `aws:SourceIp` as a condition key is ineffective for restricting access from services like AWS Lambda functions operating within a Virtual Private Cloud (VPC). Lambda functions in a VPC use private IP addresses that are internal to the VPC and can be dynamic, making them unsuitable for consistent policy enforcement. For private network access to AWS services, VPC endpoints with `aws:SourceVpce` are the appropriate and secure mechanism.

  • A policy that grants secretsmanager:GetSecretValue for the secret and includes a condition for ec2:Vpc

    Why it's wrong here

    The `ec2:Vpc` condition key is not a valid or recognized condition key for restricting access to AWS Secrets Manager. AWS IAM policies require specific and correctly defined condition keys relevant to the service or global context for proper evaluation. The correct global condition key for restricting access to Secrets Manager via a VPC endpoint is `aws:SourceVpce`, which verifies the request originates from a specific endpoint.

Quick reference

Cloud Service Model Comparison

ModelYou ManageProvider ManagesExamples
IaaSOS, runtime, apps, dataHardware, hypervisor, networkingEC2, Azure VMs, GCP Compute Engine
PaaSApps and dataOS, runtime, middleware, hardwareElastic Beanstalk, Azure App Service
SaaSData and settings onlyEverything elseMicrosoft 365, Salesforce, Workday
FaaS / ServerlessFunction code onlyInfra, scaling, runtimeLambda, Azure Functions, Cloud Run
CaaSContainers and appsKubernetes, OS, hardwareEKS, AKS, GKE

About these practice questions

This DVA-C02 question is part of Courseiva's 724-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This DVA-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DVA-C02 exam.