【问题标题】:Outputs JobQueueName instead of ARN for an AWS::Batch::JobQueue resource为 AWS::Batch::JobQueue 资源输出 JobQueueName 而不是 ARN
【发布时间】:2018-01-05 22:34:00
【问题描述】:

是否可以导出 JobQueueName 而不是 AWS::Batch::JobQueue 资源中的 ARN 资源 Outputs CloudFormation 部分(实际上是 serverless.yml)?

这就是我导出 ARN 的方式:

Outputs:
  epJobQueueMedium:
    Description: Batch Job Queue 50 - medium priority
    Value:
      Ref: epJobQueue50
    Export:
      Name: epJobQueueMediumArn

Fn::GetAtt 不会为 AWS::Batch::JobQueue see the table in the bottom of page 返回任何内容。

Fn::Ref 返回 AWS::Batch::JobQueue see table in the bottom of page 的 Arn。

是否可以直接获取我的资源的 JobQueueName 以避免在 ARN 上进一步拆分 (Fn::Split) 和选择 (Fn::Select)?

【问题讨论】:

    标签: amazon-web-services amazon-cloudformation serverless-framework aws-batch


    【解决方案1】:

    使用参数怎么样?

    ---
    AWSTemplateFormatVersion: '2010-09-09'
    Description: API Template
    Parameters:
      JobQueueName:
        Description: The name of the job queue
        Type: String
        Default: MyJobQueueName
    JobQueue:
      Type: AWS::Batch::JobQueue
      Properties:
        ...
        JobQueueName: !Ref JobQueueName
    Outputs:
      epJobQueueMediumName:
        Description: The name of this job queue
        Value: !Ref JobQueueName
        Export:
          Name: epJobQueueMediumName
    

    否则 Select/Split 可以巧妙地完成:

    Value: !Select [ "1", !Split [ "/", !Ref epJobQueue50 ] ]
    

    【讨论】:

    • 谢谢。通过查看这两个版本,我肯定会选择 Select-Split 选项。参数稍后会出现。
    • 当你修复 Split 语法时,我会接受它。第一个参数是分隔符;)我刚刚等待检查并验证您的解决方案:)
    • 好电话!更新
    • 我的最终(临时)解决方案是导出 ARN,将其作为环境变量传递给 lambda.js,然后使用 node.js 进行拆分。舒服多了。对于职位描述,拆分/选择解决方案变得过于冗长,因为存在“a:a:a:a/NAME:tag”。
    猜你喜欢
    • 1970-01-01
    • 2011-12-02
    • 2021-06-01
    • 2020-02-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-03
    • 1970-01-01
    相关资源
    最近更新 更多