I am facing an issue while trying to provision my EC2 instance through Terraform. However, to debug that issue I am trying to decode the encoded authorization failure message.
But when trying to call that sts decode API I am getting:
Error: A client error (AccessDenied) occurred when calling the DecodeAuthorizationMessage operation: User: xxx is not authorized to perform: (sts:DecodeAuthorizationMessage)
Now I don't know which specific permission should I give to my IAM user to be able to decode this message?
Updates:
The message is encoded because the details of the authorization status can contain privileged information that the user who requested the operation should not see.
[ aws. sts] decode-authorization-message¶ Description¶ Decodes additional information about the authorization status of a request from an encoded message returned in response to an Amazon Web Services request.
For example, if a user is not authorized to perform an operation that he or she has requested, the request returns a Client.UnauthorizedOperation response (an HTTP 403 response). Some AWS operations additionally return an encoded message that can provide details about this authorization failure.
A: "An error occurred (UnauthorizedOperation) when calling the DeleteKeyPair operation: You are not authorized to perform this operation." D: "An error occurred (UnauthorizedOperation) when calling the AssociateIamInstanceProfile operation: You are not authorized to perform this operation. Encoded authorization failure message: ...."
Based on the error message quotued, it seems that sts:DecodeAuthorizationMessage permissions are required:
Decodes additional information about the authorization status of a request from an encoded message returned in response to an AWS request.
Subsequently you could add the following policy as an inline policy, for example, into your IAM user or its group:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowStsDecode",
"Effect": "Allow",
"Action": "sts:DecodeAuthorizationMessage",
"Resource": "*"
}
]
}
The same could be added through Customer Managed Policy if inline policies are not desired.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With