【问题标题】:store the values to a variable after executing the template执行模板后将值存储到变量中
【发布时间】:2020-03-26 20:04:49
【问题描述】:

此 cloudformation 模板按预期工作:

https://github.com/shantanuo/cloudformation/blob/master/updated/esbck.yml

但是如何输出它创建的 IAM 角色的 ARN?

【问题讨论】:

    标签: amazon-cloudformation


    【解决方案1】:

    要添加到 Marcins 的答案,如果您导出输出,则它可用于部署在同一 AWS 账户(同一区域)中的其他 Cloudformation 模板

    在输出中添加一个导出:

    Outputs:
      RoleArn:
        Value: !GetAtt EsSnapshotRole.Arn
        Export:
          Name: EsSnapshotRoleArn
    

    完成后,您可以在其他模板中使用Fn::ImportValue 内部函数

    # some-other-template.yml
    
    Resources:
      SomeResourceRequiringRoleArn:
        Type: AWS::SomeService::SomeResource
        Properties:
          IamRoleArn: !ImportValue EsSnapshotRoleArn
    

    【讨论】:

      【解决方案2】:

      必须添加output部分:

      Outputs:
      
        RoleArn:
           Value: !GetAtt EsSnapshotRole.Arn
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-05-10
        • 1970-01-01
        • 1970-01-01
        • 2020-09-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多