AWS Developer DVA-C02 · 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?

Published · Last updated · checked before publication — how we verify questions

Options

  • AReturns a permanent root X.509 cert; disables IAM in Account B
  • BReturns temporary AccessKeyId, SecretAccessKey, and SessionToken via Trust PolicyCorrect answer
  • 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

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

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.

Why the other options are wrong

  • 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.

All Security questions and the topic overview →

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.