AWS Elastic Beanstalk
Developer Guide (API Version 2010-12-01)

Advanced Environment Customization with Configuration Files (.ebextensions)

You can add AWS Elastic Beanstalk configuration files (.ebextensions) to your web application's source code to configure your environment and customize the AWS resources that it contains. Configuration files are YAML formatted documents with a .config file extension that you place in a folder named .ebextensions and deploy in your application source bundle.

The option_settings section of a configuration file defines values for configuration options. Configuration options let you configure your Elastic Beanstalk environment, the AWS resources in it, and the software that runs your application. Configuration files are only one of several ways to set configuration options.

The resources section lets you further customize the resources in your application's environment, and define additional AWS resources beyond the functionality provided by configuration options. You can use resources to add and configure any resources supported by AWS CloudFormation, which Elastic Beanstalk uses to create environments.

The other sections of a configuration file (packages, sources, files, users, groups, commands, container_commands, and services) let you configure the EC2 instances that are launched in your environment. Whenever a server is launched in your environment, Elastic Beanstalk runs the operations defined in these sections to prepare the operating system and storage system for your application.

One configuration file can contain multiple sections, or you can split your configuration into multiple files. Configuration files are processed in alphabetical order, so you can split your configuration activities into multiple stages.

To use configuration files, add them to a folder named .ebextensions in your source bundle and deploy it to your environment.

If you are deploying a single application, put your .ebextensions folder in the root of your app source:

|-- .ebextensions
|   |-- environmentvariables.config
|   `-- healthcheckurl.config
|-- .elasticbeanstalk
|   `-- config.yml
|-- index.php
`-- styles.css

If you are deploying multiple applications or an ASP.NET Core application, put your .ebextensions folder in the root of the source bundle, side by side with the application bundles and manifest file:

|-- .ebextensions
|   |-- environmentvariables.config
|   `-- healthcheckurl.config
|-- aws-windows-deployment-manifest.json

The process varies slightly depending on the client that you use to manage your environments. See the following sections for details:

When you are developing or testing new configuration files, launch a clean environment running the default application and deploy to that. Poorly formatted configuration files will cause a new environment launch to fail unrecoverably.