- Newest
- Most votes
- Most comments
Hello, hope you are doing good. In case of using ElasticBeanstalk Docker platform it is suggested to pass your environment variables for containers either via .env file or if you are using docker-compose.yml file then you can define the environment variables in the docker-compose file. If you are using the Docker Compose tool on the Amazon Linux 2 Docker platform, Elastic Beanstalk generates a Docker Compose environment file called .env in the root directory of your application project. This file stores the environment variables you configured for Elastic Beanstalk.If you include a .env file in your application bundle, Elastic Beanstalk will not generate an .env file. For more information, check out this documentation : https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker.container.console.html#docker-env-cfg.env-variables
Now you can consider using either of these two scenarios(defining env variables in docker-compose or using the .env file in your source bundle) to get the environment variables and retrieve environment variables from the .env file. One way to get environment variables defined in .env file is mentioned here : https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker.container.console.html#docker-env-cfg.env-variables
Relevant content
asked 4 years ago

is it possible to directly provide .env file directly when deploying java file to ec2 instance? I'm running a jar file and have prod env and dev env files , how can i provide those env while deploying or changing?