Created
May 12, 2015 20:41
-
-
Save ianblenke/84e9b1234803ed58aaa8 to your computer and use it in GitHub Desktop.
Discovering the currently deployed version on an elasticbeanstalk EC2 instance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWS_DEFAULT_REGION=$(curl -s http://169.254.169.254/latest/dynamic/instance-identity/document | jq -r .region) | |
EC2_INSTANCE_ID=$(curl -sL http://169.254.169.254/latest/meta-data/instance-id) | |
EB_ENVIRONMENT_ID=$(aws ec2 describe-tags --filter Name=resource-id,Values=$EC2_INSTANCE_ID --region $AWS_DEFAULT_REGION | jq -r '.Tags | .[] | select(.Key=="elasticbeanstalk:environment-id") | .Value') | |
EB_APPLICATION_VERSION=$(aws elasticbeanstalk describe-environments --environment-ids $EB_ENVIRONMENT_ID --region $AWS_DEFAULT_REGION --region $AWS_DEFAULT_REGION | jq -r '.Environments | .[] | .VersionLabel') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment