Labels

Wednesday, 28 June 2017

Tips to optimize Amazon EC2 Cost

In Amazon Web Service Elastic Cloud Computing (EC2) is the centerpiece of AWS. EC2 is widely used by many cloud-based customers as infrastructure as a service. Elastic Cloud Computing provides a variety of cloud computing services which is the most powerful tool in Amazon Web Services. But on the other hand, it is very difficult for the beginners to use the system and understand the service provided by the Elastic Cloud Computing which will ultimately lead to more expenditure on the infrastructure of the service. In this article, I will be giving you tips on how to optimize Amazon Web Service EC2 Cost. So this article generally will be for the targeted customers whose bill is exceeding monthly from $10000 to $200000. But you can still read the whole article to understand the Amazon EC2 pricing method.

By learning the complexity of this article it is better that you don’t waste your time and money if your monthly bill is less than $10000. But for people whose bill is exceeding $200000 then it is suggested that you hire a DevOps engineer to handle your Amazon EC2 instances and cost.

1. Figure if Amazon EC2 is the right choice for you:-

Amazon EC2 is not at all a cheapest mean of cloud computing because compare to the other virtual private server Amazon is much more expensive. You have to pay 9 cents for per GB transfer which will be $90/TB where on the other hand many Virtual Private Servers are cheaper than Amazon Web Services by subscribing to the monthly plans for $5 to $10 per month. But still, Amazon being expensive you will be getting added advantage of a flexibility and scalable infrastructure that can adapt to your changes. It has the ability to deploy instances and can make changes to the architecture programmatically.

2. Understand the instances on Amazon EC2:-

There are three parts where a letter is illustrating the instance class (R,M,C,T,G,D,I,P,X) and a number depicting the generation (1,2,3,4,5) and a string is illustrating the size, instance class and generation (small, medium, large, x large, 2xlarge, 4xlarge, 8xlarge, 10xlarge, 16xlarge, 32xlarge). For example, instance “r3.4xlarge” is instance type R of generation 3 and size 4xlarge.

3. Understand the requirement of the application:-

You will need the necessary application to run and measure Amazon Elastic Cloud Computing.

4. AWS region may affect the pricing:-

AWS regions are the data centers nearby Amazon Web Services. In the United States, there are a lot of regions so the costing will differ, unlike countries which have few AWS centers located. The round trip in AWS region is approximately 2 milliseconds.

5. Elastic Block Storage affects cost:-

The cost of the Elastic Block Storage instance may depend on the size when creating the volume. It is also charged for the I/O. In EBS, I/O is charged only when it occurs. Elastic Blockage Storage can affect your cost consequential.

6. Elastic Block Storage Snapshots:-

EBS Snapshots is storage of the snapshots of the current content of Elastic Block storage to S3. EBS snapshots are available throughout the AWS region. But while transferring the data for cross-region data transfer charges will apply.

7. Demand Instances:-

Demand instance is a very expensive instance but is very easy to get started with. It can be stopped or you can start at any time and you will be not charged when it is stopped.

8. Spot Instances:-

Spot instances are relatively is less expensive but the major drawback is that you can’t stop it, you have to terminate it.

9. Purchasing options:-

You can find a lot of options before selecting the purchase options. You can make a reservation for 1 to 3 years with three types of payment which is no upfront, partial upfront and all upfront. You can choose which type of instance you want and the size within the instance class and generation.

10. Work on the instances via independent architecture:-

While writing use tools like Ansible or Chef which will allow you with a single command to deploy new instances for your applications. Your script should be flexible so it can be deployed in both on-demand and spot instances. You can use Elastic Load balancer if you are handling variable loads from real-time web traffic. Auto-scaling can help you to scale up instance capacity in real time. For a long time data use S3 instead of Elastic Cloud computing instances. The script that you upload should handle the updates smoothly. When there is a large number of an error, unusual traffic patterns or few healthy hosts then it is recommended to set alarms for the load balancers. Also, use Route 53 for health checks and failovers for cross-region repetition in live serving.

11. Billing Cycle:-

You will be billed by an hour from the time you have started using it. So for an example if you use only for 15 minutes then you will be charged for an hour but if you used it for 1 hr and 10 minutes only then still you will be charged for 2 hrs. If they are two instances when they will be calculated separately and if the instance is stopped and you have restarted the instance 4 times then you will be charged for the 4 hrs. But if the Amazon has terminated the instance then you will be not charged for that particular hour.

Measure your Amazon EC2 cost in the Amazon EC2 console under Reports section. When you will keep a thorough check of your cost then you will have an idea on how to optimize your Elastic Cloud Computing Cost. In Amazon Web Service account you can access the billing data which will give you the full breakdown of the cost. Amazon cloud watch you can set a billing alert where the data will come as a data points. While purchasing, it is better that you carefully decide while selecting the plan depending on the size of your traffic, availability zone, instance class, instance type and purchase option. If your data storage is a long time commitment then do a reservation on all your instances or choose spot instances.