Skip to content

Instantly share code, notes, and snippets.

@shollingsworth
Created April 28, 2023 20:06
Show Gist options
  • Save shollingsworth/3f4a9efbe75049687c07a134325e3cb4 to your computer and use it in GitHub Desktop.
Save shollingsworth/3f4a9efbe75049687c07a134325e3cb4 to your computer and use it in GitHub Desktop.
get the cloudformation stack output by outputkey
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
key="ServiceEndpointWebsocket"
stack_name="sh-ws-demo-backend-dev"
aws cloudformation describe-stacks --stack-name "${stack_name}" \
--query "Stacks[0].Outputs[?OutputKey=='${key}'].OutputValue" \
--output text
# {
# "Stacks": [
# {
# "StackId": "arn:aws:cloudformation:us-east-2:668805947503:stack/sh-ws-demo-backend-dev/81cbddb0-e3c4-11ed-aff0-02a190a45eed",
# "StackName": "sh-ws-demo-backend-dev",
# "ChangeSetId": "arn:aws:cloudformation:us-east-2:668805947503:changeSet/sh-ws-demo-backend-dev-change-set/55c1d391-757c-48c0-92f4-63c9d8844cc0",
# "Description": "The AWS CloudFormation template for this Serverless application",
# "CreationTime": "2023-04-25T23:54:25.010000+00:00",
# "LastUpdatedTime": "2023-04-27T22:02:47.514000+00:00",
# "RollbackConfiguration": {},
# "StackStatus": "UPDATE_COMPLETE",
# "DisableRollback": false,
# "NotificationARNs": [],
# "Capabilities": [
# "CAPABILITY_IAM",
# "CAPABILITY_NAMED_IAM"
# ],
# "Outputs": [
# {
# "OutputKey": "ConnectionManagerLambdaFunctionQualifiedArn",
# "OutputValue": "arn:aws:lambda:us-east-2:668805947503:function:sh-ws-demo-backend-dev-connectionManager:29",
# "Description": "Current Lambda function version",
# "ExportName": "sls-sh-ws-demo-backend-dev-ConnectionManagerLambdaFunctionQualifiedArn"
# },
# {
# "OutputKey": "SnsUnderscorerouterLambdaFunctionQualifiedArn",
# "OutputValue": "arn:aws:lambda:us-east-2:668805947503:function:sh-ws-demo-backend-dev-sns_router:9",
# "Description": "Current Lambda function version",
# "ExportName": "sls-sh-ws-demo-backend-dev-SnsUnderscorerouterLambdaFunctionQualifiedArn"
# },
# {
# "OutputKey": "DefaultMessageLambdaFunctionQualifiedArn",
# "OutputValue": "arn:aws:lambda:us-east-2:668805947503:function:sh-ws-demo-backend-dev-defaultMessage:29",
# "Description": "Current Lambda function version",
# "ExportName": "sls-sh-ws-demo-backend-dev-DefaultMessageLambdaFunctionQualifiedArn"
# },
# {
# "OutputKey": "ServiceEndpointWebsocket",
# "OutputValue": "wss://xbbv6yjs83.execute-api.us-east-2.amazonaws.com/dev",
# "Description": "URL of the service endpoint",
# "ExportName": "sls-sh-ws-demo-backend-dev-ServiceEndpointWebsocket"
# },
# {
# "OutputKey": "ServerlessDeploymentBucketName",
# "OutputValue": "sh-ws-demo-backend-dev-serverlessdeploymentbucket-soectn0wn1vo",
# "ExportName": "sls-sh-ws-demo-backend-dev-ServerlessDeploymentBucketName"
# }
# ],
# "Tags": [
# {
# "Key": "STAGE",
# "Value": "dev"
# }
# ],
# "EnableTerminationProtection": false,
# "DriftInformation": {
# "StackDriftStatus": "NOT_CHECKED"
# }
# }
# ]
# }
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment