You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

CloudFormation创建EventBridge Scheduler触发实例刷新遇API错误求助

问题原因及解决方案

问题原因

报错核心是EventBridge Scheduler无法识别指定API与服务的对应关系,根源在于ARN中的Auto Scaling服务名称大小写不符合要求。AWS Scheduler的Universal Target ARN对服务名称大小写敏感,Auto Scaling对应的正确SDK服务名称为AutoScaling(首字母大写、无空格),而非你模板中使用的小写autoscaling。

解决方案

1. 修正Target的ARN格式

将CloudFormation模板中的Target Arn修改为正确的大小写格式:

ScheduleExecuteInstanceRefreshAPI:
    Type: AWS::Scheduler::Schedule
    Properties:
      Name: 
      ...
      Target:
        Arn: 'arn:aws:scheduler:::aws-sdk:AutoScaling:StartInstanceRefresh'
        RoleArn: 'arn:aws:iam::<你的账户ID>:role/<具备权限的角色ARN>'
        Input: '{"AutoScalingGroupName": "<你的Auto Scaling组名称>"}'
      ...

2. 配置正确的IAM角色权限

为Scheduler指定的角色添加autoscaling:StartInstanceRefresh权限,同时确保角色信任策略允许scheduler.amazonaws.com作为服务主体:

示例权限策略

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "autoscaling:StartInstanceRefresh",
            "Resource": "arn:aws:autoscaling:<区域>:<你的账户ID>:autoScalingGroup:<资源ID>:autoScalingGroupName/<你的Auto Scaling组名称>"
        }
    ]
}

示例信任策略

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "Service": "scheduler.amazonaws.com"
            },
            "Action": "sts:AssumeRole"
        }
    ]
}

3. 验证Input参数格式

确保Input字段的JSON格式正确,必须包含AutoScalingGroupName参数——这是StartInstanceRefresh API的必填项。

内容的提问来源于stack exchange,提问作者Yong Cai

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.15 05:22:39