What is EC2?
Amazon is a web service that enables you to launch and manage server instances in Amazon’s data centers using APIs or available tools and utilities. We can use Amazon EC2 server instances at any time, for as long as you need, and for any legal purposes.
Suppose we need to host a site, the process includes:
1) Procure a Server
2) Engage Service Provider to rent a server
3) Deploy Virtual Machine (which may take a day or a month)
Amazon Instance helps you achieve this task in a span of 2-5 minutes. EC2 provides on demand virtual machines that are available from 600 MB to 244 GB machines. The major part is use of the server anytime as long as it’s legal.
The Features include:
- On Demand – It can be accessed from anywhere
- Elasticity – It would be elastic when accessing Amazon Instances
- Resource pulling – Amazon does multi-tenancy. In simpler terms, they would have a huge data center which they would be virtualizing and offering through various channels.
For instance, if Edureka has an Amazon account, then all Edureka users can use Amazon. Here, Edureka would be a tenant for Amazon and Amazon would be doing the resource pulling to provide optimal resources. Using resource as per requirement and paying only for the service would be the advantage. This is a perfect cloud solution.
Features in EC2
- It is flexible as it comes with multiple flavours and serves a lot of OS. It comes with different Linux layers from Ubuntu and Fedora to name a few
- It is much secure with elements like security groups and private key files
- It’s a controlled environment(once the user gets virtual machine, then it will completely be in the user control)
- It comes with pre-built AMIs which is the major USP of Amazon along with a strong ecosystem
For example, if we need a virtual server, we will need a lamp stack in this case, before selecting the AMI which is pre-configured for lamp stack. Subsequently, we launch a lamp instance as part of it.
Let’s take another example. For a DBA, who wants to install Oracle with Amazon, it will take 4-6 hours in Linux based on knowledge availability. With Amazon, there is an AMI available for Linux Oracle install on top of Linux. We then select the AMI, launch the instance and that server would always have the oracle installed as part of that. This is an inexpensive method.
How EC2 Instance works?
Here AMI is a pre-configured bundle software. In short, an ISO format of Amazon. We select an AMI and launch an instance from the AMI. Once instance is available, we can install any software as part of instance and make our own AMI.
Here are the steps:
Step 1: Launch Virtual Machine from AMI
Step2: Install software of that instance
Step 3: Create a new AMI
In future, when we launch a new instance, we get the instance exactly equal to the previous process.
EC2 Instance Lifcycle:
Stage 1: We select an AMI (with Lampstack).
Stage 2: When we launch the AMI, we need to provide parameter, key pair file and how many instances to be launched
Stage 3: Once the Instance is started, it will be in pending state. It will then copy AMI from S3.
Stage 4: When the Instance is in running stage, it will have both public and private IP.
Stage 5: Termination of Instance, where it will be shut down.
A point to note is that Amazon charges the user right from the pending state of instance to instance termination. There is also a special type of Amazon instance available called EDS. They provide you with an additional stage called stop instance which will decrease cost.
EC2 Instance Types & Size
General Purpose (M1 &M3)- It is the 1st generation. The M1 & M3 have similar kind of instances. The only difference is that M3 will be new and it will provide better I/O. It will also cost less. For application hosting and web server usage, it would be recommended to go for M1 & M3.
Compute Optimized Instances (C1 & CC2)- They provide instances of high compute power. They have a higher ratio of vCPUs to memory than other families and lowest cost per vCPU. If you have higher CPU requirement, go for C1 & CC2. Here caching activity need more memory utilization.
Storage Optimized Instances (HI1 & HS1)- In some case, we need more storage optimized instances, (HI1 & HS1) as it will provide higher throughput, yet be a right fit for NoSQL Database
Memory Optimized Instances (M2 & CR1)- Instances of this family are optimized for memory-intensive applications. They have the lowest cost per GiB of RAM.
Choosing the right instance
Amazon does not provide any bench marking for selection. Reason is that bench marking depends on user application. If application requires more memory it may have different requirements and so on. Also, the Graphic Processing units go for Cluster GPU instances. The different instance types are compared according to the memory (GiB), vCPU and ECU.
Got a question for us? Mention them in the comments section and we will get back to you.