A multinational corporation is implementing a centralized deployment pipeline. A containerized microservice hosted on Amazon ECS in a Shared Services account (Account ID: ) must dynamically retrieve runtime secrets and database credentials from AWS Secrets Manager located in a Production database account (Account ID: ). The Secrets Manager secret is encrypted using a Customer Managed Key (CMK) in the Production database account. The container in Account runs under an IAM task role named `EcsSharedTaskRole`. The architecture must enforce the principle of least privilege and prevent the storage of long-term credentials.
Which combination of configuration steps is required to securely enable this cross-account retrieval? (Select TWO.)
- Attach an identity-based policy to `EcsSharedTaskRole` in Account that allows `secretsmanager:GetSecretValue` on the Production secret ARN and `kms:Decrypt` on the Customer Managed Key ARN. Update the secret's resource-based policy in Account to grant `secretsmanager:GetSecretValue` to the `EcsSharedTaskRole` ARN.Answer
- Configure the key policy of the Customer Managed Key in Account to grant `kms:Decrypt` permissions to `arn:aws:iam::888888888888:role/EcsSharedTaskRole`.Answer
- CCreate a dedicated IAM user in Account with a permission policy allowing secrets retrieval, generate long-term access keys, and configure the ECS task definition to pass these keys as environment variables to the container.
- DReplicate the secret values into the Systems Manager Parameter Store in Account as standard, unencrypted parameters to eliminate the need for cross-account KMS decryption and IAM task role configuration.
- EConfigure the ECS task to run using the AWS account root user credentials of Account , and update the KMS key policy in Account to trust the root user of Account for all actions.
Answer
The correct configuration requires attaching an identity-based policy to the task role that allows secrets retrieval and decryption, granting the task role access in the secret's resource policy, and updating the KMS key policy to permit decryption by the task role.
To establish secure cross-account access to an encrypted secret in Secrets Manager, you must grant permissions on both sides of the account boundary. First, the IAM identity (the task role) in the consuming account must have an identity-based policy that allows accessing the secret and using the KMS key. Second, the secret's resource-based policy must explicitly permit the consuming role. Third, the KMS key policy in the producing account must trust the consuming role to perform decrypt operations. This direct delegation configuration satisfies the principle of least privilege.
Step-by-Step Solution
Key Concept
Cross-account access delegation using IAM roles, resource-based policies, and KMS key policies under the principle of least privilege.