The Linux Cloud on AWS: Use Linux Skills to Power Cloud Deployments

Why the Linux Cloud is a really big deal and what you have to know to start taking full advantage of it.

The fact is, since they probably constitute only around 2% of the total consumer PC market, you may not see all that many desktop and laptop machines running Linux. But the connected infrastructure holding the Internet together is a different matter altogether.

If you’re running a server, mainframe, supercomputer, embedded system, gaming console, a network router, and (through Android) smartphones, then the odds are overwhelming that you’re working with Linux. And Cloud Computing? Let’s just call it the Linux Cloud.

As of last year, Google was said to regularly launch over two billion virtual Linux containers per week. Even Microsoft’s Azure will now host Linux instances. But the undisputed market leader in the Cloud Computing market is AWS and, at least as of late last year, 74% of all AWS instances were reportedly powered by Linux.

“Linux cloud” machines are generally cheaper to run, quicker to scale and, for all intents and purposes, better documented than the competition. All this means that Linux cloud deployments are only going to become more common. If you’re out to get things done in the cloud, this is one train you really don’t want to miss.

Cloud Academy has now published the first five courses in our LPIC Server Professional Linux certification series. These five courses cover all the material needed to take and pass the LPIC-1 101 exam. (The remaining courses aimed at the second exam, should appear over the next weeks.) If you want to really understand how Linux systems – the backbone of the Internet – work, consider taking these courses.

But in the meantime, here are some basic, must-have concepts and skills that will at least get you started with Linux instances on AWS.

Optimized “Linux Cloud” distributions

The AWS Marketplace (when accessed through the EC2 Launch Instance process), offers all kinds of pre-built Linux images, mostly available for free. While there are many very specialized images (like the OpenVPN image, for example), the two most popular general choices are probably Amazon Linux and Ubuntu Server. Both of these images are specially optimized Linux cloud distributions and were built with AWS very much in mind.

Whether either one of these has a clear performance advantage over the other will probably depend on your specific needs. Amazon Linux – which is based on the CentOS distribution – is obviously deeply integrated with the larger AWS infrastructure and comes with Amazon Tools installed by default. On the other hand, Ubuntu, since it uses the Debian repositories, will have native access to a staggering range of installable software.

One consideration is Amazon Linux’s approach to updates. Since the 2011.09 release, Amazon Linux images are all automatically updated to the most current version available. Most of the time, this works well. However, there may be scenarios where an unexpected update could break an important configuration. If you’re concerned about this, pass this user data to your instance upon launch:

repo_releasever: 2014.03

Administrative Permissions

Since just about everything that happens on a Linux system starts with a plain text file of some sort or another, controlling the permissions for sensitive system files and directories is critically important. For our purposes, read, write, and/or execution access to each file and directory is defined for its owner, group, and/or others. If you need to edit or create files for which you don’t normally have rights, most Linux distributions allow you to temporarily assume admin powers by prefacing your command with sudo (and, when prompted, providing your password), like this:

# Install the Apache web server from a repository:
$ sudo yum install httpd

But that assumes that your user account is allowed to invoke sudo. For that to be true, your user would have to be part of an admin group. Many Linux distributions (Red Hat, Fedora, etc.) assign root privileges to all members of the wheel group. Practically, this is done by adding the wheel group (and therefore, its members) to the sudoers file (/etc/sudoers). Debian and Ubuntu do effectively the same thing, but they call the group “sudo” instead of wheel.

By default, the wheel group on an Amazon Linux machine is not included in the sudoers file, although accessing the instance through SSH using a valid AWS keypair will give you full administration rights, and full access to specific services using the SDK or other tools can be opened up through IAM policies. Should your specific needs require enabling root access for the wheel (or sudo) group, AWS documents the process.

System monitoring

AWS offers its own integrated monitoring tools, most notably, CloudWatch. But you might sometimes need to dig a bit deeper into a particular instance. Running

$ top

…from the command line will display the top resource-consuming processes and associated data in real time. The output will look like this:
Linux cloud command line showing top resource-consuming processes
You may also want to view the system logs that live in the /var/log directory tree:

$ cd /var/log
$ ls
apt       cloud-init-output.log  dmesg.0    lastlog              upstart
auth.log  cloud-init.log         fsck       syslog               wtmp
boot.log  dist-upgrade           kern.log   udev
btmp      dmesg                  landscape  unattended-upgrades

Other Linux cloud skills

If you want to enjoy a relatively smooth flight through the Linux cloud, you’ll definitely want at least a basic grasp of Linux scripting and database management. Working with script-based AWS services like CloudFormation or the EC2 Container Service will go much better if you’re already familiar with the way scripts work natively within Linux itself. And even something as simple as passing commands to an AWS instance at launch time through shell scripts or cloud-init directives will require some scripting experience.

Similarly, connecting to an AWS RDS (Relational Database Service) instance will be a whole lot easier if you’ve done it already within a local installation of Linux.

The bottom line is that in most cases at least, serious Cloud Computing will require some serious use of the Linux Cloud. If you’re not yet completely comfortable with the core Linux skills, consider taking Cloud Academy’s LPIC Linux Server Professional certification courses.

Cloud Academy