Skip to Content

Working with User Data: Command to Search and Install System Updates for an EC2 Instance

Learn the correct command to search for and install system updates on an Amazon EC2 instance to keep your AWS infrastructure secure and up-to-date.

Table of Contents

Question

Which command searches for and installs system updates for an EC2 instance?

A. yum update -y
B. chkconfig httpd on
C. service httpd start
D. yum install httpd -y

Answer

A. yum update -y

Explanation

“yum install httpd -y” installs Apache.
“service httpd start” starts Apache.
“chkconfig httpd on” configures Apache to start every time the instance restarts.

The ‘yum update -y’ command is used on Amazon Linux, Red Hat, and CentOS EC2 instances to search for available system updates and install them automatically. Here’s what each part of the command does:

  • ‘yum’ is the package manager used by these Linux distributions
  • ‘update’ tells yum to search for available updates for all installed packages and update them to the latest version
  • ‘-y’ automatically answers “yes” to any prompts during the update process, allowing it to run without user interaction

The other commands listed are used for different purposes:

  • ‘chkconfig httpd on’ enables the Apache web server (httpd) to start automatically on system boot
  • ‘service httpd start’ manually starts the Apache web server
  • ‘yum install httpd -y’ installs the Apache web server package

So in summary, to search for and install system updates on an EC2 instance, ‘yum update -y’ is the correct and complete command to use. Regularly running this keeps your EC2 instance updated and helps maintain the security and stability of your AWS infrastructure.

Working with User Data EDDATAv1EN-US course final assessment question and answer (Q&A) dump with detail explanation and reference available free, helpful to pass the Working with User Data EDDATAv1EN-US course and earn Working with User Data EDDATAv1EN-US qualification.