Amazon EC2 – How to Disable Yum Automatic Nightly Check-Update

amazon ec2amazon-web-servicesautomatic-updatesyum

A server running on my EC2 instance (Amazon Linux AMI) falls over every night. I watched processes and this happens, every time, minutes after this command runs:

/usr/bin/python2.7 /usr/bin/yum --debuglevel 2 --security check-update

Q: Where is this configured to run? I want to disable this, and do updates manually.

Extra Q: What does check-update do in fact? It seems it only compiles a list of updates but not actually updating? What's the point of that?

Best Answer

The purpose is to generate the message that's displayed every time you SSH to the host, something like:

~ $ ssh ec2-user@xx.xx.xx.xx


       __|  __|_  )
       _|  (     /   Amazon Linux AMI
      ___|\___|___|

https://aws.amazon.com/amazon-linux-ami/2018.03-release-notes/
10 package(s) needed for security, out of 21 available          <<<=== This
Run "sudo yum update" to apply all updates.                     <<<=== and this
[ec2-user@ip-172-31-11-77 ~]$

It is run as part of the /etc/cron.d/update-motd cron job.

The command you want to disable is run from /etc/update-motd.d/70-available-updates - if you want to disable it edit this file and comment it out.

Do not simply remove the file because on the next patching it may be brought back.

Hope that helps :)