Im thinking about dynamically adding ELB DNS names to a reverse proxy and I need to grab these dynamically generated outputs from the CloudFormation. What command can let me grab a single output?
Related discussions:
Im thinking about dynamically adding ELB DNS names to a reverse proxy and I need to grab these dynamically generated outputs from the CloudFormation. What command can let me grab a single output?
Related discussions:
aws cloudformation describe-stacks --stack-name “${STACK_NAME}” --query ‘Stacks[0].Outputs[?OutputKey==`TheNameOfTheKeyGoesHere`].OutputValue’ --output text
On a side note, I found this gem recently, takes all Outputs from a CloudFormation Stack and makes them environmental variables. CloudFormation output `ELBDNS` would be stored in CF_OUT_ELBDNS.
export $(aws cloudformation describe-stacks --stack-name STACK_NAME_HERE --output text --query ‘Stacks[0].Outputs.join(=, [join(_, [CF, OUT, OutputKey]), OutputValue ])’)
Both answers are correct, one thing they’re (sort of) missing is that you need to specify the region if it’s not configured, this is directly from a CI job of mine:
export SITE_BUCKET=$(aws cloudformation describe-stacks --stack-name ${ENVIRONMENT_STACK_PROD} --region ${AWS_REGION} --query "Stacks[0].Outputs[?OutputKey=='SiteS3Bucket'].OutputValue" --output text)