大家好,我正在与Cloudformation一起提供EC2群集和ElastiCache群集。当我使用Cloudformation创建堆栈时,我在EC2实例上提供了输出错误配置。
错误是:找不到输出堆栈(如?)
如何接收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
答案 0 :(得分: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相关的堆栈溢出答案。