我正在 CloudFormation 模板中导出堆栈名称和 Lambda 函数的 URL。
Outputs:
LambdaInvokeURL:
Value: !GetAtt Myurl.FunctionUrl
Export:
Name: !Sub "${AWS::StackName}"
我有 8 到 10 个堆栈导出类似的输出。
如何列出我的 AWS 账户中所有堆栈的所有导出名称和值?
我应该编写一个新的 CloudFormation 模板还是 Lambda 函数来列出它们?
使用
aws cloudformation list-exports
CLI 命令、ListExports
API 或任何 等效 SDK 方法。
您不需要为此编写新的 CloudFormation 模板或 Lambda 函数。
根据文档输出示例:
{
"Exports": [
{
"ExportingStackId": "arn:aws:cloudformation:us-west-2:123456789012:stack/private-vpc/99764070-b56c-xmpl-bee8-062a88d1d800",
"Name": "private-vpc-subnet-a",
"Value": "subnet-07b410xmplddcfa03"
},
{
"ExportingStackId": "arn:aws:cloudformation:us-west-2:123456789012:stack/private-vpc/99764070-b56c-xmpl-bee8-062a88d1d800",
"Name": "private-vpc-subnet-b",
"Value": "subnet-075ed3xmplebd2fb1"
},
{
"ExportingStackId": "arn:aws:cloudformation:us-west-2:123456789012:stack/private-vpc/99764070-b56c-xmpl-bee8-062a88d1d800",
"Name": "private-vpc-vpcid",
"Value": "vpc-011d7xmpl100e9841"
}
]
}