0

I am new to Amazon Web Services. I have used Elastic BeanStalk to host our web application. In web application, I have used the environment variable assigned with some location to push the files into that.

I have set the VENDOR_HOME as,

       D:\Applications\spring-boot\Resume_folder

and accessing through java using System.getenv in as

       String path = System.getenv("VENDOR_HOME");

It is working fine in the local tomcat server, I want the same functionality should achieve in AWS too? any help will be appreciated.

Mounika Gaja
  • 31
  • 1
  • 6

2 Answers2

0

Tomcat typically has a setenv.sh file where admins can set environment variables. In the setenv.sh file you can put a line for your VENDOR_HOME variable as such:

export VENDOR_HOME=/Applications/spring-boot/Resume_folder

For AWS BeanStalk specifically you can look at this answer for details on how to set the env variables.

In general you can set Linux environmental variables using the export command from within the script you are using to execute your application. The final answer will depend on how you are executing your application.

I typically use Spring Boot Maven Plugin that creates executable JAR files. The executable JAR file allows for a config file with the same name as the JAR file (.config instead of .jar) where admins can export environmental variables from.

Jose Martinez
  • 11,452
  • 7
  • 53
  • 68
  • Hi jsoe, Thank you for your answer. I have created a folder in S3. how can I get the path to use in an environment properties? – Mounika Gaja Feb 12 '18 at 09:12
0

In your BeanStalk application, go to the Configuration page. Locate Software Configuration. Click on edit. You have the option to add Environment Properties at the bottom of this page.

curlyBraces
  • 1,095
  • 8
  • 12