Skip to content
Latchkey

aws cloudformation describe-stacks: Read Stack Outputs

aws cloudformation describe-stacks returns a stack's status, parameters, and Outputs, the standard way for a pipeline to read values (a bucket name, an endpoint) produced by a deploy.

After a deploy, later steps need the stack outputs (queue URL, API endpoint, role ARN). describe-stacks plus JMESPath extracts a single output value cleanly.

What it does

aws cloudformation describe-stacks returns the full description of --stack-name, including StackStatus and the Outputs array. With --query you can pull a specific output by key. Omitting --stack-name lists all stacks.

Common usage

Terminal
# Read one output value by key
aws cloudformation describe-stacks \
  --stack-name my-service \
  --query "Stacks[0].Outputs[?OutputKey=='ApiEndpoint'].OutputValue" \
  --output text

Options

FlagWhat it does
--stack-name <name|arn>Stack to describe (name works only for active stacks)
--query "Stacks[0].Outputs..."JMESPath to select an output value
--output textBare value for shell capture

In CI

The idiom Stacks[0].Outputs[?OutputKey=='X'].OutputValue with --output text returns a clean scalar you can assign to a variable. A deleted stack cannot be looked up by name (only by full ARN), which is why a re-run after a failed delete reports "does not exist". Use aws cloudformation wait stack-create-complete before reading outputs of a fresh stack.

Common errors in CI

"An error occurred (ValidationError) when calling the DescribeStacks operation: Stack with id my-service does not exist" means the stack was never created, is in another region, or was deleted (deleted stacks are only addressable by ARN). "AccessDenied" means missing cloudformation:DescribeStacks. "ThrottlingException: Rate exceeded" can hit when many jobs poll at once; add a retry/backoff or use the wait commands.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →