【问题标题】:AWS Cloudformation Output ElastiCacheClusterAWS Cloudformation 输出 ElastiCacheCluster
【发布时间】:2019-07-19 18:30:27
【问题描述】:

大家好,我正在与 Cloudformation 一起配置 EC2 集群和 ElastiCache 集群。当我使用 Cloudformation 创建堆栈时,我在 EC2 instance 处提供了一个输出错误配置。

错误是:找不到输出堆栈(如?)

如何接收 ElasticCache 主端点?

Outputs : 
  EndPoint:
    Description: "EndPoint Redis"
    Value: !GetAtt ElastiCacheCluster.PrimaryEndPoint.Address

  UserData:
    Fn::Base64:
      Fn::Sub: 
      - |
        #!/bin/bash
        echo ${RedisHost} > /tmp/redis_host

      - RedisHost: !GetAtt ElastiCache.Outputs.EndPoint

【问题讨论】:

    标签: amazon-web-services amazon-cloudformation


    【解决方案1】:

    在你的第一个堆栈中,你需要export这个值:

    Outputs : 
      EndPoint:
        Description: "EndPoint Redis"
        Value: !GetAtt ElastiCacheCluster.PrimaryEndPoint.Address
        Export:
          Name: RedisHost
    

    然后在你的第二个堆栈中,你需要import它:

    UserData:
      Fn::Base64:
        Fn::Sub: 
        - |
          #!/bin/bash
          echo ${RedisHost} > /tmp/redis_host
    
        - RedisHost: !ImportValue: RedisHost
    

    另请参阅 this 相关 Stack Overflow 答案。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-28
      • 2020-09-29
      • 2017-07-01
      • 1970-01-01
      • 2020-11-05
      • 2016-06-17
      相关资源
      最近更新 更多