Since this year I’m working as an AWS Cloud Consultant where I see a lot of small to medium sized AWS deployments. Most of them are typical web applications. I want to share with you the 5 most common mistakes that you better avoid:

managing infrastructure manually

not using Auto Scaling Groups

not analyzing metrics in CloudWatch

ignoring Trusted Advisor

underutilizing virtual machines

If you are interested in how to avoid the mistakes in a typical web application read on.

This post received over 500 points and over 250 comments on Hacker News.

Typical web application

A typical web application consists of at least:

load balancer

scalable web backend

database

and looks like the following figure.

This pattern is very common and if yours look different you should have (strong) reasons.

Mistake 1: managing infrastructure manually

If your AWS setup was created by clicking around in the web based management console you are managing infrastructure manually. The biggest problem with this approach: it is not reproducible, it is not documented and you can make a lot of mistakes. Luckily AWS CloudFormation solves your problem free of charge. Instead of creating all the resources (like EC2 instances, Security Groups, Subnets, …) manually you describe them in a template. CloudFormation will figure out how to turn this template into a running stack. CloudFormation creates all the resources for you in proper order as shown in the following figure.

You can even update templates to apply changes to a running stack. A typical web application can be described in a CloudFormation template easily as shown here.

Our blog contains many CloudFormation examples and I also wrote a book about AWS and CloudFormation. There is no reason why you should manage your infrastructure manually. It’s unprofessional! It’s a mess!

Mistake 2: not using Auto Scaling Groups

The biggest problem with Auto Scaling Groups is that people assume that they are about auto scaling which they are not! Every EC2 instance should be launched inside an Auto Scaling Group. Even if it’s a single EC2 instance. The Auto Scaling Group takes care of monitoring the EC2 instance, it acts as a logical group of virtual machines, and it’s free.

In the typical web application the web servers will run on virtual machines in an Auto Scaling Group. You can of course use Auto Scaling Groups to scale the number of virtual machines based on the current workload but as precondition you need Auto Scaling Groups. Auto scaling is achieved by setting alarms on metrics like CPU usage (of the logical group) or number of requests the load balancer received. If the alarm threshold is reached you can define an action like increase the number of machines in the Auto Scaling Group.