Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

AWS Cost Optimization

Stijn Van Renterghem


AWS Solution Architect Lead © 2020 DXC Technology Company. All rights reserved.
Cost Optimization
Best practices

© 2020 DXC Technology Company. All rights reserved. February 4, 2021 2


Cost Optimization best practices
VPC

• Create VPC endpoints for S3 and DynamoDB


• Check costs for NAT gateways and change architecture if necessary
• Check costs for traffic between AZs and reduce traffic when possible

© 2020 DXC Technology Company. All rights reserved. February 4, 2021 3


Cost Optimization best practices
EC2 (Compute)

• Purchase Savings Plans for baseline capacity (EC2, Fargate)


• Identify and terminate unused instances
• Use Spot Instances for stateless and non-production workloads
• “Switch to latest instance types”
• Switch to Amazon Linux or any other Operating System that is Open Source
• Make use of AMD or ARM based instances

© 2020 DXC Technology Company. All rights reserved. February 4, 2021 4


Cost Optimization best practices
EC2 - Savings Plans

Savings Plans are a flexible pricing model that offer low prices on EC2 and Fargate usage, in exchange for a
commitment to a consistent amount of usage (measured in $/hour) for a 1 or 3 year term. Savings Plans provide you
the flexibility to use the compute option that best suits your needs and automatically save money, all without having to
perform exchanges or modifications. When you sign up for a Savings Plan, you will be charged the discounted
Savings Plans price for your usage up to your commitment.

Savings Plans allow you to easily reduce your bill by making a commitment to compute usage (e.g. $10/hour)
instead of making commitments to specific instance configurations. AWS offers two types of Savings Plans - Compute
Savings Plans and EC2 Instance Savings Plans.

savings plans should cover 80% of our usage

© 2020 DXC Technology Company. All rights reserved. February 4, 2021 5


Cost Optimization best practices
EC2 - Savings Plans Options

Flexible
Compute Savings Plans provide the most flexibility and help to reduce your costs by up to 66%. These plans
automatically apply to EC2 instance usage regardless of instance family, size, AZ, region, OS or tenancy, and also
apply to Fargate usage.

Significant Discounts
EC2 Instance Savings Plans provide the lowest prices, offering savings up to 72% in exchange for commitment to
usage of individual instance families in a region (e.g. M5 usage in N. Virginia). This automatically reduces your cost on
the selected instance family in that region regardless of AZ, size, OS or tenancy. EC2 Instance Savings Plans give you
the flexibility to change your usage between instances within a family in that region.

© 2020 DXC Technology Company. All rights reserved. February 4, 2021 6


Cost Optimization best practices
EC2 - Savings Plans and Reserved Instances questions

• EC2 Instance Savings Plans are applied automatically to spend across any tenancy and any operating system.
• AWS Compute Savings Plans are applied automatically to any sized EC2 instance in any family, across any
tenancy and OS, and in any region.
• If different types of Savings Plans or Reserved Instances are purchased, AWS will apply them in this order:
Standard Reserved Instance, Convertible Reserved Instance, EC2 Savings Plan, Compute Savings Plan.
• Due to their flexibility, AWS Compute Savings Plans eliminate the management overhead of manually modifying
and exchanging Convertible Reserved Instances, but may be more challenging to track and allocate benefits.
• At present, you cannot resell underutilized AWS Savings Plans in the Amazon EC2 Reserved Instance
Marketplace.
• You don't have to wait until existing Reserved Instances expire before being able to take advantage of Savings
Plans. AWS Savings Plans can be added in layers. So, if there are predictable workloads in the AWS environment
that are not yet covered by Reserved Instances, it makes sense to purchase a Saving Plan now and add to it as
Reserved Instances expire. The minimum commitment per purchase is one-tenth of a cent ($0.001) per hour.

© 2020 DXC Technology Company. All rights reserved. February 4, 2021 7


Cost Optimization best practices
AWS Savings Plans and Reserved Instances Comparison
Reserved Instance Reserved Instance Compute Savings EC2 Instance
Topic
Convertible Standard Plans Savings Plan
Average 1Y Discount * 30% 38% 25% (13%-41%) 29% (20%-42%)
Average 3Y Discount * 50% 58% 48% (25%-66%) 51% (38%-72%)
Instance Family Flexible Fixed Flexible Fixed
Instance size Fixed Fixed Flexible Flexible
(except Linux) (except Linux)
Geography Region-specific Region-specific Flexible Region-specific
OS Flexible Fixed Flexible Flexible
EC2 / Fargate​/
Service EC2 / RDS EC2 / RDS EC2
AWS Lambda
* The percentages are given as an average on the different compute instances to give a guidance but are not binding.

© 2020 DXC Technology Company. All rights reserved. February 4, 2021 8


Cost Optimization best practices
EBS (Instance storage)

• Delete snapshots created to backup data that are no longer needed


• Check whether your backup solution deletes old snapshots
• Delete snapshots belonging to unused AMIs
• Search for unused volumes and delete them

© 2020 DXC Technology Company. All rights reserved. February 4, 2021 9


Cost Optimization best practices
RDS Database

• Purchase Reserved instances


• Enable RDS Storage Auto Scaling instead of overprovisioning storage capacity
• Consider switching to Aurora Serverless for unsteady workloads
• Verify that instance type still reflects the current workload
• Switch to an Open Source database system (e.g., PostgreSQL instead of Oracle)

© 2020 DXC Technology Company. All rights reserved. February 4, 2021 10


Cost Optimization best practices
RDS Database - Reserved Instances

Amazon RDS reserved instances give you the option to reserve a DB instance for a one or three year term and in
turn receive a significant discount compared to the on-demand instance pricing for the DB instance. There are three RI
payment options -- No Upfront, Partial Upfront, All Upfront -- which enable you to balance the amount you pay
upfront with your effective hourly price.

© 2020 DXC Technology Company. All rights reserved. February 4, 2021 11


Cost Optimization best practices
S3

• Delete unnecessary objects and buckets


• Consider using S3 Intelligent Tiering
• Configure lifecycle policies define a retention period for objects
• Use Glacier Deep Archive for long-term data archiving

© 2020 DXC Technology Company. All rights reserved. February 4, 2021 12


Cost Optimization best practices
CloudWatch

• Configure a retention period for all log groups


• Check costs for metrics API calls caused by 3rd party tools
• Delete needless alarms and dashboards
• Check costs for log ingestion

© 2020 DXC Technology Company. All rights reserved. February 4, 2021 13


Cost Optimization best practices
CloudTrail

• Delete unnecessary trails


• Check costs for data events (S3 and Lambda

© 2020 DXC Technology Company. All rights reserved. February 4, 2021 14


Cost Optimization best practices
Right Size: Should I Right Size my servers?

On paper, right sizing makes an awful lot of sense.


Your existing nodes are largely bored (the average CPU utilization of EC2 instances often hovers in the range of
single-digit percentages), newer instance families are a lot more efficient (and cost effective i3 instances are roughly a
third the cost of i2 instances), and nobody wants your workloads to sit idly.
That said, suggesting that someone do it as a low-effort change is almost always incorrect.

It’s a win. But it’s certainly not an easy one for most environments.

© 2020 DXC Technology Company. All rights reserved. February 4, 2021 15


Cost Optimization best practices
Right Sizing: New instance families

Newer instance families use different hypervisors (Xen for the old, Nitro for the new), which means two things.
Older versions of operating systems don’t support the newer hypervisor. So, you’re not just migrating instances; you’re
upgrading the entire OS as well, which includes a hideous number of version dependencies. If you’ve containerized
your workload to the point where you don’t care about this, great, you probably want to look at spot fleets instead.
Second, a lot of these workloads are “certified” by either external vendors or internal divisions to run on certain
versions of various bundled libraries. Suddenly, upgrading them to the newest version doesn’t work nearly as well as
you’d hope.

© 2020 DXC Technology Company. All rights reserved. February 4, 2021 16


Cost Optimization best practices
Right Sizing: ‘Certified’ workloads

A lot of these workloads are “certified” by either external vendors or internal divisions to run on certain versions of
various bundled libraries. Suddenly, upgrading them to the newest version doesn’t work nearly as well as you’d hope.

© 2020 DXC Technology Company. All rights reserved. February 4, 2021 17


Cost Optimization best practices
Right Sizing: Reserved instances

Unless you had the foresight to buy convertible-type reserved instances to begin with, you’ll likely find yourself wasting
a lot of previously committed money after being forced to do this eventually. Within a family and generation (for
example, m3, c4, t2…) size doesn’t matter; a single 4xlarge decomposes to four xlarge instances, and vice-versa. But
standard reserved instances don’t carry over between generations or families.

© 2020 DXC Technology Company. All rights reserved. February 4, 2021 18


About DXC Technology

DXC Technology (NYSE: DXC) helps global companies run their mission
critical systems and operations while modernizing IT, optimizing data
architectures, and ensuring security and scalability across public, private
and hybrid clouds. With decades of driving innovation, the world’s largest
companies trust DXC to deploy our enterprise technology stack to deliver
new levels of performance, competitiveness and customer experiences.
Learn more about the DXC story and our focus on people, customers and
operational execution at www.dxc.technology.

© 2020 DXC Technology Company. All rights reserved. February 4, 2021 20


© 2020 DXC Technology Company. All rights reserved.

You might also like