【问题标题】:How to Pass the Output of Cloudformation to the shell script如何将 Cloudformation 的输出传递给 shell 脚本
【发布时间】:2018-05-15 11:06:24
【问题描述】:

我正在编写一个 cloudformation 模板,并在“输出”部分输出一些值。我想从 shell 脚本中检索这些值以执行一些其他操作。如果可能的话,有人可以帮我提供一些例子吗?

问候 普雷迪普

【问题讨论】:

标签: shell amazon-web-services amazon-cloudformation


【解决方案1】:

正如@PicoutputCIs 所说,您可以使用aws cloudformation describe-stacks。但是您不必自己解析。你可以让aws--query为你解析。例如:

$ aws cloudformation describe-stacks --query Stacks[].Outputs[*].[OutputKey,OutputValue] --output text
SomeKey       SomeValue
SomeOtherKey       SomeOtherValue

有关更多选项,请参阅: http://docs.aws.amazon.com/cli/latest/userguide/controlling-output.html

【讨论】:

    【解决方案2】:

    您应该能够使用aws cloudformation describe-stacks 命令(如AWS CloudFormation documentation 中所述)通过AWS CLI 从shell 脚本的堆栈中获取Outputs,并解析返回的JSON 输出。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-31
      • 2020-08-31
      • 1970-01-01
      相关资源
      最近更新 更多