Chapter 2
Security
Security is the second-largest domain on the DVA-C03 exam at 26% of the scored content. It tests whether you can build applications that authenticate users correctly, authorize access with least privilege, protect data with the right encryption and secrets tooling, and keep traffic off the public internet. DVA-C03 also reorganizes this domain: the older encryption and sensitive-data tasks are merged into a single task, and a new task - Task 2.3 - covers securing applications that integrate AI services such as Amazon Bedrock. That AI security material is covered in section 2.4 and is genuinely new, so give it more study time than its size suggests.
Everything in this chapter follows one principle you will see repeated in exam questions: grant the minimum access needed, for the minimum time needed, and protect data at every layer - in transit, at rest, and in your logs.
2.1 IAM for developers
AWS Identity and Access Management (IAM) is the foundation of every security question on this exam. As a developer you rarely administer IAM for a whole organization, but you constantly write policies, create roles for your code, and debug access-denied errors. The exam expects you to do all three fluently.
Principals, policies, and roles
A principal is the entity making a request: an IAM user, an IAM role session, a federated user, or an AWS service.
Requests are evaluated against policies, which are JSON documents containing statements with an effect (Allow or Deny), actions, resources, and optional conditions.
The policy types you must be able to distinguish are:
| Policy type | Identity-based policy | Resource-based policy |
|---|---|---|
| Permissions boundary | Session policy | Service control policy (SCP) |
| Resource control policy (RCP) | Attached to | A user, group, or role |
| A resource (S3 bucket, KMS key, SQS queue, Lambda function) | A user or role | Passed when assuming a role or federating |
| An AWS Organizations account | An AWS Organizations account | Purpose |
| Grants permissions to that identity | Grants access to named principals; can grant cross-account access without a role | Sets the maximum permissions the identity can ever have; grants nothing by itself |
| Narrows the permissions of that session only | Sets the maximum permissions available in the account; grants nothing | Sets the maximum permissions on resources in the account |
Two facts are tested relentlessly. First, boundaries and SCPs never grant permissions - they only cap them. A role with an administrator identity policy but a restrictive permissions boundary has only the boundary's permissions. Second, resource-based policies are the only way to grant cross-account access to a principal directly; an identity policy in account A cannot grant a user in account B anything unless the resource in account
B also trusts that principal (or the user assumes a role in account B).
How a request is evaluated
When a request arrives, IAM evaluates it in a defined order. You do not need to memorize the full flowchart, but you do need the decision logic:
1. Explicit Deny wins over everything. If any applicable policy contains a Deny for the action and resource, the request is denied, no matter what else allows it.
2. Organization SCPs and RCPs are evaluated next; if they do not allow the action, the request stops there.
3. Resource-based policies on the target resource are evaluated; for same-account access, an allow in a resource-based policy can be sufficient on its own.
4. A permissions boundary, if present, must allow the action.
5. A session policy, if present, must allow the action.
6. Finally, an identity-based policy must allow the action (for same-account resource-based access, step 3 may already have allowed it).
The practical debugging sequence mirrors this: when code gets an AccessDenied error, look first for an explicit deny, then check whether the identity policy actually allows the action on that exact resource ARN, and only then suspect boundaries or SCPs.
IAM policy evaluation. The process AWS uses to decide whether a request is allowed: every applicable policy
(SCPs, RCPs, resource-based policies, permissions boundaries, session policies, and identity policies) is evaluated together, an explicit Deny in any of them overrides every Allow, and the request succeeds only if the combined result allows it. It matters to developers because most AccessDenied errors are evaluation outcomes - a cap or a deny somewhere in the chain - not missing permissions in the one policy you are looking at.
Roles and least privilege
Long-lived IAM users with embedded access keys are an anti-pattern the exam wants you to eliminate.
If a question says a user has an Allow policy but is still denied, the expected answer is almost always an explicit
Deny somewhere, a permissions boundary, or an SCP. IAM is eventually consistent - changes take a short time to replicate - but a lasting denial comes from policy evaluation, not propagation.
Applications running on AWS should use IAM roles:
- A Lambda execution role grants the function permissions to write logs and access services such as
DynamoDB, SQS, or S3. Attach the policy to the role, never embed credentials in function code or environment variables.
- An ECS task role grants the application code in a container its AWS permissions. This is separate from the
task execution role, which the ECS agent uses to pull images and write logs. Confusing these two roles is a classic exam trap: if the container starts but the application cannot call DynamoDB, the task role is wrong; if the container never starts, check the execution role.
- EC2 instance profiles deliver role credentials to applications on instances through the instance metadata
service. Prefer IMDSv2 (token-based) and note that applications retrieve temporary credentials automatically through the SDK.
Least privilege tooling the exam expects you to know:
- IAM Access Analyzer generates least-privilege policies based on a principal's actual CloudTrail activity, and
its unused access findings flag roles, users, and permissions that have not been used. External access findings show which of your resources are accessible from outside your account or organization.
- Policy validation with Access Analyzer catches syntax errors and warns about overly permissive grants
before you deploy.
- Condition keys such as
aws:SourceVpce,aws:PrincipalTag,aws:RequestTagand service-specific keys
let you narrow a statement without creating more policies.
AWS STS and temporary credentials
The AWS Security Token Service (STS) issues short-lived credentials: an access key ID, a secret access key, and a session token. Every role assumption and every federated sign-in produces temporary credentials. Key operations and limits:
| STS operation | AssumeRole | AssumeRoleWithSA ML |
|---|---|---|
| AssumeRoleWith- WebIdentity | GetSessionToken | GetFederationToken |
| Used for | Code or users taking a role (same or cross-account) | SAML 2.0 federation |
| OIDC federation (mobile/web apps, EKS IRSA) | IAM users, often with MFA | Proxy applications brokering access |
| Session duration | Default 1 hour; maximum 12 hours (43,200 seconds) | Default 1 hour; maximum 12 hours |
| Default 1 hour; maximum 12 hours | Up to 36 hours (129,600 seconds) for IAM user credentials | Up to 36 hours |
Details that appear in questions:
- Durations can be as short as 15 minutes. Shorter is safer; credentials expire automatically and cannot be
revoked individually before expiry (you can deny sessions created before a point in time using the
aws:TokenIssueTime condition on the role's trust or attached policies).- A role's maximum session duration (1-12 hours) caps what any caller can request, whatever the caller
asks for.
- Role chaining - assuming a second role from a role session - is limited to a 1-hour maximum session.
- Cross-account access follows a fixed pattern: the trusting account creates a role whose trust policy names
the other account; a principal in the trusted account needs an identity policy allowing sts:AssumeRole on that role's ARN. Both sides are required.
Common trap: A trust policy alone does not grant anyone access. It only says who may assume the role. The caller's own account must also allow the sts:AssumeRole call.
Permissions boundaries, SCPs, RCPs, and session policies only ever narrow access - they grant nothing by themselves. A principal's effective permissions are the intersection of every applicable cap and an Allow in an identity-based or resource-based policy, so a generous identity policy cannot rescue a request that a boundary or SCP does not allow. Students commonly treat these layers as alternatives ("the policy allows it, so the boundary doesn't matter"), but evaluation requires all of them to permit the action.
2.2 Amazon Cognito and API authorization
User pools vs identity pools
Amazon Cognito has two components with confusingly similar names and completely different jobs. Getting this distinction right is worth several questions by itself.
| Job | Acts as | |
|---|---|---|
| Returns | Accepts sign-in from | IAM involved? |
| Cognito user pool | Authentication - who the user is | A user directory and OIDC/SAML identity provider |
| JSON Web Tokens (ID token, access token, refresh token) | Its own users, plus federated SAML/OIDC providers and social providers (Google, Apple, Facebook, Amazon) | No AWS credentials are issued |
| Cognito identity pool | Authorization - what AWS resources the user can access | A credential broker (federated identities) |
| Temporary AWS credentials via STS | User pools, social providers, SAML/OIDC providers, developer-authenticated identities | Maps identities to IAM roles (authenticated role, unauthenticated/guest role) |
| Cognito user pool | Cognito identity pool | |||
|---|---|---|---|---|
| Typical use | Sign-up/sign-in for web and mobile apps; securing | Granting a signed-in user's app direct, scoped | ||
| API Gateway and ALB endpoints | access to S3, DynamoDB, AppSync |
A standard exam architecture uses both: the app authenticates against a user pool, sends the resulting ID token to the identity pool, and receives temporary credentials scoped to an IAM role - for example, permissions to read only the user's own prefix in an S3 bucket, enforced with a policy variable such as
${cognito-identity.amazonaws.com:sub}.User pool facts to know precisely:
- The ID token carries identity claims (username, email, groups) and proves who the user is; the access
token carries scopes and is used to authorize calls to APIs and to the user pool itself; the refresh token obtains new ID and access tokens without a new sign-in.
- Token validity is configurable: access and ID tokens from 5 minutes to 1 day (default 1 hour); refresh tokens
from 1 hour to 10 years (default 30 days).
- Groups in a user pool can be mapped to IAM roles through the identity pool, and group claims in the ID
token can drive authorization logic in your API.
- Lambda triggers hook the authentication lifecycle - pre sign-up validation, custom authentication
challenges, pre token generation (to add claims), post authentication logging, and custom messages for verification codes.
- MFA options include SMS, email, and time-based one-time passwords (TOTP). Adaptive authentication and
compromised-credential checks are part of Cognito's advanced security features.
- The hosted UI provides a ready-made sign-in/sign-up flow and handles OAuth 2.0 authorization code and
implicit grants, plus logout.
Questions asking how an application gets AWS credentials for a signed-in user always resolve to the identity pool. Questions asking how an API verifies who the caller is resolve to the user pool (or another JWT issuer).
Cognito user pool vs identity pool. A user pool is a user directory that authenticates users and issues JSON
Web Tokens (ID token, access token, refresh token); an identity pool (federated identities) exchanges an authenticated identity - from a user pool or another provider - for temporary AWS credentials tied to an IAM role. The distinction matters because the two solve different problems: sign-in and token validation belong to the user pool, while giving the app scoped AWS permissions belongs to the identity pool.
Authorizing API Gateway APIs
REST APIs in Amazon API Gateway support several authorization mechanisms, and the exam tests whether you can pick the right one for a stated caller type.
| Mecha- nism | IAM author- ation | Cognito author- er | Lambda author- er |
|---|---|---|---|
| Resource policy | Caller | AWS principals (services, roles, federated users) | App users |
| Any | Source-based control | How it works | Requests are signed with Signature Version 4 using the caller's credentials |
| API Gateway validates the user pool JWT itself | Your function inspects a token (TOKEN type) or the full request (REQUEST type) and returns an IAM policy document | Allow/deny by source IP, VPC, or VPC endpoint | Choose when |
| Internal/service-to-service APIs; callers already have AWS identities | Your users live in a Cognito user pool and token validation is all you need | Custom identity providers, third-party OAuth, or authorization logic based on headers/path/claims | Restricting an API to a VPC endpoint or allowlisted IPs, regardless of auth method |
Numbered walkthrough - how a Lambda authorizer request flows:
1. The client calls the API with a token (typically in the Authorization header).
2. API Gateway invokes your authorizer function with the token (TOKEN type) or the full request context
(REQUEST type).
3. Your function validates the token - signature, issuer, expiry, claims - and builds an IAM policy document allowing or denying API methods.
4. API Gateway evaluates the returned policy and either forwards the request to the integration or returns
401/403.
5. Results are cached by token (default TTL 300 seconds, configurable up to 3,600) so the function is not invoked on every call. A consequence: a revoked token may still work until the cache entry expires.
Key traps and details:
- A Lambda authorizer must return a policy document whose resource ARNs match the methods being
authorized; a policy that allows only one method will deny others even with a valid token. Returning a policy covering the whole API stage (execute-api:/stage/*/*) is the usual pattern when caching is enabled.
- HTTP APIs use JWT authorizers (any OIDC issuer, including user pools) and Lambda authorizers, but not
the Cognito-specific authorizer type or IAM in exactly the same way as REST APIs - when a question specifies HTTP API plus a user pool, "JWT authorizer" is the expected term.
- API keys identify a client application for usage plans and throttling; they are not an authorization
mechanism and should never be the answer to "how do you secure this API."
- Mutual TLS (mTLS) on custom domains authenticates clients by certificate and is the answer when a
question requires certificate-based client identity.
A Lambda authorizer does not run on every request. API Gateway caches the policy it returns, keyed by the caller's token (default TTL 300 seconds), and reuses that cached decision for subsequent calls with the same token. Students often assume revoking a token or tightening the authorizer takes effect immediately; in reality, a previously allowed token can keep working until its cache entry expires, which is a deliberate performance trade-off you must design around.
1. Your mobile app signs users in with a Cognito user pool and then needs to let each signed-in user upload files only to their own prefix in an S3 bucket. What additional component do you configure, and what does it hand back to the app?
2. A Lambda authorizer protects a REST API with the default cache TTL. A user's access is revoked, yet their API calls keep succeeding for a few more minutes. Why?
Answers: 1. A Cognito identity pool - it exchanges the user pool token for temporary AWS credentials tied to an IAM role whose policy is scoped to the user's own prefix. 2. Authorizer results are cached by token (default
300 seconds), so the previously returned Allow policy is reused until the cache entry expires.
2.3 Encryption and sensitive data
In DVA-C03, encryption and sensitive-data protection are one merged task. The exam expects you to choose the right key type, the right store for each kind of secret, and the right S3 encryption option - and to explain the trade-offs when a question imposes a constraint such as "the compliance team must be able to audit every key use" or "rotate this credential automatically."
AWS KMS and envelope encryption
AWS Key Management Service (KMS) creates and controls encryption keys. The data keys and key material concepts are heavily tested.
Key ownership types:
| Key type | AWS owned key | Created by | AWS, inside a service | Managed by |
|---|---|---|---|---|
| AWS entirely; you never see it | Key policy control | None visible to you | Cost notes | No charge; used by services across accounts |
| Key type | AWS managed key | Customer managed key (CMK) | ||
|---|---|---|---|---|
| Created by | AWS, in your account (e.g. aws/s3, aws/lambda) | You, in your account | Managed by | |
| AWS rotates automatically (yearly); you cannot change the key policy or disable it | You control the policy, rotation, grants, aliases, deletion | Key policy control | Viewable, not editable | |
| Full control via key policy | Cost notes | No monthly key fee; per-request charges apply | Monthly fee per key plus per-request charges |
Non-negotiable KMS facts:
- Every KMS key must have a key policy, and the default key policy gives the account root user full access,
which is what makes IAM policies able to delegate key permissions. If a key policy does not enable IAM delegation and grants no one access, the key becomes unmanageable.
- Callers need permission from both sides when IAM is involved: an identity policy allowing the KMS action
and a key policy that does not deny it. Cross-account use always requires the key policy in the key's account to allow the external principal.
- Grants are an alternative authorization mechanism, used by AWS services (for example, EBS or RDS) to
delegate limited key use to a grantee principal for a bounded set of operations; grants can be retired or revoked and are how services act on your behalf without key policy edits.
- Deleting a customer managed key requires a mandatory waiting period of 7 to 30 days, during which
deletion can be cancelled. The safer alternative for "stop using this key now" scenarios is disabling the key, which takes effect immediately and is reversible.
- Multi-Region keys are customer managed keys replicated to other Regions with the same key ID and
material, so data encrypted in one Region can be decrypted in another without re-encryption - the exam frames this around disaster recovery and global applications.
- KMS keys never leave their Region (or partition) unless they are Multi-Region keys; a key created in
eu-west-1 cannot be used in us-east-1.
Envelope encryption is the pattern behind almost every encryption question. KMS itself only encrypts small amounts of data directly (the Encrypt API accepts at most 4 KB of plaintext), so services encrypt bulk data as follows:
1. The application or service calls GenerateDataKey, naming a KMS key.
2. KMS returns a plaintext data key and the same data key encrypted under the KMS key.
3. The application encrypts its data locally with the plaintext data key (for example, AES-256-GCM), then
Automatic key rotation is available for customer managed symmetric keys: when enabled, KMS rotates the backing key material on a schedule you set - 365 days by default, configurable from 90 to 2,560 days - and on demand. Old material is kept to decrypt older ciphertext, and rotation never changes the key ID or ARN.
Asymmetric and HMAC keys cannot be rotated automatically; AWS managed keys rotate annually.
discards the plaintext key from memory.
4. The encrypted data key is stored alongside the ciphertext.
5. To decrypt, the application sends the encrypted data key to KMS (Decrypt), receives the plaintext data key, and decrypts the data locally.
Data itself never passes through KMS. This is why KMS request quotas are rarely the bottleneck in a well-designed system, and why caching a data key briefly (as the AWS Encryption SDK does with its cryptographic materials cache) reduces KMS calls - at the cost of reusing a key for more than one object. One encryption-context detail worth knowing: the encryption context is a set of key-value pairs cryptographically bound to the ciphertext and written to CloudTrail logs, making it the standard way to add audit context to KMS calls.
"Audit every use of the key" or "control access independently of the bucket policy" always points to a customer managed key, because only CMKs give you an editable key policy and per-key CloudTrail events under your control. "No key management overhead" points to AWS managed keys.
Envelope encryption. Encrypting data with a data key, then encrypting that data key under a KMS key and storing the encrypted data key alongside the ciphertext. It matters because KMS encrypts at most 4 KB of plaintext directly, so envelope encryption is how applications and services protect data of any size while keeping key use centralized, auditable, and controllable in KMS.
TLS and data in transit
- AWS services communicate over TLS; API calls are HTTPS and signed with Signature Version 4.
- AWS Certificate Manager (ACM) issues and automatically renews public and private TLS certificates and
deploys them to integrated services such as Elastic Load Balancers, CloudFront, and API Gateway custom
- For S3, enforce encryption in transit with a bucket policy condition on
aws:SecureTransportset to false
=> deny.
- Load balancer and CloudFront security policies define the minimum TLS version and cipher suites; a
question demanding "TLS 1.3 only" or "disable TLS 1.0" is answered by selecting a newer security policy, not by code changes.
domains. ACM public certificates issued since June 2025 are exportable (private key included, passphrase-protected); earlier ones are not. Private CA offers more flexibility, at higher cost.
Signature Version 4 (SigV4). The signing protocol AWS uses to authenticate API requests: the caller signs the request with its secret access key (and includes the session token when using temporary credentials), proving who is calling and that the request was not altered in transit. It matters to developers because IAM authorization in API Gateway and every SDK call to an AWS service rely on correctly signed requests; an unsigned or badly signed request is rejected before authorization is even evaluated.
S3 encryption options
Since January 2023, S3 automatically applies SSE-S3 to new objects by default. The four options differ in who holds the keys and what you can audit:
| Op- tion | SSE- S3 | SSE- KMS | DS- SE- KMS |
|---|---|---|---|
| SSE- C | Key held by | S3 (AWS owned/managed internally) | KMS, in your account |
| KMS | You (customer-provided) | What you control | Nothing about the key |
| Key policy, rotation, grants; CloudTrail audit of key use | Two layers of encryption with two keys | Everything, including key storage and rotation | Notes |
| AES-256; default; zero configuration | Adds KMS request cost and quota considerations; use S3 Bucket Keys to cut KMS requests substantially | For workloads whose compliance regime explicitly requires dual-layer encryption | You send the key with every request over HTTPS; S3 never stores the key; rarely the right answer unless the scenario forbids AWS-held keys |
The deciding qualifiers in exam stems are auditability (choose SSE-KMS with a CMK), mandated dual-layer encryption (DSSE-KMS), and "the customer must retain exclusive control of keys and AWS must never store them" (SSE-C). Related controls that appear alongside: default encryption on the bucket (applies when the uploader specifies none), Block Public Access (account- and bucket-level), and Object Lock for retention/WORM requirements.
Exam tip. If a scenario uses SSE-KMS and then complains about KMS request costs or throttling at scale, the expected fix is S3 Bucket Keys: they let S3 work from a bucket-level key for short periods instead of calling KMS for every single object.
Secrets Manager vs Parameter Store
Both services store configuration and secrets, and the merged DVA-C03 task tests the boundary between them directly.
| Built for | Automatic rotation | |
|---|---|---|
| Encryption | Parameter/secr et size | Cost |
| Cross-account sharing | Versioning | AWS Secrets Manager |
| Secrets: database credentials, API keys, OAuth tokens | Yes - built-in, via Lambda; managed rotation for RDS, Aurora, Redshift, DocumentDB and other supported services | KMS (AWS managed key or your CMK) |
| Secret values up to 64 KB | Per secret per month plus API calls | Resource policies on secrets |
| Staging labels (AWSCURRENT, AWSPENDING, AWSPREVIOUS) | SSM Parameter Store | Configuration values and, with SecureString, secrets |
| No built-in rotation | SecureString parameters use KMS (AWS managed key or your CMK) | Standard tier: 4 KB max; Advanced tier: 8 KB max |
| Standard tier free; Advanced tier charged per parameter | Advanced-tier parameters can be shared via AWS RAM | Numeric versions with labels |
How Secrets Manager rotation works, step by step:
1. On the schedule you configure - as often as every four hours, expressed as a rate() or cron() expression with an optional window duration - Secrets Manager invokes the rotation Lambda function.
2. createSecret: the function generates a new credential and stores it as a new version labelled
AWSPENDING.3. setSecret: the function updates the target system (for example, the database user password or the third-party service).
4. testSecret: the function verifies the pending credential actually works.
5. finishSecret: the AWSCURRENT label moves to the new version; the old version becomes AWSPREVIOUS.
Applications that read the secret normally - without naming a version - always get AWSCURRENT, so they pick up rotated credentials automatically on their next retrieval. Because rotation can happen while old credentials are cached, applications should retrieve secrets at runtime (with short-lived caching, for example the Secrets
Manager client-side caching libraries or the Lambda parameters-and-secrets extension) and retry on authentication failures rather than loading a password once at deploy time.
Choose Parameter Store when the value is configuration (feature settings, AMI IDs, environment URLs), when you need a free tier hierarchy of values organized by path (/prod/app/db-host), or when other SSM features
(parameter policies for expiration and change notification, advanced tier only) matter. Choose Secrets Manager the moment a question mentions rotating a credential, generating a random password, or managing a database or third-party API credential lifecycle.
Common trap: Parameter Store SecureString values are encrypted, so "the value must be encrypted at rest" is not a reason to pick Secrets Manager. Rotation and credential lifecycle management are.
Rotating a KMS key does not re-encrypt data that already exists. Rotation changes the key material used for new encryptions; KMS retains the old material so previously produced ciphertext still decrypts. Students often assume turning on rotation re-protects everything under the new material - if a scenario genuinely requires old data under a new key, the data itself must be re-encrypted (for example, by copying the S3 objects), because enabling rotation alone leaves existing ciphertext untouched.
1. A compliance rule says AWS must never hold or store the encryption keys; the customer supplies the key with every request. Which S3 encryption option fits?
2. A database password must rotate automatically every 30 days, and the application must pick up the new password without a redeploy. Which service stores it, and which version does a normal read return after rotation?
Answers: 1. SSE-C - the customer provides the key on each request over HTTPS and S3 never stores it. 2. AWS
Secrets Manager - reads that do not name a version return the one labelled AWSCURRENT, which rotation moves to the new credential.
2.4 AI security - the new Task 2.3
DVA-C03 adds a dedicated AI security task to Domain 2. It covers five skill areas: access management for AI services, data privacy controls, content filtering and prompt-injection protection, securing AI agent interactions, and keeping sensitive content out of monitoring logs. It does not cover designing prompts, designing retrieval
(RAG) architectures, choosing models, or AI governance frameworks - those are explicitly out of scope, so if a question drifts toward them, it is testing something else.
Access management for AI services
Calling Amazon Bedrock is an IAM-governed API call like any other, and the exam expects standard IAM discipline applied to it:
- Model invocation uses actions such as
bedrock:InvokeModeland
bedrock:InvokeModelWithResponseStream (the Converse API is authorized through the same invokeactions). Scope the Resource element to the specific foundation model or inference profile ARNs your application needs. Allowing bedrock:InvokeModel on * is the AI equivalent of s3:* on * and will be the wrong answer whenever least privilege is the qualifier.
- Invoke models from an IAM role attached to your compute (Lambda execution role, ECS task role), never
from embedded user keys.
- Separate duties with policy boundaries: developers may have broad Bedrock access in a sandbox account
while production roles permit only the approved models in the production account. SCPs can deny Bedrock actions entirely in accounts that should not use AI services.
- IAM policies can require that inference calls pass through a specific guardrail by conditioning on the
guardrail identifier, which turns "the team configured a guardrail" into "no caller can bypass it."
Data privacy controls
Amazon Bedrock's data protection model, as documented by AWS, is the single most testable fact set in this task:
- Your inputs and outputs are not used to train the base foundation models, are not shared with model
providers, and are not used to improve models for other customers. Model providers have no access to your prompts or completions.
- Data sent to Bedrock is encrypted in transit (TLS) and you can use customer managed KMS keys for
Bedrock assets that are stored, such as model customization jobs and their training data.
- Private connectivity: Bedrock supports interface VPC endpoints (AWS PrivateLink) for its runtime and
control APIs, so a Lambda function or container in a private subnet can invoke models without traffic crossing the public internet. Combine the endpoint with an endpoint policy and aws:SourceVpce conditions in identity or resource policies to require that calls come through your endpoint.
- Cross-Region inference routes requests to other Regions for capacity. From a privacy standpoint that is a
data-residency decision: if a scenario requires prompts to stay in one Region, the answer involves disabling cross-Region inference or pinning an inference profile that stays in-Region - not "Bedrock always keeps data in-Region," which is not guaranteed once cross-Region inference is enabled.
- For other AWS AI services that can use content to improve the service, AWS Organizations AI services
opt-out policies let administrators opt accounts out centrally. This is the mechanism behind "opt out of
CloudTrail records Bedrock control-plane and invocation activity, so "who invoked which model" is auditable - but note the logging caveat under "Keeping sensitive content out of logs" later in this section:
CloudTrail records that a call happened, not the prompt content.
training/improvement" answers for services such as Amazon Q Developer. For Bedrock itself, the no-training guarantee above applies regardless - knowing which statement belongs to which service is exactly what the exam probes.
If a question asks how to stop prompts from training a Bedrock base model, the honest answer the exam wants is that Bedrock does not train on customer inputs or outputs in the first place. If it asks about keeping
Bedrock traffic off the internet, the answer is a PrivateLink interface endpoint for Bedrock. Keep the two facts separate; the distractors deliberately swap them.
Amazon Bedrock Guardrails: content filtering and prompt-injection protection
Guardrails are Bedrock's configurable safeguard layer, evaluated on both the input prompt and the model response when you attach a guardrail (by ID and version) to an invocation, or applied to arbitrary text through the standalone ApplyGuardrail API - useful for screening content that never reaches a model, such as user-generated text from another source.
A guardrail combines up to six policy types:
| Policy | Content filters |
|---|---|
| Denied topics | Word filters |
| Sensitive information filters | Contextual grounding checks |
| Automated reasoning checks | What it does |
| Detect harmful content in the categories Hate, Insults, Sexual, Violence, Misconduct, and Prompt Attack, each with a configurable filter strength (None, Low, Medium, High) for input and output | Blocks requests and responses about topics you define in natural language, with example phrases |
| Blocks exact words and phrases, including a managed profanity list | Detect PII (names, emails, phone numbers, SSNs, card numbers, AWS keys, and many more built-in types) and custom patterns you define with regular expressions; each type is set to Block or Mask (anonymize, replacing the value with a tag such as [EMAIL]) |
| Score whether a response is grounded in provided source material and relevant to the query, above thresholds you set | Validate responses against logical rules you provide |
Operational details the exam can test:
- Prompt Attack filtering is an input-side control. It detects prompt injections and jailbreak attempts in
user input; its output strength is set to None because there is nothing to detect in the model's own output.
This asymmetry is a favourite distractor.
- PII handling is a per-entity choice: block card numbers outright, but mask emails so the conversation can
continue without the model ever seeing the real value. Masking on input means the model processes only the placeholder.
- Guardrails are versioned: you edit a working draft and publish numbered versions, and applications
reference a specific version, so a policy change does not silently alter production behaviour.
- A guardrail is not a substitute for IAM: Guardrails inspect content; IAM controls who may invoke what. A
well-secured application uses both, and can use IAM to require that invocations carry the approved guardrail.
Amazon Bedrock Guardrails. A configurable safeguard layer attached to model invocations (or applied on its own through the ApplyGuardrail API) that evaluates both the input prompt and the model response against content filters, denied topics, word filters, sensitive-information filters, and grounding checks. It matters to developers because it is the control that blocks or masks harmful content, PII, and prompt attacks - IAM decides who may invoke the model, but only the guardrail inspects what the model is asked and what it answers.
Securing AI agent interactions
Agents act: they call tools, query databases, and trigger workflows, so a compromised or manipulated agent can do real damage with real credentials. DVA-C03 expects you to apply least privilege to agents using Amazon
Bedrock AgentCore, the managed runtime and tooling layer for agents.
AgentCore building blocks with a security job:
| Component | AgentCore Identity |
|---|---|
| AgentCore Gateway | Policy in AgentCore |
| AgentCore Runtime | Security role |
| Authenticates inbound callers (who may invoke the agent) using your identity provider, and manages outbound credentials - OAuth tokens and API keys held in a vault - so the agent can act on behalf of a specific user without credentials in its code or environment | Turns APIs, Lambda functions, and other targets into agent tools (exposed over MCP) and is the enforcement point where each tool call is authorized |
| Fine-grained authorization rules, written in natural language and converted to Cedar policies, that the Gateway evaluates on every tool call - down to tool, operation, and parameter level (for example, "refunds may not exceed $500") | Executes agent code with session isolation: each session runs in its own dedicated microVM with separate CPU, memory, and filesystem, and the environment is stopped and sanitized when the session ends |
Principles to state in an answer:
- Tool-use authorization: an agent should be able to call only the tools its job requires, and high-impact
parameters should be bounded by policy at the Gateway, not by hoping the model behaves. Per-user identity should propagate through the call chain (AgentCore Identity brokers token exchange) so downstream services see the real user, not a shared super-powered service identity.
- Session isolation: one user's session must never see another user's data, memory, or credentials.
AgentCore Runtime's per-session microVMs provide this below the application layer - the exam answer when a scenario involves multi-tenant agents leaking context between users.
- Human-in-the-loop approvals: for consequential or irreversible actions, execution should pause for a
person. AgentCore Gateway supports elicitation - the tool pauses mid-execution and requests user input or approval (for example through a form or a URL-based approval/consent flow) before proceeding. Design pattern for questions: read-only actions proceed automatically; writes, payments, deletions, and anything above a policy threshold require elicitation and approval first, and the approval is recorded for audit.
- Apply a guardrail to the agent's model calls as well - agent traffic is still model traffic, and tool outputs
returned to the model are untrusted content that can carry indirect prompt injections.
Exam tip. When a scenario describes one user's agent session leaking another user's data or context, reach for
AgentCore Runtime session isolation - each session runs in its own dedicated microVM. Save the Gateway and
Policy in AgentCore answers for questions about what the agent is allowed to do, such as capping a refund amount.
Keeping sensitive content out of logs
A model application can leak data through its observability pipeline even when everything else is locked down.
Task 2.3 tests whether you know where prompts travel once you log them:
- Bedrock model invocation logging is disabled by default. When you enable it (to CloudWatch Logs, S3,
or both) for debugging or audit, it can capture the full request and response payloads - meaning complete prompts and completions, including whatever PII your users pasted in. Treat the destination bucket or log group as sensitive data: encrypt it, restrict its policy, and set retention deliberately. Never enable full payload logging in production "just in case."
- Your own application logs are the bigger leak. Code that logs the prompt for debugging writes user
data, tokens, and secrets to CloudWatch Logs. Log metadata instead: token counts, latency, model ID, guardrail outcomes, and a correlation ID.
- Route content through a guardrail with PII masking before anything is written anywhere persistent, so
stored text carries placeholders rather than values.
- CloudWatch Logs data protection policies can detect and mask sensitive data (using managed data
identifiers for common PII types) in log groups at ingestion - a useful safety net when you cannot guarantee every developer's logging discipline.
- CloudTrail data events and invocation logs answer "who called what, when"; they should not become a
second copy of your users' conversations.
Common trap: "Enable model invocation logging to improve security" is only half right - it improves auditability while creating a sensitive-data store. The complete answer pairs enabling it with encrypting and restricting the destination, or keeps content logging off and relies on metadata-level logging.
Guardrails and IAM solve different problems, and neither is a substitute for the other. IAM controls who can invoke which model; Guardrails inspect the content of prompts and responses. Students routinely pick one when the scenario needs both: a caller fully authorized by IAM can still submit a prompt injection, and a perfectly configured guardrail does nothing to stop an unauthorized caller who invokes the model without it.
2.5 Secure network access: VPC endpoints and PrivateLink
Applications in private subnets still need to reach AWS services. VPC endpoints keep that traffic on the AWS network instead of hair-pinning through a NAT gateway and the public internet.
| Services | Implemen- tation | |
|---|---|---|
| Cost | DNS | Policy |
| Gateway endpoint | Amazon S3 and DynamoDB only | A route table entry pointing at a prefix list |
| No hourly or data charge | Public service DNS names resolve to the endpoint | Endpoint policy controls which buckets/tables and principals |
| Interface endpoint (PrivateLink) | Most other services: KMS, Secrets Manager, STS, CloudWatch Logs, Bedrock, ECR, and many more | Elastic network interfaces with private IPs in your subnets, one per AZ you enable |
| Hourly charge per AZ plus per-GB data processing | Private DNS (on by default for AWS services) makes the service's public hostname resolve to the endpoint's private IPs | Endpoint policy controls permitted actions on the service |
Exam-relevant behaviour:
- Both endpoint types support endpoint policies; the effective permission is the intersection of the endpoint
policy and the caller's IAM permissions. A deny or missing allow in either blocks the call.
- Without an endpoint, a private subnet reaches AWS APIs only through a NAT gateway (public path) or not
at all - "the Lambda function in a private subnet cannot reach Secrets Manager" resolves to an interface endpoint for Secrets Manager, a NAT gateway, or moving the function, and the most secure/least exposure qualifier picks the endpoint.
- Use
aws:SourceVpce(oraws:SourceVpc) conditions in resource and key policies to require that requests
arrive through your endpoint - the standard pattern for "only allow KMS decrypt calls from inside the VPC."
- S3 gateway endpoints combined with bucket policies that deny any request not arriving via the endpoint
give you private-only buckets reachable from on-premises through the same endpoint model when extended with PrivateLink patterns.
- Interface endpoints also let other VPCs and on-premises networks consume a service privately (endpoint
services), which is how Bedrock and third-party SaaS integrations stay off the internet.
Gateway endpoints exist for exactly two services: S3 and DynamoDB. Any question attaching a gateway endpoint to another service contains its own wrong answer. Conversely, "the endpoint created ENIs in the subnets" tells you it was an interface endpoint even if the stem never names the type.
PrivateLink interface endpoint. A VPC endpoint built from elastic network interfaces with private IP addresses in your subnets, giving resources in the VPC private connectivity to an AWS service over the AWS network instead of the public internet. It matters because most services beyond S3 and DynamoDB - KMS,
Secrets Manager, STS, Bedrock - are reached privately this way, with an endpoint policy controlling what may be done through it and private DNS making the service's normal hostname resolve to those private IPs.
1. A Lambda function in a private subnet with no NAT gateway cannot reach Secrets Manager. What do you create, and what appears in your subnets when you do?
2. A KMS key policy must permit decrypt calls only when they arrive from inside the VPC through its endpoint.
Which condition key enforces this?
Answers: 1. An interface VPC endpoint (PrivateLink) for Secrets Manager - creating it places elastic network interfaces with private IPs in the subnets you enable. 2. aws:SourceVpce, set to the endpoint's ID.
End-of-Chapter Test
1. A Lambda function must write orders to a DynamoDB table in the same account. Which approach follows least privilege?
- Create an IAM user for the application, generate access keys, and store them in the function's environment variables
- Attach a policy allowing dynamodb:PutItem on the table's ARN to the function's execution role
- Attach the AmazonDynamoDBFullAccess managed policy to the function's execution role
- Give the function a policy allowing all DynamoDB actions on all resources
2. Which Cognito component returns temporary AWS credentials that let a signed-in user's mobile app upload a photo directly to S3?
- User pool
- Hosted UI
- Identity pool
- User pool Lambda trigger
3. An application must rotate a third-party API key automatically every 30 days and notify the application of each change with minimal custom lifecycle code. Which service should store the key?
- Parameter Store Standard tier, as a SecureString
- AWS Secrets Manager with automatic rotation
- AWS KMS
- An encrypted environment variable in the Lambda function
4. Compliance requires that every use of the encryption key protecting an S3 bucket be auditable and that the security team - not the storage team - control who can use the key. Which S3 encryption option meets these requirements?
- SSE-S3
- SSE-C
- SSE-KMS with an AWS managed key
- SSE-KMS with a customer managed key
5. A developer configures a Bedrock guardrail. Prompt Attack filtering is set to HIGH for input and the console will not let them raise its output strength. Why?
- Prompt Attack filtering requires a paid guardrail tier for output
- Prompt attacks exist only in input; the output strength for Prompt Attack is fixed to None
- The guardrail draft must be published before output filtering can be enabled
- Prompt Attack filtering conflicts with content filters on output
6. A finance team will paste account data into a Bedrock-powered assistant and requires that prompts never leave the VPC and never be used to train a model. Which combination addresses both requirements?
- Enable model invocation logging and apply an SCP denying Bedrock in other Regions
- Use a PrivateLink interface endpoint for Bedrock; no additional control is needed for training, because Bedrock does not use customer inputs or outputs to train base models
- Attach a guardrail with PII masking and use public Bedrock endpoints with TLS
- Store prompts in an encrypted S3 bucket and invoke Bedrock over the internet
7. An AI agent built on Bedrock AgentCore can issue refunds through a payment tool. A policy must prevent any single refund above $500 and require human approval for refunds above $100. Where should these controls be enforced?
- In the agent's system instructions
- In AgentCore Gateway, using Policy in AgentCore rules evaluated on every tool call, with Gateway elicitation pausing execution for approval
- In the payment API's IAM user policy
- In a Lambda authorizer on API Gateway in front of the agent
8. A private-subnet ECS task fails to retrieve a secret from Secrets Manager but can reach DynamoDB. There is no NAT gateway. What is the most likely missing component?
- A gateway VPC endpoint for Secrets Manager
- An interface VPC endpoint for Secrets Manager
- A gateway VPC endpoint for DynamoDB
- An internet gateway attached to the VPC
Answer key
1. B — The execution role supplies temporary credentials with no stored keys, and the policy is scoped to the single action and table the function needs. C works but grants far more than needed, A embeds long-lived credentials, and D is the opposite of least privilege.
2. C — Identity pools exchange an authenticated identity for STS temporary credentials tied to an IAM role. User pools only authenticate and issue JWTs; they never issue AWS credentials.
3. B — Secrets Manager is the only option with built-in scheduled rotation (driven by a Lambda function) and version staging. Parameter Store has no native rotation, KMS manages encryption keys rather than application secrets, and an environment variable requires manual redeployment.
4. D — A customer managed key has an editable key policy the security team controls, and its use is logged to CloudTrail under your account's control. SSE-S3 offers no key control, SSE-C keys are never visible to CloudTrail key-use auditing in KMS, and the policy on an AWS managed key cannot be edited.
5. B — Prompt injection and jailbreaks are properties of the request sent to the model, so Guardrails evaluates Prompt Attack on input only and fixes output strength to None. It is not a tiering, versioning, or filter-conflict limitation.
6. B — A PrivateLink interface endpoint keeps invocation traffic on private network paths, and AWS documents that Bedrock does not train base models on customer inputs or outputs, so no opt-out action is required for that requirement. Logging (A) increases data exposure, (C) leaves traffic on public endpoints, and (D) addresses storage rather than either stated requirement.
7. B — AgentCore Gateway is the enforcement point for tool calls, Policy in AgentCore evaluates fine-grained rules (including parameter limits) on each call, and elicitation provides the pause-for-approval flow. Instructions to the model (A) are not enforcement, and (C) and (D) sit outside the agent's tool-call path.
8. B — Secrets Manager is reached through interface endpoints (PrivateLink); gateway endpoints exist only for S3 and DynamoDB - which also explains why DynamoDB already works (C describes what is presumably present, not what is missing). An internet gateway (D) would expose the subnet rather than fix private access.
Want the full AWS Developer – Associate (DVA-C03) package?
This guide is free to read. Get the downloadable PDF guidebook plus the full DVA-C03 practice exam with 3 months of online access.
Get DVA-C03 Full Access — $10