Created
May 16, 2018 19:04
-
-
Save cdechery/992ad242e2a7491e27100fb4baa1bd59 to your computer and use it in GitHub Desktop.
Retreive Beanstalk Application name from within 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
packages: | |
yum: | |
jq: [] | |
container_commands: | |
01-getenv-info: | |
command: | | |
ENV_ID=`{"Ref": "AWSEBEnvironmentId" }` | |
ENV_NAME=`{"Ref": "AWSEBEnvironmentName" }` | |
echo "env.id="$ENV_ID > /tmp/awseb.properties | |
echo "env.name="$ENV_NAME >> /tmp/awseb.properties | |
EC2_REGION=`curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone | sed 's/[a-z]$//'` | |
APP_NAME=`aws elasticbeanstalk describe-environments --environment-ids $ENV_ID --region=$EC2_REGION | jq -r '.Environments[0].ApplicationName'` | |
echo "app.name="$APP_NAME >> /tmp/awseb.properties | |
chmod 644 /tmp/awseb.properties |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I had the same problem and adding
AWSElasticBeanstalkReadOnlyAccess
permission to the user fixed the problem. Something more restrictive would probably be better