Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
5 Important Points To Remember If You Want To Reduce AWS EC2 Cost
1. 5 Important Points To Remember If You
Want To Reduce AWS EC2 Cost
- Ishant Kumar
2. In this article of devOpsJourney , you will see 5 Important points that
can reduce AWS EC2 Cost.
1) Know resource usage of EC2 and scale down/scale up or select
suitable instance type.
There can be many use cases for this scenario :
3. i. If you are using EC2 instance(s) having resource capacity over demand, then
you can rethink over this and scale down the instance type.
For Example :
You are using EC2 instance (m4.xlarge) having 16 GiB of Memory but
application is using only maximum 6 GiB of Memory. In this scenario use
m4.large instance having 8GiB of Memory . Additionally you can setup
Autoscaling for provisioning new instance if you are not sure for traffic
spikes.
ii. If your application is CPU intensive and you are using m4.xlarge having 4
vCPU then you can use c4.xlarge having same compute power ( 4vCPU ) with
lower cost.
4. iii. Set Autoscaling if you are not sure about traffic spikes in a month
of hours or hours of the day instead of provisioning the whole
capacity at once.
For Example : In last four-five days of months your application
expects traffic which is three-four times of traffic in normal days
then you can always set Autoscaling for this scenario. So instead of
provisioning 4 xlarge capacity of instance for a complete month,
provision one or two instances and when application will expect
high traffic, autoscaling will launch instances as per demand.
5. 2) Update default cool-down period in autoscaling for termination of
instance.
If you have setup autoscaling and traffic spikes are irregular , then
setting long cool-down period can help you in reducing costs at
some level.
For Example: Policy is – launch one instance when average CPU
utilization is greater than 80% , and termination policy is terminate
one instance when average CPU Utilization is less than 30% , then
setting cooldown period of instance upto 50 minutes can help as
instance has been already charged for one hour its better to keep it
for close to one hour.
6. 3) Use reserved instance if you are going to use EC2 for long time.
If you have long vision to use EC2 instance then after analyzing
capacity and resource consumption of application you can reserve
the EC2 instance. By purchasing Reserved instance you can save a
huge cost compare to on demand.
For more information : http://aws.amazon.com/ec2/purchasing-
options/reserved-instances/
7. 4) Stop/Start EC2 instances in Dev Environment if you are a
developer/tester and not working 24×7.
Lets say If you are a developer/tester or team of developers/testers
and not using EC2 instance round the clock then better to stop the
instance when you are not using it. It may be possible that you
want some programs should be auto start when you start the
system. so for such scenarios you can write some custom scripts
which can start and configure applications at system startup.
8. 5) Use AWS Provided services for your use case / requirements.
Use S3 for object based storage and high reliability. If you are unsure about
data limit then its better to choose S3 for storage rather than EC2. S3 is also
cheaper and reliable than having storage on running EC2.
There is no additional charge for code deployments to Amazon EC2
instances through AWS CodeDeploy. You will be charged for EC2 only and not
for AWS CodeDeploy. So its better to use CodeDeploy instead of having some
deployment service hosted on EC2.
Source : http://aws.amazon.com/codedeploy/pricing/
9. There is no additional charge for Amazon EC2 instances supported by
AWS OpsWorks. You pay for AWS resources (e.g. EC2 instances, EBS
volumes, Elastic IP addresses) created using OpsWorks in the same
manner as if you created them manually.
Source : http://aws.amazon.com/opsworks/pricing/
Similarly there are other services for which there is no additional
charges or minimal charges. You can leverage those services and save
the cost for hosting similar services on some EC2 instances.
10. Thanks
Looking Forward for your interest in DevOpsJourney.com
http://devopsjourney.com
Email us: mail@devopsjourney.com