Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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