AWS Certified SysOps Administrator – AssociateDeployment, Provisioning, and AutomationMedium

A large e-commerce company uses AWS Auto Scaling groups for its web application. They need to ensure that when new EC2 instances are launched, they automatically register with a specific Application Load Balancer (ALB) target group, download the latest application code from an S3 bucket, and start the web server. This entire process must be fully automated and resilient to instance failures. Which AWS service can be used to achieve this automated instance initialization and configuration?

  1. AAWS CloudFormation Init
  2. BAWS Systems Manager Run Command
  3. CEC2 User Data
  4. DAWS OpsWorks Stacks
Show answer & explanation

Correct answer: C. EC2 User Data

EC2 User Data is a script that runs when an EC2 instance first launches. It can be used to perform initial setup tasks such as installing software, downloading files, configuring services, and joining load balancer target groups, making it ideal for automating instance initialization.

Why the other options are wrong

  • A. CloudFormation Init is used within CloudFormation templates to configure instances, but User Data is a more direct and common method for initial setup scripts.
  • B. Run Command executes commands on running instances on demand, not during initial launch for configuration.
  • D. OpsWorks Stacks is an application management service, more complex than needed for simple instance initialization tasks, and is being deprecated in favor of other services.

EC2 User Data

A script or set of commands provided to an EC2 instance at launch time, which runs during the initial boot cycle to perform setup tasks.

  • Runs only once, during the first boot.
  • Can install software, configure services, download files.
  • Supports shell scripts and cloud-init directives.

Memory trick: User Data, the instance's first directive.

More Deployment, Provisioning, and Automation questions