小编Sim*_*mon的帖子

cloudformation 中的 AWS eventbridge 调度程序:尽管权限已附加到 lambda 函数,但目标需要 RoleArn

我是 cloudformation 的新手,想要使用新的事件调度程序 (AWS::Scheduler::Schedule) 触发 lambda 函数。

但是,尽管我向调度程序添加了权限(具有 eventbridge 原理的 lambda:InvokeFunction),但我仍然需要指定 RoleArn,否则会引发错误。

这意味着我必须为调度程序目标定义一个新角色?我应该使用哪个角色以及如何通过 cloudformation 完成该角色?

非常感谢,非常感谢任何帮助!西蒙先生

#...
  
TriggerStop20dailyCET:
    Type: AWS::Scheduler::Schedule
    Properties:
      Description: Stop RDS and EC2 with Tag 20:00
      Name:
        !Join
        - '-'
        - - Ref: Prefix
          - Ref: Title
          - "20-00_CET"
      FlexibleTimeWindow:
        Mode: FLEXIBLE
        MaximumWindowInMinutes: 1
      ScheduleExpressionTimezone: Europe/Zurich
      ScheduleExpression: "cron(0 20 * * ? *)"
      State: "ENABLED"
      Target:
        Arn:
          Fn::GetAtt:
            - LambdaInstSchedDispatcher
            - Arn
        #RoleArn: Fn::GetAtt: [ "<which role to use?>", "Arn" ] -> without this key an error …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services aws-cloudformation amazon-iam aws-lambda aws-event-bridge

4
推荐指数
1
解决办法
3243
查看次数