O problema é que você não tem mais permissões ec2: RunInstances, porque você adicionou essa permissão junto com a condição, para que ela substitua - ela procurará uma instância do EC2 com essa tag; vendo que você tem apenas "ec2: DescribeInstances" em Resource: ["*"];
Adicione duas instruções separadas e especifique os recursos exatos de cada uma:
- um para o AMI com recurso: ["arn: aws: ec2: region :: image / ami - *"]
- um para ec2: RunInstances com recurso: ["arn: aws: ec2: region: conta: instance / *"]
Exemplo: (retirado do link )
The following policy allows users to launch instances using only the AMIs that have the specified tag, "department=dev", associated with them. The users can't launch instances using other AMIs because the Condition element of the first statement requires that users specify an AMI that has this tag. The users also can't launch into a subnet, as the policy does not grant permissions for the subnet and network interface resources. They can, however, launch into EC2-Classic. The second statement uses a wildcard to enable users to create instance resources, and requires users to specify the key pair project_keypair and the security group sg-1a2b3c4d. Users are still able to launch instances without a key pair.
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": "ec2:RunInstances",
"Resource": [
"arn:aws:ec2:region::image/ami-*"
],
"Condition": {
"StringEquals": {
"ec2:ResourceTag/department": "dev"
}
}
},
{
"Effect": "Allow",
"Action": "ec2:RunInstances",
"Resource": [
"arn:aws:ec2:region:account:instance/*",
"arn:aws:ec2:region:account:volume/*",
"arn:aws:ec2:region:account:key-pair/project_keypair",
"arn:aws:ec2:region:account:security-group/sg-1a2b3c4d"
]
}
]
}