Skip to content

Instantly share code, notes, and snippets.

@matschaffer
Last active February 7, 2019 03:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matschaffer/36977dd7ee07d514934fcbb95b25589f to your computer and use it in GitHub Desktop.
Save matschaffer/36977dd7ee07d514934fcbb95b25589f to your computer and use it in GitHub Desktop.
A script for pulling an elasticbeanstalk solution name for a given runtime version
#!/usr/bin/env bash
set -euo pipefail
MINOR_VERSION=$(awk -F. '{print $1 "." $2}' $(dirname $0)/../.ruby-version)
NAME_FILTER="{\"Type\":\"PlatformName\",\"Operator\":\"begins_with\",\"Values\":[\"Puma with Ruby ${MINOR_VERSION}\"]}"
VERSION_FILTER='{"Type":"PlatformVersion","Operator":"=","Values":["latest"]}'
PLATFORM_ARN=$(
aws elasticbeanstalk list-platform-versions \
--filters "[${NAME_FILTER},${VERSION_FILTER}]" \
--query 'PlatformSummaryList[].PlatformArn' \
--output text
)
aws elasticbeanstalk describe-platform-version \
--platform-arn "${PLATFORM_ARN}" \
--query PlatformDescription.SolutionStackName \
--output text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment