My EC2 instance has a IAM role below.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "~~~~",
"Effect": "Allow",
"Action": [
"ec2:DescribeInstances",
],
"Resource": "*",
"Condition": {
"StringEquals": {
"ec2:ResourceTag/myrole": "true"
}
}
}
]
}
But when I run the "aws ec2 describe-instances --instance-id i-00169bf14adaf25e4" command,
I got error "An error occurred (UnauthorizedOperation) when calling the DescribeInstances operation: You are not authorized to perform this operation."
I tested full EC2 authority IAM role, and works.
And read this https://forums.aws.amazon.com/thread.jspa?messageID=512129 but it was about "Resource".
Official document does not talk about IAM role. (https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-instances.html)
I think I missed some "Action" part, but couldn't find it.
Can somebody tell me Which IAM role is suitable for me? or how can I find it?
Thanks for reading this.
DescribeInstances
, but only for instances that have a tag calledmyRole
? – John RotensteinDescribeinstances
for instances that have a tag calledmyrole
. – qkqhxla1myRole
has a value oftrue
. (See IAM EC2 Resource Tags) I'm not sure whether you can simply test for existence of a tag name, regardless of value. – John Rotenstein