I use this Policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1385026304010",
"Effect": "Allow",
"Action": [
"ec2:RunInstances"
],
"Condition": {
"StringEquals": {
"ec2:InstanceType": "t2.medium"
}
},
"Resource": [
"arn:aws:ec2:us-east-1:*:instance/*",
"arn:aws:ec2:us-east-1:*:image/ami-81c603ea",
"arn:aws:ec2:us-east-1:*:key-pair/CodeDeploy",
"arn:aws:ec2:us-east-1:*:security-group/sg-5ace243d",
"arn:aws:ec2:us-east-1:*:volume/*"
]
}
]
}
But it show error message , Initialization failed . I see this example in aws Documentation but dont understand why this problem happen.
Decoded message
{
"allowed": false,
"explicitDeny": false,
"matchedStatements": {
"items": []
},
"failures": {
"items": []
},
"context": {
"principal": {
"id": "AIDAJXOEQNA64A677DGQO",
"name": "DevOps1",
"arn": "arn:aws:iam::955246940111:user/DevOps1"
},
"action": "ec2:RunInstances",
"resource": "arn:aws:ec2:us-east-1:955246940111:key-pair/CodeDeploy",
"conditions": {
"items": [
{
"key": "ec2:Region",
"values": {
"items": [
{
"value": "us-east-1"
}
]
}
}
]
}
}
}