AWS DevOps Engineer Professional Practice Test

Disable ads (and more) with a membership for a one time $2.99 payment

Prepare for the AWS DevOps Engineer Professional Test. Enhance your skills with flashcards and multiple-choice questions, each offering hints and explanations. Become exam-ready!

Practice this question and more.


What setting ensures a database script runs only once during an application deployment in Elastic Beanstalk?

  1. container_commands.single_execute

  2. container_commands.run_once

  3. container_commands.leader_only

  4. container_commands.once_per_deployment

The correct answer is: container_commands.leader_only

The appropriate setting to ensure that a database script runs only once during an application deployment in Elastic Beanstalk is "container_commands.leader_only." This setting is designed to execute a command only on a single instance within an environment that is running multiple EC2 instances. In a typical situation, when a deployment involves multiple instances, it is often necessary to run certain commands only once to avoid conflicts or redundant operations, especially when dealing with database migrations or initialization scripts. Using "leader_only" ensures that only the instance that has been designated as the leader (often the first instance launched or a designated application server instance) will execute the specified command. This is particularly useful in a load-balanced environment where multiple instances might be initialized at once but you want to perform a task only once across the entire application. The other options are not designed explicitly for this purpose, as they may refer to different execution patterns that do not guarantee a single run across an entire deployment process. Thus, "container_commands.leader_only" is the correct choice for ensuring a database script runs only once during application deployment in Elastic Beanstalk.