An organization runs a containerized microservice on Amazon ECS in Account B (). The application must retrieve database credentials stored in AWS Secrets Manager in Account A (). The secret in Account A is encrypted using a customer managed KMS key.
The SysOps administrator has configured the secret's resource policy in Account A to allow the ECS task execution role in Account B to perform `secretsmanager:GetSecretValue`. In Account B, the administrator attached an IAM policy to the ECS task execution role allowing `secretsmanager:GetSecretValue` on the secret ARN and `kms:Decrypt` on the KMS key ARN in Account A.
During container startup, the task fails with an `AccessDeniedException` indicating that the ECS container agent is unauthorized to perform `kms:Decrypt` on the customer managed KMS key.
Which action should the administrator take to resolve this issue?
- AAdd the `iam:PassRole` permission to the ECS task execution role in Account B targeting the AWS Secrets Manager service role in Account A.
- BChange the encryption of the secret in Account A to use the default AWS managed key (`aws/secretsmanager`) to automatically delegate decryption authority to Account B.
- Add a statement to the key policy of the customer managed KMS key in Account A that allows the ECS task execution role in Account B to perform the `kms:Decrypt` action.Answer
- DDeploy a VPC endpoint for AWS Secrets Manager in Account B's VPC, and ensure the endpoint's route table includes a route pointing to the VPC peering connection with Account A.