AWS Elastic Beanstalk - Config Files for Shell Commands in .ebextensions Folder

Which Sections to Use for Running Commands Appropriately?

Prev Question Next Question

Question

You are from an AWS consulting company, and you are helping a customer build up applications using AWS Elastic Beanstalk service.

One important application is going to be installed on the Amazon Linux platform.

Because several Shell commands are required to be executed before and after the application version file is extracted, you have created some config files in the .ebextensions folder.

In the config files, which sections should you put the commands in so that they can run appropriately? (Select TWO.)

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D. E.

Correct Answer - A, E.

Config files in the .ebextensions folder can customize the Elastic Beanstalk application.

For Linux machines, the below sections can be added according to.

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#linux-container-commands:

Packages.

Groups.

Users.

Sources.

Files.

Commands.

Services.

Container Commands.

Option A is CORRECT: Because the commands specified in the commands section are executed before the application is set up and the application version file is extracted.

So this section is required.

Option B is incorrect: Because the files section is used to create new files.

This is not required in the question.

Option C is incorrect: Because the question does not mention that certain services in the Elastic Beanstalk application need to be started or stopped.

Option D is incorrect: Because there is no deploy key in .ebextensions.

Option E is CORRECT: Because the key of the container commands section helps run commands after the application version archive has been extracted.

Together with.

Option A, they can meet the requirements of the question.

In AWS Elastic Beanstalk, the .ebextensions folder is used to provide customized configurations to instances that are launched for your application. The configuration files in .ebextensions are written in YAML or JSON format, and they can be used to configure various aspects of your application, including commands to be executed before and after application deployment.

To run shell commands before and after application deployment, you should place the commands in the "container_commands" section and the "commands" section of the configuration file.

The "container_commands" section is used to run commands that should be executed within the application's container. These commands run after the container is built and before the application is deployed. This section is particularly useful for commands that need to be executed within the application's environment, such as initializing a database or setting environment variables.

The "commands" section is used to run commands on the instance before the application is deployed. This section is particularly useful for configuring the instance itself, such as installing packages or modifying system settings.

The other sections listed, such as "files", "services", and "deploy", are used for other types of configuration and are not appropriate for running shell commands.

In summary, to run shell commands before and after application deployment on the Amazon Linux platform using AWS Elastic Beanstalk, you should place the commands in the "container_commands" section and the "commands" section of the configuration file.