EC2 stands for “Elastic Compute Cloud.”
And? That doesn’t really help us…
Let’s just say that it’s just a way of launching servers. It’s called “elastic” because you can add and remove them as your requirements change. If you have a high volume of traffic, you can go from having one server to two, for example, to improve network traffic management.
EC2 is without a doubt AWS’s top service. Years after its initial launch, it’s still their biggest service, even though many other services have since been added.
Why is it still the biggest service?
Well, because it’s the most basic! Everyone needs a server, whether they’re hosting websites, doing calculations to solve problems, providing mobile app functionality, etc.
Many other services that were created since EC2 was launched have actually been built “on top of” it. For example, RDS is simply an EC2 server that has been preconfigured to hold a database.
Basically, EC2 is huge and indispensable. So, it’s completely logical to start off by looking at EC2 on this course.
Get to Grips With the EC2 Dashboard
Navigate to EC2. To do this, you can use the search bar at the top so that you don’t get overwhelmed with the sheer number of services. Search for EC2 and click on the first link in the “Services” category:
Once you get to EC2, take a deep breath so that you don’t faint, because EC2 itself has a whole raft of services on offer:
On this page, you need to look at:
the list of resources running in EC2. For example, “Running Instances” shows you the number of servers currently running. To start with, you’ll have none, except if you still have your Elastic Beanstalk instance running (in which case, go back to Elastic Beanstalk and delete it so that you get back to having no running instances).
the “Launch Instance” button, if you want to launch a new server.
The left-hand menu looks a bit scary because it shows all of the subservices included in EC2. We’re only going to look at a fraction of these services, so there’s no need to understand all of them (thankfully!).
Explore EC2 Services
Okay, let’s talk about the services within EC2. And yes, AWS is a bit like a Russian doll. When you go into one service, it has a number of subservices and each one of these can contain more subservices and so on. You get the idea!
I said that you don’t need to understand everything within EC2. I don’t know all the features and even as I write, there are new ones being added. This is the power of AWS, it’s constantly evolving. And the drawback of AWS is also that it’s constantly evolving! You have to try and keep up!
Take a look at the left-hand menu and browse through the services. Here are the ones I’d advise you to remember.
Instances
The Instances page displays the list of servers that you’re running. If there’s one screen you really need to understand, it’s this one.
Images
The AMI (Amazon Machine Image) link displays images of your EC2 instances.
We often use an AMI when we’re starting out to launch a preconfigured EC2 server. We can either use an Amazon-provided AMI or a community one from the marketplace (where you’ll find free and paid-for AMIs).
You can also create your own AMIs from your servers. What’s the point? Well, it means you can take a snapshot (backup) of your server. You then have a backup that you can use to launch a new server with exactly the same image. We’ll come back to this!
Elastic Block Store
The Volumes section displays all of the disks being used by your servers. Within AWS, we distinguish between instances (essentially the processing power) and disks (Elastic Block Store (EBS). EBS volumes are basically like hard disks.
So, snapshots are backups of your servers’ EBS disks.
Network and Security
Security groups are the security rules that you want to apply to ingoing and outgoing traffic on your servers. This is how you would set up a firewall to protect your servers.
Elastic IP addresses allow you to assign a static public IP address to your servers. This is useful because, by default, when a server is restarted, it will usually change its public IP address. With Elastic IPs, you can set it up so that your server retains the same IP address (which is crucial if you want to host a website properly!).
Key pairs displays the key pairs you created to give you access to the servers via the command line. If you’re already connected to a server using a public/private key, you’ll know what I’m talking about. If not, I would highly recommend that you read this article. Otherwise, you’ll think I’m talking gibberish.
Load Balancing
If you have lots of traffic, load balancing (Elastic Load Balancing) means you can send the traffic to a number of servers, automatically selecting the server that has the most capacity.
Auto Scaling
If you have fluctuating levels of traffic, Auto Scaling allows you to add or remove servers based on traffic levels.
Let’s imagine that, under normal circumstances, you only need three servers. Auto Scaling will run three servers. Then, if your brand is featured on TV and everyone wants to go to your website at the same time, Auto Scaling will become active and will launch more servers (up to a limit that you can define). So, your site could go from three servers to ten servers to manage the traffic if needed, in just a few minutes.
Auto Scaling works hand in hand with load balancing when you have to deal with a lot of traffic.
You should now have an initial idea of the services available in EC2!
Let’s Recap!
An AMI is a preconfigured backup of a machine. All EC2 instances are launched from an AMI.
An EBS volume is a hard disk that you can attach to an instance to store data securely.
All EC2 instances are attached to one or more security groups to govern inbound and outbound flows.
You can use a load balancer combined with Auto Scaling to handle traffic spikes and reduce costs at quiet times.
Next, we’re going to have a look at some different types of EC2 instances. There are actually many different types of servers, some more powerful than others, and some more expensive than others.