amazon-web-services - AWS Cloudformation:为未命名的 ECS 服务输出 ServiceName
问题描述
我通过 cloudformation 创建 ECS 堆栈。一切正常。由于某种原因,我没有在定义中为ECS服务(名称:服务)指定ServiceName。但是,我想在 Cloudformation 创建堆栈后将其输出。所以为了这个目的,我定义了这样的输出:
Outputs:
ECSServiceName:
Description: Service Name I want to see
Value: !GetAtt Service.ServiceName
当我运行更新 CF Stack 时,我收到来自 AWS 的错误:
Requested attribute ServiceName must be a readonly property in schema for AWS::ECS::Service
如果之前没有严格指定,这是否意味着我无法在输出中接收它?或者我在输出定义的某个地方犯了一个错误?
解决方案
您必须从模板中导出。 ECSServiceName
获取 ECS 服务名称的正确方法是!GetAtt Service.Name
:
Outputs:
ECSServiceName:
Description: Service Name I want to see
Value: !GetAtt Service.Name
Export:
Name: ECSServiceName
然后,在其他模板中,您可以使用ImportValue来引用导出的输出:
!ImportValue ECSClusterName
推荐阅读
- python - 使用 pandas 读取 CSV 文件时无法正确对齐行和列
- three.js - 如何在 Threejs 中获取更新的缓冲区属性
- python - 新列的多索引计算
- spring-batch - 如何验证 Reader 中的参数以进行查询
- python - 我怎样才能用python画出圆形的形状?
- sql - 经纬度搜索店铺周边的入驻用户
- javascript - ElementsFromPoints 不适用于 ResizeObserver
- firebase - Cloud Firestore - 仍然出现“任何用户都可以写入您的整个数据库”错误
- sql - 如何获取 SQL Server 中两个日期之间的天数?
- android - 通知警报持续声音