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 similar to the login below?
Updating the Ubuntu Linux AWS instance involves a few simple commands:
Fetches the list of available updates:
Installs the updates:
Cleans up /var/cache/apt/archives:
Removes old kernels:
Reboots the EC2 instance:
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:
Add this line, which is which is a concatenation of the previous commands, then save file:
Now, to update Linux, type:
Getting Information on Disk Storage and CPU Utilization
It is important to understand how much disk storage and memory is being use and how much CPU is being utilized. Here are two commands and their typical responses on an AWS EC2 ‘t2.micro‘ instance.
Provide a list of storage devices with usage information:
Provide memory usage and CPU utilization information (use ctrl-c to exit top):
I will continue to add to this collection of AWS EC2 tips as I discover them!