54

I am attempting to create an EC2 instance and get the following error message. How do I decode it ?

Launch Failed

You are not authorized to perform this operation. Encoded authorization failure message: KDmmJmkLKmQhatEqYt...MN3iUtfAa

jlo-gmail
  • 4,453
  • 3
  • 37
  • 64
  • 10
    FYI, the reason that the message is encoded is that the message can convey information about security (eg which security groups are permitted). Revealing this information could reduce security. Only people with permission to decode the message can access this information. – John Rotenstein Feb 09 '21 at 01:51

5 Answers5

90

use the following aws cli command from the console or CloudShell:

aws sts decode-authorization-message --encoded-message KDmmJmkLKm...iUtfAa
jlo-gmail
  • 4,453
  • 3
  • 37
  • 64
  • 15
    In Linux shell one can use `jq` program to format the message more readable by adding `--output text | jq '.'` to the end of the command. So the whole command is `aws sts decode-authorization-message --encoded-message KDmmJmkLKm...iUtfAa --output text | jq '.'` – Eastman Jan 18 '22 at 12:28
  • 3
    Quite ridiculous that you need permissions to access that! – user582175 Feb 02 '23 at 21:17
9

I use the following command:

aws sts decode-authorization-message --encoded-message 'KDmmJmkLKm...iUtfAa' | sed 's/\\"/"/g' | sed 's/^"//' | sed 's/"$//'
Effie
  • 191
  • 1
  • 5
3

For better flattening and more readable format try

msg='encoded message'
aws sts decode-authorization-message --encoded-message "$msg" --output text | sed 's/,/\n\r/g' | sed 's/{//g' | sed 's/}//g' | sed 's/"//g'
Shivam Anand
  • 952
  • 1
  • 10
  • 21
2

To add on, you can further decode your message into a proper JSON format using the following:

aws sts decode-authorization-message --encoded-message KDmm..sA | jq -r .DecodedMessage | jq
pokki
  • 21
  • 1
0

I had the same issue. I was learning to create EC2 instances with Terraform but kept getting the same error message as yours.
I created a new access key, and secret key. Updated the main.tf file and boom the instance was running.

007mrviper
  • 459
  • 4
  • 20