| « PreviousNext » | |
![]() ![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
You can use the AWS Management Console or the AWS Toolkit for Eclipse to set
environment properties that AWS Elastic Beanstalk passes to your server instances.
Environment properties are properties specific to your application environment and are not actual (shell) environment variables. More specifically, PARAM1, PARAM2, etc. are system
properties passed into the JVM at startup using the -D flag, and you can use them to pass database connection strings, security credentials, or other information that you don't
want to hard-code into your application. Storing this information in environment properties can help increase the portability and scalability of your application. You do not need to
recompile your source code when you move between environments. You can acquire them with System.getProperty(name).
The following example sets the JDBC_CONNECTION_STRING and
PARAM1 environment properties in the AWS Toolkit for Eclipse.
After you set these properties, they become available to your AWS Elastic Beanstalk application
as system properties called JDBC_CONNECTION_STRING and
PARAM1, respectively.
The procedure for setting other environment properties is the same. You can
use PARAM1 through PARAM5 for any purpose you choose,
but you cannot rename the properties.
To set environment properties for your AWS Elastic Beanstalk application
In the AWS Toolkit for Eclipse, expand the AWS Elastic Beanstalk node and your application node, and then double-click your AWS Elastic Beanstalk environment in the AWS Explorer.
Click the Configuration tab.
Under Container, navigate to the Environment Properties.
In the JDBC_CONNECTION_STRING text box, type a connection string. For example, the following JDBC connection string would connect to a MySQL database instance on port 3306 of localhost, with a username of "me" and a password of "mypassword":
jdbc:mysql://localhost:3306/mydatabase?user=me&password=mypassword
This will be accessible to your AWS Elastic Beanstalk application via a system
property called JDBC_CONNECTION_STRING.
In the PARAM1 text box, enter a string. For example:
My test parameter.
This will be accessible to your AWS Elastic Beanstalk application via an system
property called PARAM1.

The following example sets the JDBC_CONNECTION_STRING and
PARAM1 environment properties in the AWS Toolkit for Eclipse.
After you set these properties, they become available to your AWS Elastic Beanstalk application
as system properties called JDBC_CONNECTION_STRING and
PARAM1, respectively.
The procedure for setting other environment properties is the same. You can
use PARAM1 through PARAM5 for any purpose you choose,
but you cannot rename the properties.
To set environment properties for your AWS Elastic Beanstalk application
Open the AWS Elastic Beanstalk console at https://console.aws.amazon.com/elasticbeanstalk/.
Select your application from the drop-down list at the top of the AWS Elastic Beanstalk page.
On the AWS Elastic Beanstalk console, in the Environments list for your application, click the Actions arrow, and then click Edit/Load Configuration.

In the Edit Configuration window, click the Container tab.
Scroll down to the Environment Properties section.
In the JDBC_CONNECTION_STRING text box, type a connection string. For example, the following JDBC connection string would connect to a MySQL database instance on port 3306 of localhost, with a username of "me" and a password of "mypassword":
jdbc:mysql://localhost:3306/mydatabase?user=me&password=mypassword
This will be accessible to your AWS Elastic Beanstalk application via a system
property called JDBC_CONNECTION_STRING.
In the PARAM1 text box, enter a string. For example:
My test parameter.
This will be accessible to your AWS Elastic Beanstalk application via an system
property called PARAM1.

Click Apply Changes.
AWS Elastic Beanstalk will update your environment. This might take several minutes.
After you set your environment properties for your AWS Elastic Beanstalk application, you can access the environment properties from your code. For example, the following code snippet shows how to access the AWS Elastic Beanstalk environment properties using JavaScript in a JavaServer Page (JSP):
<p>
The JDBC_CONNECTION_STRING environment property is:
<%= System.getProperty("JDBC_CONNECTION_STRING") %>
</p>
<p>
The PARAM1 environment property is:
<%= System.getProperty("PARAM1") %>
</p>