【问题标题】:Unresolved resource dependencies [DefaultSchedule] in the Resources block of the template模板资源块中未解决的资源依赖项 [DefaultSchedule]
【发布时间】:2018-08-08 17:34:33
【问题描述】:

我正在使用 cloudformation 脚本来创建 AWS Data Pipeline。我已经根据文档创建了脚本,但我面临 1 个错误,即

模板验证错误:模板格式错误:未解析的资源 模板资源块中的依赖项[DefaultSchedule]

这是我脚本的资源部分:

Resources:
DataPipelineForS3Backup:
Type: AWS::DataPipeline::Pipeline
Properties:
  Name:
    Ref: S3BackupDataPipeline
  Description:
    Ref: S3BackupDataPipeline
  Activate: 'true'
  ParameterObjects:
  - Id: myAwsCliCommand
    Attributes:
    - Key: description
      StringValue: Dp command to run
    - Key: type
      StringValue: String
  ParameterValues:
  - Id: myAwsCliCommand
    StringValue:
      Ref: AwsCliCommand
  PipelineObjects:
  - Id: DefaultSchedule
    Name: Every 1 day
    Fields:
    - Key: type
      StringValue: Schedule
    - Key: period
      StringValue: 1 Day
    - Key: startDateTime
      StringValue: 2018-08-08T19:00:00
  - Id: Default
    Name: Default
    Fields:
    - Key: failureAndRerunMode
      StringValue: CASCADE
    - Key: type
      StringValue: Default
    - Key: resourceRole
      StringValue:
        Ref: S3BackupResourceRole
    - Key: pipelineLogUri
      StringValue:
        Ref: S3BackupDpLogUri
    - Key: role
      StringValue:
        Ref: S3BackupDpRole
    - Key: scheduleType
      StringValue: cron
    - Key: schedule
      StringValue:
        Ref: DefaultSchedule

谁能告诉我这个脚本是怎么回事?谢谢

【问题讨论】:

    标签: amazon-web-services amazon-cloudformation aws-data-pipeline


    【解决方案1】:

    首先,在 YAML 中编写脚本时,您应该非常小心缩进以避免错误。应该是这样的:

    Resources:
      DataPipelineForS3Backup:
        Type: AWS::DataPipeline::Pipeline
        Properties:
          Name:
          ...
    

    另外,据我了解,您正在尝试获取其中一个 PipelineObjects 的引用。为此,您应该使用 RefValue: DefaultSchedule 而不是 Ref: DefaultSchedule

    请参阅文档中的示例:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-datapipeline-pipeline.html#w2ab2c21c10d332c13

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-10-22
      • 2020-05-15
      • 2020-03-30
      • 2019-03-28
      • 2020-03-25
      • 1970-01-01
      • 2018-11-14
      • 2020-01-10
      相关资源
      最近更新 更多