A developer has deployed a Java application on an Amazon EC2 instance. The application is designed to retrieve database credentials from AWS Secrets Manager using the AWS SDK. The credentials are encrypted using a customer managed AWS KMS key. The EC2 instance is associated with an IAM instance profile that has the following IAM policy attached:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"secretsmanager:GetSecretValue"
],
"Resource": "arn:aws:secretsmanager:us-east-1:123456789012:secret:ProductionDatabaseSecret-xyz789"
}
]
}
When the application attempts to retrieve the secret value, it receives an `AccessDeniedException` error. Which two actions should the developer take to resolve this authorization failure? (Select TWO.)
- Add the `kms:Decrypt` permission to the IAM policy attached to the EC2 instance's IAM role for the customer managed KMS key.Cevap
- Update the key policy of the customer managed KMS key to grant the EC2 instance's IAM role permission to perform the `kms:Decrypt` action.Cevap
- CUpdate the trust policy of the EC2 instance's IAM role to allow the AWS Secrets Manager service principal (`secretsmanager.amazonaws.com`) to assume the role.
- DModify the application code to initialize the Secrets Manager client by hardcoding the AWS access key ID and secret access key of an IAM user that has administrative privileges.
- EConfigure an Amazon Cognito Identity Pool to exchange the EC2 instance profile's temporary credentials for a new Cognito User Pool session that has KMS decrypt permissions.