python – 警报操作“终止EC2实例”失败

当我启动某种类型的实例时,userdata-script通过Boto创建一个度量报警.

该指标正确地将其数据传送到CloudWatch.

如果基于度量的某些条件匹配,则警报应将实例作为操作终止.

在CloudWatch中,警报似乎正确创建,并根据需要切换警报状态.

但:
在执行操作时,它失败并带有以下“历史”条目:
警报已更新

>确定要报警.原因:阈值交叉:5个数据点大于阈值(200.0).最新数据点:999.0,999.0.
> arn:aws:automate:eu-west-1:ec2:terminate正在进行中.
>终止EC2实例’i-xxx’操作失败. AWS无法验证提供的访问凭据.

我已经将策略“AdministratorAccess”授予附加到实例的“userdata”-Role.

任何提示?

问候
汤姆

最佳答案 我相信这是个问题.从
developer guide

If you are using an IAM role (e.g., an Amazon EC2 instance profile),
you cannot stop or terminate the instance using alarm actions.
However, you can still see the alarm state and perform any other
actions such as Amazon SNS notifications or Auto Scaling policies.

我最近在AWS论坛上发布了关于此问题的信息:
https://forums.aws.amazon.com/message.jspa?messageID=601951

点赞