Question

Difficulty: MediumAWS Elastic Beanstalk

A developer is preparing a Java application package for deployment to an AWS Elastic Beanstalk environment. The application requires a custom system-level utility, `htop`, to be installed on the underlying Amazon EC2 instances. Additionally, the application requires an environment variable named `DB_HOST` to be accessible at runtime. Which two actions should the developer take to satisfy these requirements?

  1. Create a configuration file ending with `.config` inside a directory named `.ebextensions` at the root of the application source bundle, and use the `packages` section to define the `htop` installation.Answer
  2. Configure the `DB_HOST` environment variable in the Environment Properties section of the Elastic Beanstalk environment configuration.Answer
  3. C
    Create a configuration file ending with `.config` inside a directory named `ebextensions` (without a leading dot) at the root of the application source bundle.
  4. D
    Define the `DB_HOST` environment variable inside a `buildspec.yml` file placed at the root of the application source bundle.
  5. E
    Place the `.ebextensions` directory inside the application's source code subfolder, such as `src/main/resources`, to compile it into the application's JAR/WAR archive.

Answer

Create a configuration file ending with `.config` in a folder named `.ebextensions` at the root of the application source bundle to install the package, and configure the environment variable in the Environment Properties section under the Elastic Beanstalk environment configuration.
The correct solution involves leveraging `.ebextensions` at the root of the source bundle to configure package dependencies and using the Environment Properties configuration setting to handle variable values, satisfying both host-level and application-level requirements.

Step-by-Step Solution

1
Determine how to run custom package installations on the host instance during Elastic Beanstalk deployment.
Identify that the `.ebextensions` directory must be located at the root of the source bundle and contain a `.config` file with a `packages` block.
This directory is read by the Elastic Beanstalk platform agent to apply customizations before the application starts.
2
Determine how to provide configuration settings to the application environment at runtime.
Identify that Elastic Beanstalk supports Environment Properties for injecting variables into the execution context.
Setting these properties ensures they are parsed by the OS and available to the Java application code via system environment checks.

Key Concept

AWS Elastic Beanstalk instance customization via `.ebextensions` configuration files and runtime environment variable configuration.
Rate this question