A developer is implementing an AWS Lambda function in Account A (111122223333) that needs to retrieve sensitive configuration data from an Amazon S3 bucket located in Account B (444455556666). The developer wants to use the AWS Security Token Service (STS) to assume an IAM role named CrossAccountS3Reader in Account B to access the bucket. The Lambda function runs under an execution role named LambdaExecutionRole in Account A.
Which of the following actions must the developer perform to establish this cross-account access? (Select TWO.)
- Modify the trust policy of the CrossAccountS3Reader role in Account B to allow the LambdaExecutionRole ARN from Account A to perform the sts:AssumeRole action.Cevap
- Attach a permissions policy to the LambdaExecutionRole in Account A that grants sts:AssumeRole permission on the CrossAccountS3Reader role ARN in Account B.Cevap
- CHardcode the AWS access key ID and secret access key of an IAM user created in Account B directly into the Lambda function's initialization code.
- DUpdate the trust policy of the CrossAccountS3Reader role in Account B to specify the service principal lambda.amazonaws.com as the trusted entity.
- EAttach a resource policy to the Lambda function in Account A that allows the CrossAccountS3Reader role in Account B to push credentials to the function.
Cevap
Modifying the trust policy of the target role in Account B to trust the execution role in Account A, and attaching an STS assume role policy to the execution role in Account A.
The correct options state that you must modify the trust policy of the destination role in the target account to trust the source execution role, and attach a policy to the source execution role in the origin account allowing it to assume the destination role. Both parts are mandatory to establish cross-account trust.
Adım Adım Çözüm
Anahtar Kavram
Establishing cross-account IAM role assumption requires configuring both the trust policy on the target role to trust the source identity, and the identity permissions policy on the source identity to allow the AssumeRole call.