All exams← All AWS Developer Associate (DVA-C02) notes

Security (IAM, Cognito, KMS, Secrets Manager): AWS Developer Associate (DVA-C02) revision notes

Revision notes

IAM: the foundations

IAM is global, not regional. Every request is evaluated as an explicit DENY beats an explicit ALLOW, which beats the default implicit DENY. New identities have no permissions until a policy grants them.

  • Users, groups and roles all attach policies (JSON documents).
  • Roles are the exam favourite: they grant temporary credentials via STS (AssumeRole), used for cross-account access, EC2/Lambda execution, and federation. No long-term keys involved.
  • Policy types: identity-based (attached to user/group/role), resource-based (attached to the resource, e.g. S3 bucket policy, allows cross-account without a role), and permissions boundaries (cap the maximum permissions an identity can have).
  • IAM access keys should be rotated regularly; the exam expects you to know root account keys should never be used day-to-day.

Cognito: user identity for apps

Cognito has two separate pools and mixing them up is the classic trap.

  • User Pools: sign-up/sign-in directory. Issues JWTs (ID, access, refresh tokens) after authentication. Supports MFA, hosted UI, social/SAML federation.
  • Identity Pools: exchange a token (from a User Pool, Google, Facebook, SAML) for temporary AWS credentials via STS, so the app can call AWS services directly.
  • Remember: User Pool = authentication (who are you), Identity Pool = authorization to AWS resources (what can you touch).
  • Access tokens from a User Pool expire (default 1 hour); refresh tokens default to 30 days.

KMS: encryption keys

KMS manages Customer Master Keys (CMKs, now called KMS keys) used to encrypt data, never the data itself directly for large payloads.

  • Envelope encryption is the pattern: KMS encrypts a data key, the data key encrypts your actual data (get this for any 'large file' question).
  • Symmetric CMKs are default and cannot be exported; asymmetric keys exist for sign/verify or encrypt/decrypt outside AWS.
  • Key policies (resource-based) control access to a CMK and always take precedence in the evaluation alongside IAM.
  • KMS API calls (Encrypt, Decrypt, GenerateDataKey) are logged to CloudTrail — good for audit questions.
  • Automatic key rotation is available for symmetric CMKs on a yearly cycle when enabled.

Secrets Manager vs Parameter Store

Both store config, but the exam tests the differences hard.

  • Secrets Manager: built-in automatic rotation (via Lambda), charges per secret per month plus API calls, native RDS/Redshift/DocumentDB rotation templates.
  • Systems Manager Parameter Store: free tier (standard parameters), no built-in rotation (you'd script it), supports plain strings, string lists, and SecureString (KMS-encrypted).
  • SecureString parameters need kms:Decrypt permission as well as ssm:GetParameter.
  • Common mistake: assuming Parameter Store rotates secrets automatically — it does not, you must build that yourself.

Common exam traps

  • Confusing resource policies (can grant cross-account access directly) with identity policies (cannot, by themselves, grant access to another account's resource).
  • Forgetting that STS temporary credentials are short-lived and must be refreshed, not cached forever.
  • Thinking Cognito Identity Pools handle sign-in UI — they don't, that's User Pools.

Key facts

Flashcards

Is IAM a global or regional AWS service?
Global — IAM is not scoped to a region.
tap to reveal
In IAM policy evaluation, what wins: explicit DENY, explicit ALLOW, or implicit DENY?
Explicit DENY always wins, then explicit ALLOW, then the default implicit DENY applies if nothing matches.
tap to reveal
What AWS service issues temporary credentials when an IAM Role is assumed?
AWS STS (Security Token Service), via the AssumeRole API.
tap to reveal
What is the key difference between a Cognito User Pool and an Identity Pool?
User Pool = authentication directory issuing JWTs; Identity Pool = exchanges tokens for temporary AWS credentials to access AWS resources.
tap to reveal
What is the default expiry for a Cognito User Pool access token?
1 hour by default.
tap to reveal
What is the default expiry for a Cognito User Pool refresh token?
30 days by default.
tap to reveal
What is envelope encryption in KMS?
KMS encrypts a data key; that data key is then used to encrypt the actual data, rather than KMS encrypting the data directly.
tap to reveal
Can a symmetric KMS CMK be exported outside of KMS?
No, symmetric KMS keys cannot be exported.
tap to reveal
Does Secrets Manager or Parameter Store offer built-in automatic secret rotation?
Secrets Manager, using a Lambda function; Parameter Store has no built-in rotation.
tap to reveal
What permission, besides ssm:GetParameter, is needed to read a SecureString parameter?
kms:Decrypt on the KMS key used to encrypt it.
tap to reveal
Which policy type can grant cross-account access without the requester assuming a role?
Resource-based policies, e.g. an S3 bucket policy or a KMS key policy.
tap to reveal
What does a permissions boundary do in IAM?
It sets the maximum permissions an identity can have, capping what any attached policies can grant.
tap to reveal
How often can automatic key rotation occur for a symmetric KMS CMK?
Yearly, when automatic rotation is enabled.
tap to reveal
Which is free: Secrets Manager or Parameter Store standard parameters?
Parameter Store standard parameters are free; Secrets Manager charges per secret per month.
tap to reveal
Practice questions

Security (IAM, Cognito, KMS, Secrets Manager): 5 practice questions

Q1. A developer needs to grant a Lambda function permission to read objects from a specific S3 bucket. What is the recommended way to grant this permission?
  • A.  Attach the policy directly to the Lambda function's resource-based policy only, with no execution role
  • B.  Embed the AWS access key and secret key for an IAM user as environment variables in the function
  • C.  Create an IAM group containing the Lambda function and attach the policy to the group
  • D.  Attach an IAM execution role to the Lambda function with a policy allowing s3:GetObject on the bucket
Show answer & explanation
✓ Answer: D. Attach an IAM execution role to the Lambda function with a policy allowing s3:GetObject on the bucket
Lambda functions assume an IAM execution role at invocation time, and permissions should be granted via a policy attached to that role rather than long-lived credentials. Embedding access keys is a security anti-pattern since Lambda already supports temporary credentials via roles. Lambda functions cannot be added to IAM groups, since groups only contain IAM users.
Q2. Which statement correctly describes the difference between an IAM identity-based policy and a resource-based policy?
  • A.  Resource-based policies apply only to EC2 instances, while identity-based policies apply to all other services
  • B.  Identity-based policies are evaluated only after resource-based policies, and resource-based policies always take precedence
  • C.  Identity-based policies are attached to users, groups, or roles; resource-based policies are attached directly to a resource such as an S3 bucket or SQS queue
  • D.  Identity-based policies can only deny access, while resource-based policies can only allow access
Show answer & explanation
✓ Answer: C. Identity-based policies are attached to users, groups, or roles; resource-based policies are attached directly to a resource such as an S3 bucket or SQS queue
Identity-based policies attach to an IAM principal (user, group, or role) and define what that principal can do, whereas resource-based policies attach directly to a resource and define who can access it and how. Both policy types can contain Allow or Deny statements. Evaluation combines both, and an explicit Deny anywhere overrides an Allow, but neither type unconditionally 'wins' by category.
Q3. A company wants applications to retrieve a database password without ever hardcoding it, and wants the password rotated automatically every 30 days using a Lambda function. Which service should they use?
  • A.  AWS KMS customer managed key with automatic key rotation
  • B.  AWS Systems Manager Parameter Store standard parameters
  • C.  Amazon Cognito user pool custom attributes
  • D.  AWS Secrets Manager with rotation configured
Show answer & explanation
✓ Answer: D. AWS Secrets Manager with rotation configured
AWS Secrets Manager natively supports automatic rotation of secrets like database credentials using a Lambda rotation function on a defined schedule. Parameter Store standard parameters do not include built-in rotation (Advanced parameters plus custom automation would be needed, and this isn't native). KMS key rotation only rotates the cryptographic key material, not application secrets like passwords.
Q4. A developer creates an IAM policy with an explicit Deny for s3:DeleteObject and the user's role also has an AdministratorAccess managed policy attached granting full access. What is the effective permission for s3:DeleteObject for that user?
  • A.  Allow, because AdministratorAccess always overrides other policies
  • B.  Allow, because managed policies take precedence over inline policies
  • C.  It depends on which policy was attached first
  • D.  Deny, because an explicit Deny in any applicable policy always overrides an Allow
Show answer & explanation
✓ Answer: D. Deny, because an explicit Deny in any applicable policy always overrides an Allow
In IAM policy evaluation logic, an explicit Deny always overrides any Allow, regardless of how many Allow statements exist elsewhere, including from AdministratorAccess. Policy attachment order and policy type (managed vs inline) do not affect this evaluation rule. This is a core exam concept: default deny, explicit allow, explicit deny wins.
Q5. Which AWS KMS key type allows AWS to fully manage the key's lifecycle, including automatic annual rotation, and cannot have its key policy edited by the customer?
  • A.  AWS owned key
  • B.  AWS managed key
  • C.  Customer managed key
  • D.  Asymmetric customer managed key
Show answer & explanation
✓ Answer: B. AWS managed key
AWS managed keys (like aws/s3 or aws/rds) are created and administered by AWS on the customer's behalf, rotate automatically every year, and the customer cannot modify their key policy. Customer managed keys give full control over rotation settings and key policy. AWS owned keys are not visible in the customer's account at all and aren't tied to a specific AWS service alias the customer sees.
Test yourself
See the AWS Developer Associate (DVA-C02) page

More AWS Developer Associate (DVA-C02) topics