Bubunia Patra
Bubunia Patra

Reputation: 27

How to Pass the Output of Cloudformation to the shell script

I am writing a cloudformation template and its output some values in the "Output" section. I want to retrieve these values from a shell script to perform some other operations. If that is possible, can someone help me providing some example?

Regards Pradeep

Upvotes: 1

Views: 4194

Answers (2)

kichik
kichik

Reputation: 34744

As @PicoutputCIs said, you can use aws cloudformation describe-stacks. But you don't have to parse yourself. You can let aws parse for you with --query. For example:

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

For more options see: http://docs.aws.amazon.com/cli/latest/userguide/controlling-output.html

Upvotes: 2

PicoutputCls
PicoutputCls

Reputation: 1589

You should be able to get at the Outputs from a stack from a shell script through the AWS CLI using the aws cloudformation describe-stacks command, as described in the AWS CloudFormation documentation, and parsing the JSON output returned.

Upvotes: 1

Related Questions