Question

Difficulty: MediumAWS Elastic Beanstalk

A developer is deploying a Go application to AWS Elastic Beanstalk running on Amazon Linux 2023. The deployment must satisfy two requirements: set custom environment properties that the application reads at runtime, and run a bash script to install a monitoring agent after the application files are extracted but before the application process is started. Which two steps should the developer take to configure the application source bundle? (Select TWO.)

  1. Create a configuration file with a .config extension inside a directory named .ebextensions at the root of the source bundle, defining the properties under the aws:elasticbeanstalk:application:environment namespace.Answer
  2. Place the bash script in the .platform/hooks/predeploy directory at the root of the source bundle and ensure the script has execute permissions.Answer
  3. C
    Place the bash script in the .platform/predeploy directory at the root of the source bundle.
  4. D
    Create a configuration file with a .config extension inside a directory named ebextensions (without a leading dot) at the root of the source bundle.
  5. E
    Define the environment properties in a file named options.txt inside a directory named .platform at the root of the source bundle.

Answer

To deploy the Go application with the given requirements, the developer must create a configuration file inside the .ebextensions directory at the root of the application source bundle to set the environment properties under the application environment namespace, and place the startup script inside the .platform/hooks/predeploy directory at the root of the source bundle.
To configure environment properties via configuration files, the properties must be defined in a .config file inside the .ebextensions directory at the root of the source bundle under the aws:elasticbeanstalk:application:environment namespace. To run scripts during deployment on Amazon Linux 2023, you must use platform hooks placed in the .platform/hooks/predeploy directory to execute after staging but before the application starts.

Step-by-Step Solution

1
Configure environment properties in the source bundle.
Create a directory named .ebextensions at the root of the project, add a file ending in .config, and define option_settings under the aws:elasticbeanstalk:application:environment namespace.
This is the default mechanism for declaring custom application properties/environment variables within the Elastic Beanstalk source bundle.
2
Configure the deployment script execution stage.
Create the path .platform/hooks/predeploy at the root of the project, place the script inside it, and make it executable.
On Amazon Linux 2023 platforms, platform hooks located in .platform/hooks/predeploy automatically execute after staging the application but before launching the web server/process.

Key Concept

Elastic Beanstalk environment configuration via .ebextensions and custom scripts using .platform hooks
Estimated Time:2m 0s
Rate this question