DOP-C02 exam dumps

DOP-C02 practice question 307 of 411

AWS Certified DevOps Engineer - Professional. Professional level, Amazon Web Services. Free question with the correct answer and a full explanation.

DOP-C02 Question 307

Single answer

Your company uses an Auto Scaling group (ASG) to maintain a fleet of EC2 instances for a critical application. You want to ensure that a specific configuration script is executed on each instance whenever it is launched in response to scaling events. The script should also automatically apply software updates and configure the instance with the latest application version. How can you achieve this in the most efficient and automated way?

  1. A

    Use EC2 instance user data to define the configuration script and ensure it executes during instance initialization.

  2. B

    Manually log into each new instance and run the configuration script after it launches.

  3. C

    Create a custom Amazon Machine Image (AMI) that includes the required configuration and use it in the Auto Scaling group launch template.

  4. D

    Use AWS Systems Manager Run Command to execute the configuration script after the instance is launched.

Show answer and explanation

Correct answer: A

Explanation

Using EC2 instance user data is the most efficient and automated way to execute configuration changes during instance initialization in response to Auto Scaling events. It ensures that each instance is configured consistently and automatically without manual intervention or additional management overhead. Other options either require manual action or introduce unnecessary complexity.

  • A. Correct.

    This is the correct option. Using EC2 instance user data ensures that the configuration script is executed automatically during the instance's initialization phase, which is efficient and automated.

  • B. Incorrect.

    This is incorrect. Manually logging into each instance is inefficient, error-prone, and does not align with DevOps principles of automation.

  • C. Incorrect.

    This is partially correct but not the best option. While creating a custom AMI ensures that the instances have pre-configured settings, it requires regular updates to the AMI to include the latest software and configuration changes, which adds management overhead.

  • D. Incorrect.

    This is incorrect. While AWS Systems Manager Run Command can be used to execute scripts, it is not the most efficient way to handle configuration during instance initialization. It also introduces additional steps and latency.

Timed practice exam

Take a DOP-C02 practice test under exam conditions

75 questions in 180 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam