AWS DevOps & Developer Productivity Blog
AWS OpsWorks supports application environment variables
<?php
$d = array(‘environment’ => getenv(“database_endpoint”));
echo $d
?>
|
3. Once you have a stack, PHP layer and instance created, start the instance and navigate to Apps to add an app. Point to the repository where your app’s code is stored. Scroll down to the app’s Environment Variables section, then enter the environment variables as keys and values making sure to include an environment variable database_endpoint with a value of your choosing.


{“environment”:”mydbinstance.us-east-1.rds.amazonaws.com”}
|
“deploy”: {
“myapp”: {
“application”: “myapp”,
“application_type”: “php”,
“environment”: {
“database_endpoint”: “mydbinstance.us-east-1.rds.amazonaws.com”,
…
|
For more information including examples for other application servers, see the documentation.