DEV Community

Cover image for Cost Optimizations in AWS - Part 1
Adebisi ayomide
Adebisi ayomide

Posted on • Updated on

Cost Optimizations in AWS - Part 1

Image description

I'm not really a fan of writing, but here i am still doing it.

Here are some tips i believe would be helpful with cost optimization on AWS

This are the steps i take to reduce my costs on aws cloud

1. EC2 Instance Type

When choosing an instance type for a particular workload, here are some questions to ask yourself

Questions to ask yourself ?

What is the use case for this workload ?

This question above helps you understand the need for the particular workload. This leads me to the questions below

What is the capacity Ram ,Cpu or Storage?
How often would the instance be utilized - would be instance be running a machine learning application. and needs more compute , would it just be running a light web application e.t.c ?

These questions helps you select the best instance to select on the basis of memory , cpu or ram usage,

2. Elastic IP's
Elastic IP addresses can actually add cost to your infrastructure when not in use. since IPv4 addresses are limited , it makes sense that AWS charges you for them when not in use and makes it free when in use. also note that attaching 2 EIP addresses to the same instance would still require AWS to charge you.

3. AWS Instance scheduler
https://aws.amazon.com/solutions/implementations/instance-scheduler/

Development services and other non-production services (instance and database) can be turned off when not in use.

This can be automated by using AWS Instance Scheduler which helps you automate the process of keeping your instances down based on your custom schedule (when you believe that no one is currently using the services). This can be done for a company running on a 9-5 basis that has a non-production instance and database running . The company can schedule the services by 5:30 pm daily and bring them back online by 8am the next morning. This would be fully automated by instance scheduler.

Adding EC2 instances and Database instances to instance scheduler can be done by tagging the instances with the created instance scheduler name

4. Autoscaling

if the autoscaling is frequent on your service (i.e you scale like 1 - 5 times in the hour), you might need to change your instance size to a more stable instance. This can help you reduce your costs and reduce the scaling frequency of your application during peak limits. Also if you understand the timing and trend of traffic into your service, you should look at scheduled scaling to help scale the service at periods of high traffic.

5. Spot instances

Spot instances can give a great reduction in cost because . Spot Instances are a cost-effective choice if you can be flexible about when your applications run and if your applications can be interrupted. For example, Spot Instances are well-suited for data analysis, batch jobs, background processing, and optional tasks.

6. Database

Use RDS serverless for non-production database instances with infrequent usage. RDS Serverless reduces the instances running the database when not being used, This dosen't mean that your database would not be running. This means that it would be in a sleep mode when no API calls have been made to the database for a while. when the database is in a sleep mode, the first call is usually a but slow before the database picks up the usual work pace. This is perfect for non-production environments. you only pay for what you use.

RDS Aurora : This is the best

Some AWS tools to give you more insights into your resources and services cost

  1. AWS Trusted Advisor(based on past 30 days) Tells you about the following

Amazon reserved instance optimization
Idle load balancers
Underutilized EBS volumes
Unassociated EIP addresses
Idle RDS db instances
Amazon Route53 latency resource record sets
Underutilised Amazon Redshift Clusters


Top comments (0)