简体   繁体   中英

How to get AWS policy needed to run a specific CLI command?

I am new to AWS. I am trying to import an OVA to a AMI and use it for an EC2 instance as described here :

One of the commands it asks you to run is

aws ec2 describe-import-image-tasks --import-task-ids import-ami-1234567890abcdef0

When I do this I get An error occurred (UnauthorizedOperation) when calling the DescribeImportImageTasks operation: You are not authorized to perform this operation.

I believe this means I need to add the appropriate Role (with a policy to be able to describe-import-image-tasks) to my cli user.

In the IAM console, I see this search feature to filter policies for a role which I will assign to my user. However it doesn't seem to have any results for describe-import-image-tasks

在此处输入图像描述

Is there an easy way to determine which policies are needed to run an AWS Cli command?

There is not an easy way. The CLI commands usually (but not always) map to a single IAM action that you need permission to perform. In your case, it appears you need the ec2:DescribeImportImageTasks permission, as listed here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM