I just got this question and seems to have solved it.
The IAM role associated with the CloudWatch Alarm service is AWSServiceRoleForCloudWatchEvents. I believe his trustees are events.amazonaws.com. And his political document in the tag of trust ,
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "events.amazonaws.com" }, "Action": "sts:AssumeRole" } ] }
And my ec2 instance role policy document in the Trust Relationship tag
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "ec2.amazonaws.com" }, "Action": "sts:AssumeRole" } ] }
Then add the contents of the Trusted Entities events.amazonaws.com to the ec2 instance role policy document as follows:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "ec2.amazonaws.com" }, "Action": "sts:AssumeRole" }, { "Effect": "Allow", "Principal": { "Service": "events.amazonaws.com" }, "Action": "sts:AssumeRole" } ] }
This adds the trusted entity events.amazonaws.com to the role.
Then the CloudWatch Alarm to stop instance function is fine!
source share