AWS EC2

Share

Amazon EC2 stands for Elastic Cloud Computing. It is a web service that provides application hosting on virtual machines called instances using simple interfaces. Main benefits are reduced cost of virtual machines compared to physical ones, fast and simple maintenance and no downtime.

Amazon EC2 provides elastic web-scale computing which enables you to increase or decrease capacity within minutes.
You have complete control over your instances as you would have over physical ones. It is a flexible cloud hosting service that gives you choice of instance types, operating systems and software packages.
Amazon EC2 is highly secure and works in conjunction with Amazon VPC (Virtual Private Cloud) to provide security and robust networking functionality.
It is very simple to start with and there is an option to try Amazon EC2 for free.

You can choose between several options:
• AWS Management Console – intuitive web based management interface (the one Iprefer)
• AWS Command Line Tools (CLI)
• AWS SDK’s

I will introduce you to some of the main EC2 services and their usability through a simple example of application deployment process.
Amazon EC2 is hosted world-wide. Multiple hosting locations are divided into Regions – geographic areas. Each Region is divided into multiple locations named Availability Zones. Choosing a Region and an Availability Zone, where you’re instances and data will be stored, will largely depend on your business location and legal requirements. There is no need to stick to one region, as you can pick multiple ones in order to ensure the same connection speed for all locations.
Depending on application requirements and size, Amazon EC2 provides you with the possibility to choose an instance type. There is a wide selection of instance types and they’re optimized to fit different user cases, with varying combinations of CPU, memory, storage and networking capacity.
Instances are divided into type groups.
• T2 type instances are Burstable Performance Instances, they provide baseline level of CPU performance with the ability to burst above the baseline.
• M5 type instances are latest generation of General Purpose Instances, they provide balance of compute, memory and network resources. They are good choice for many applications.
• M4 type instances provides same things as M5 but they are older generation.

Here is a list of available T2 instance types as an example.

When you decide which instance type to use, you’ll have to create an AMI (Amazon Machine Image), which consists of a root volume template that houses the operating system and the applications. After that, you’ll have to launch permissions for specified AWS accounts and block device mapping that specifies the volumes to attach to launched instance. There are options to use Amazon AMIs with either Linux or Windows, or even creating a custom one. You can choose different AMIs for different instances.

EC2 is connected to other Amazon services such as S3, which is an unlimited size cloud storage service, or RDS (Relation Database Service) – so all of your data can be placed in the cloud.

What I found as the most beneficial, from a developers point of view, is the Auto Scaling group service. Auto Scaling group is a collection of similar EC2 instances and is used for automatic application scaling on multiple resources across multiple services in a short time.

Once you got your application build ready, you create a Deployment group, connect it with your configured Auto Scaling group and choose a S3 location where build files will be stored when uploaded from local. Deployment group will pick files from the S3 location, and Auto Scaling group will copy those files to instances.

In case a build is corrupted and application deployment fails, Auto Scaling will deploy the last successful build.

Using scaling policies you can set up the desired number of instances, depending on traffic.

If demand is high Auto Scaling will launch new instances and if demand is low it will terminate them.
This ensures application efficiency and lower costs as you pay only for resources that you actually use. Health checks ensure that all instances are running smooth. They can be configured how often to do the checks and how many times to check before deciding if an instance is healthy or not. In case a health check on an instance fails the instance will be terminated and a new one will be launched. There is no application downtime.

There is possibility to set alarms that will fire on critical events, so you can be notified.

Cloud watch provides graphic view of instance events, traffic, CPU usage and so on.

This was a short overview of some of the AWS EC2 services that I use on a daily basis. I found them very useful. However there is a wider list of available services, so if anyone is interested in finding out more, please check AWS documentation.

Share

Sign in to get new blogs and news first:

Leave a Reply

Ana Danilović

C# developer @ Intens
mm

Ana Danilovic is C# web developer with over 8 years of professional experience. She holds bachelor degree in a field of Computer Sciences. Although she is mainly back end oriented developer, her main focus at this moment is moved to front end as she learns ReactJS.

Sign in to get new blogs and news first.

Categories