【问题标题】:How to pass input to EventRule for a StepFunction Target in CloudFormation?如何将输入传递给 CloudFormation 中 Step Function 目标的事件规则?
【发布时间】:2020-02-07 06:06:56
【问题描述】:
Parameters:
Bucket:
  Default: bucket_1
  Type: String
  AllowedValues:
   - bucket_1
   - bucket_2

Resources:
StepFunction:
  Type: 'AWS::StepFunctions::StateMachine'
  Properties:
   DefinitionString: |-
    {
        ...
    }
   RoleArn: ...
   StateMachineName: ...

EventRule:
  Type: 'AWS::Events::Rule'
  Properties:
      ScheduleExpression: cron(...)
      Targets:
        - RoleArn: ...
          Arn: !Ref StepFunction
          Id: "ScheduleStepFunction"
          InputTransformer:
            InputPathsMap:
              Bucket: !Ref Bucket
            InputTemplate: "{\"Bucket\": <Bucket>}"

我正在尝试将名为 Bucket 的输入参数(在 CloudFormation 模板本身中定义为参数)传递给事件规则的 StepFunction 目标。

I get this error: InputPath for target ScheduleStepFunction is invalid.

Note: The optional parameter 'InputPath' has not been provided also.

【问题讨论】:

    标签: amazon-web-services amazon-cloudformation pipeline aws-glue aws-step-functions


    【解决方案1】:
    Targets:
            - RoleArn: ...
              Arn: !Ref StepFunction
              Id: "ScheduleStepFunction"
              InputTransformer:
                InputPathsMap:
                  Bucket: !Ref Bucket
                InputTemplate: "{\"Bucket\": <Bucket>}"
    

    您的 Targets 似乎有一些问题,因为按照 Amazon eventRule 文档的建议,您的目标中没有提及 Input。按照 AWS UserGuide 的建议,转到提供的链接以在目标中使用 Input。

    https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-target.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-01-17
      • 2021-01-02
      • 2022-08-26
      • 2020-03-27
      • 1970-01-01
      • 2020-11-24
      • 2020-09-19
      相关资源
      最近更新 更多