Instance recovery may fail with the error "You are not authorized to perform this operation"

Instance recovery may fail with the error "You are not authorized to perform this operation"

Instance recovery may fail with the error "You are not authorized to perform this operation" :

ERROR:  recover_ebs_based_instance(.\cpmserver\cpm\recovery.py:749)  Run_instance failed. Exception: EC2ResponseError: 403 Forbidden
<?xml version="1.0" encoding="UTF-8"?>
<Response><Errors><Error><Code>UnauthorizedOperation</Code><Message>You are not authorized to perform this operation. Encoded authorization failure message: r27JjPiMt721ZOQTYL-7xJPDo5MPYrIbr2Y7w5Cjd0lNuZe8Yg4u_fWruQRjMZj6w1EgSOx20iOp9_Jgxkb3cBLJw-6iuSRMJD0nhpe9sxBN4LwPoNDiwquXAmUQZb-55S5fvRaBG-gpe1OR6jDmOSjFahfytvQbP_jGIcDjcF91lmxLL5NN8gR73s2VJPjGWEJpwtaCBvjPugX7KKETn3TeNiihzWWXotsybPWNLfllF5aiYIAO8Fiu2DljShhFTJ-q9NWXWyuWLQ_2V0MILdwj0qnR-px6Q11Pd1mn2py2uJC_tgOq-7r51x6NA3nUJoIgj1TM2lmncdGqE-NAszMXpHj7_tgY1kvHM-0j9fXewNG5Z_GBLiGTWzvFBq3XfCHz</Message></Error></Errors><RequestID>8205645a-59c0-483d-886b-1612456e2a95</RequestID></Response>

It appears that you are missing some permissions, most likely "ec2:RunInstances" and/or "ec2:StartInstances".

If the instance you are trying to restore has an instance profile (IAM role) applied to it, the failure may be caused by lack of "iam:PassRole" permission in your user's policies - but only if it's not a cross-account restore.

If this is a cross-account restore, you need either to remove the instance profile in the "Advanced Settings", or replace it with an iAM role that belongs to the target account.

If the permissions don't help, you need to decode the "Encoded authorization failure message" above using this documentation from AWS: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/sts/decode-authorization-message.html