Reputation: 14335
Knowing how to set custom environment variables on AWS Elastic Beanstalk, I wonder if there is a default environment property for the name of the environment. If there is, where is this described in the documentation?
For example, suppose my EB environment is named "my_env," is there some kind of default environment property like e.g. "AWS_EB_ENV_NAME" that I can access to obtain this name?
Upvotes: 5
Views: 4381
Reputation: 135
You can either set the environment variable yourself during the instance creation via an ebextension or the Web Console during environment creation. Described here: How do you pass custom environment variable on Amazon Elastic Beanstalk (AWS EBS)?
Or you can use a combination of requests to the Meta-Data server, which sits between your EC2 instance and the netwrok, and the AWS EB API; as described in: https://serverfault.com/questions/630075/is-it-possible-to-get-metadata-about-the-elastic-beanstalk-environment-from-the
Upvotes: 3