Overview

For many software developers, Amazon Web Services (AWS) and Ubuntu Linux are our world. The Ubuntu instances on AWS have exceptionally performance, have almost unbelievable reliability, and are surprisingly affordable. Establishing a server on an AWS EC2 Ubuntu instance can be a little intimidating at first to setup, configure, backup, and operate. As such, there are numerous Ubuntu Linux tips and short-cuts that one learns on this development journey. Here is my growing list:

Updates to Ubuntu

What if after accessing the AWS EC2 Ubuntu instance using SSH via terminal (mac) or PuTTY (Windows), the login result to the Ubuntu instance shows a message about pending updates? Updating the Ubuntu Linux AWS instance involves a few simple commands:

Fetches the list of available updates:

sudo apt-get update

Installs the updates:

sudo apt-get -y dist-upgrade

Cleans up /var/cache/apt/archives:

sudo apt-get clean

Removes old kernels:

sudo apt autoremove

Reboots the EC2 instance:

sudo /sbin/reboot

Although this is quick, we can do better. If a .bash_aliases file is created, it will be processed by .bashrc file upon reboot. Therefore, this is a good place to combine all of these commands into a single alias. To create the .bash_aliases file, enter the following:

sudo nano ~/.bash_aliases

Add this line, which is which is a concatenation of the previous commands, then save file:

alias update='sudo apt-get update && sudo apt-get -y dist-upgrade && sudo apt-get clean && sudo apt -y autoremove && sudo /sbin/reboot'

Reboot instance:

sudo /sbin/reboot

Now, to update Linux, type:

update

Other Tips

I will continue to add to this collection of AWS EC2 tips as I discover them!