Is your Cloud Bill soaring too high? In this presentation we will be exploring how to:
-Drastically lower cloud spend and to more efficiently deploy, use, grow, and manage your cloud infrastructure.
- Optimize storage to compute and everything in between.
-Identify the best techniques, and how and when to use them.
While the discussion will center around AWS, the same techniques can generally be applied to Azure, GCP, and others.
You’ll leave this session ready to employ impactful cost optimization solutions to your environment that will start saving you money immediately.
2. We live in a
cloudy world.
Are your cloud costs
soaring too high?
BRING YOUR CLOUD BILL BACK DOWN TO EARTH2
3. BRING YOUR CLOUD BILL BACK DOWN TO EARTH3
Where are we spending?
70 %
20 %
10 %
Compute (EC2) Storage (S3 and EBS) Everything Else
4. BRING YOUR CLOUD BILL BACK DOWN TO EARTH4
Cost Savings Tip #1
Buy Reserved
5. BRING YOUR CLOUD BILL BACK DOWN TO EARTH5
EC2 Purchasing Options
On-Demand
Reserved
Spot
Dedicated Hosts
6. BRING YOUR CLOUD BILL BACK DOWN TO EARTH6
Reserved Instances
Benefits: capacity reservation and discount
Types: standard, convertible, or scheduled
Term: 1-year or 3-years
Payment Options: All up-front, partial up-front, or no up-front
Attribute Matching: instance type, platform, tenancy, and AZ
7. BRING YOUR CLOUD BILL BACK DOWN TO EARTH7
RI Best Practices
Target 70-80% of On-Demand usage to be Reserved
Buy in batches (2 to 4 per year)
Partial up-front is a good combination of savings and cash flow
Not just for EC2 – reserve other services like RDS, RedShift,
DynamoDB, ElastiCache, Elastic MapReduce, and CloudFront
Upload AWS Cost and Usage report to RedShift
Determine your Spot strategy before committing to Reserved
8. BRING YOUR CLOUD BILL BACK DOWN TO EARTH8
Cost Savings Tip #2
Turn Sh*t Off
(and delete it)
9. BRING YOUR CLOUD BILL BACK DOWN TO EARTH9
Elastic IP Addresses
aws ec2 describe-addresses --query
'Addresses[?InstanceId==null]' --output text
Look for Elastic IP addresses that are not bound to any instances:
And release them:
aws ec2 describe-addresses --query
'Addresses[?InstanceId==null]' --output text |
awk '{print $1}' |
while read id;
do aws ec2 release-address --allocation-id $id;
done
10. BRING YOUR CLOUD BILL BACK DOWN TO EARTH10
Load Balancers
for i in `aws elb describe-load-balancers|sed -ne
's/"LoadBalancerName": "(.*)",/1/gp'`; do echo -n "$i ";
aws elb describe-load-balancers --load-balancer-name $i|grep
-c InstanceId;done | awk '{if ($2 == 0) {print $1}}'
Look for ELBs that have no attached instances
And delete them!
for i in `aws elb describe-load-balancers|sed -ne
's/"LoadBalancerName": "(.*)",/1/gp'`; do echo -n "$i ";
aws elb describe-load-balancers --load-balancer-name $i|grep
-c InstanceId;done | awk '{if ($2 == 0) {print $1}}' |
while read lb;
do aws elb delete-load-balancer --load-balancer-name $lb;
done
11. BRING YOUR CLOUD BILL BACK DOWN TO EARTH11
EBS Volumes
aws ec2 describe-volumes --filters
Name=status,Values=available --query
Volumes[*].VolumeId --output text
Look for orphaned EBS volumes:
Check to make sure they aren’t needed.
aws elb delete-load-balancer --load-balancer-name
$lb
Now, double check.
Now, triple check.
Delete each one:
12. BRING YOUR CLOUD BILL BACK DOWN TO EARTH12
EBS Snapshots
Use Amazon Data Lifecycle Manager (DLM) to automate
creation, retention, and deletion of EBS volume snapshots
aws dlm create-default-role
Create default DLM Role:
Create a DLM Policy:
aws dlm create-lifecycle-policy --description "My
first policy" --state ENABLED --execution-role-arn
arn:aws:iam::12345678910:role/AWSDataLifecycleManage
rDefaultRole --policy-details
file://policyDetails.json
13. BRING YOUR CLOUD BILL BACK DOWN TO EARTH13
DLM Policy Example
{
"ResourceTypes": [
"VOLUME"
],
"TargetTags": [
{
"Key": "costcenter",
"Value": "115"
}
],
"Schedules":[
{
"Name": "DailySnapshots",
"TagsToAdd": [
{
"Key": "type",
"Value": "myDailySnapshot"
}
],
"CreateRule": {
"Interval": 24,
"IntervalUnit": "HOURS",
"Times": [
"03:00"
]
},
"RetainRule": {
"Count":5
}
}
]
}
14. BRING YOUR CLOUD BILL BACK DOWN TO EARTH14
Trusted Advisor
Low utilization EC2 instances
Idle load balancers
Underutilized EBS volumes
Unassociated Elastic IP addresses
Idle RDS instances
Underutilized RedShift clusters
Route 53 latency resource record sets
15. BRING YOUR CLOUD BILL BACK DOWN TO EARTH15
Cost Savings Tip #3
Schedule
Usage
16. BRING YOUR CLOUD BILL BACK DOWN TO EARTH16
AWS Instance Scheduler
CloudFormation stack to control scheduling of resources
Works with EC2 and RDS
Configure Periods and Schedules using CLI, DynamoDB, or
CloudFormation
Apply tags to resources to schedule usage
17. BRING YOUR CLOUD BILL BACK DOWN TO EARTH17
Scheduler Architecture
18. BRING YOUR CLOUD BILL BACK DOWN TO EARTH18
Scheduler Installation
19. BRING YOUR CLOUD BILL BACK DOWN TO EARTH19
Cost Savings Tip #4
Minimize Data
Transfer
20. BRING YOUR CLOUD BILL BACK DOWN TO EARTH20
Data Transfer Optimization
Be careful with distributed systems like Cassandra, Kafka, etc.
Try to locate instances in the same AZ – big trade off
Use managed services like RDS, Aurora, etc. when possible
Use CloudFront as much as possible
Use S3 VPC Endpoint
21. BRING YOUR CLOUD BILL BACK DOWN TO EARTH21
Cost Savings Tip #5
Use Latest
Generation
22. BRING YOUR CLOUD BILL BACK DOWN TO EARTH22
Generation Cost Differences
$-
$0.050
$0.100
$0.150
$0.200
$0.250
$0.300
$0.350
$0.400
m1.xlarge m3.xlarge m4.xlarge m5.xlarge
23. BRING YOUR CLOUD BILL BACK DOWN TO EARTH23
Cost Savings Tip #6
Set Storage
Retention
Policies
24. BRING YOUR CLOUD BILL BACK DOWN TO EARTH24
S3 Storage Classes
Standard
Standard-Infrequent Access
One Zone-Infrequent Access
Glacier
25. BRING YOUR CLOUD BILL BACK DOWN TO EARTH25
Object Lifecycle Management
Transition actions move objects between storage classes
Expiration actions delete objects
Standard-Infrequent Access is great for log files
One Zone-Infrequent Access only for reproducible data
26. BRING YOUR CLOUD BILL BACK DOWN TO EARTH26
Lifecycle Configuration
<LifecycleConfiguration>
<Rule>
<ID>example-id</ID>
<Filter>
<Prefix>logs/</Prefix>
</Filter>
<Status>Enabled</Status>
<Transition>
<Days>30</Days>
<StorageClass>STANDARD_IA</StorageClass>
</Transition>
<Transition>
<Days>90</Days>
<StorageClass>GLACIER</StorageClass>
</Transition>
<Expiration>
<Days>365</Days>
</Expiration>
</Rule>
</LifecycleConfiguration>
27. BRING YOUR CLOUD BILL BACK DOWN TO EARTH27
Cost Savings Tip #7
Leverage
Autoscaling
28. BRING YOUR CLOUD BILL BACK DOWN TO EARTH28
Autoscaling Best Practices
Identify performance impacting metrics and monitor with
CloudWatch
Use cool down period
Ensure proper use of health checks
Use custom AMIs to speed up launch time
Use both event driven and scheduled autoscaling
Typical cost savings around 20-30%
29. BRING YOUR CLOUD BILL BACK DOWN TO EARTH29
Cost Savings Tip #8
Don’t Be Afraid
of Spot
30. BRING YOUR CLOUD BILL BACK DOWN TO EARTH30
What is a Spot?
Excess capacity offered at steep discounts
Market driven pricing
Can be interrupted with 2 minutes notification
Intended for fault tolerant applications
Pools defined by instance type, OS, and availability zone
31. BRING YOUR CLOUD BILL BACK DOWN TO EARTH31
Spot Use Cases
Machine learning
Big Data analytics
Video transcoding
CI/CD Systems (Jenkins Plugin)
32. BRING YOUR CLOUD BILL BACK DOWN TO EARTH32
Spot Best Practices
Diversify pools to increase availability
Set maximum bid to On-Demand price
Leverage Spot Fleet
Use Xosphere for apps with high availability requirements
33. BRING YOUR CLOUD BILL BACK DOWN TO EARTH33
Cost Savings Tip #9
Right-size
Instances
34. BRING YOUR CLOUD BILL BACK DOWN TO EARTH34
Right-size Solution
CloudFormation stack to analyze two weeks of utilization data
to provide right sizing recommendations
Must be run an individual accounts
Run no more frequently than every two weeks
Results output to CVS file in S3
35. BRING YOUR CLOUD BILL BACK DOWN TO EARTH35
Solution Architecture
37. BRING YOUR CLOUD BILL BACK DOWN TO EARTH37
Cost Savings Tip #10
Explore
Containers
38. BRING YOUR CLOUD BILL BACK DOWN TO EARTH38
Why Containers?
Consistent environment, Run anywhere, Isolation
More efficient usage of hardware resources (typically 50%)
Easy to setup with EKS/ECS or other CaaS alternative
Spot friendly for additional savings when using Xosphere
40. BRING YOUR CLOUD BILL BACK DOWN TO EARTH
Xosphere Typical Savings
Without Xosphere With Xosphere
Reserved $19,696 $0
On-Demand $13,517 $4,505
Spot $0 $11,340
Xosphere License $0 $2,000
Total $33,213 $17,845
40
Scenario:
100 instances (50 m4.4xlarge, 30 c4.2xlarge, 20 r4.2xlarge) with 70% reserved for one year with no up-front
Monthly savings of $15,367 or 46%
Editor's Notes
Intro Xosphere
Intro self
Two ways to cut costs – governance and optimization
Sinlge most useful tip – if nothing else do this
Surprised how many people don’t
About $45 per year per address
About $220 per year per ELB
About $220 per year per ELB
Low utilization = <10% CPU and network I/O <5MB on 4 or more days in the last 14 days
Low utilization = <10% CPU and network I/O <5MB on 4 or more days in the last 14 days
Low utilization = <10% CPU and network I/O <5MB on 4 or more days in the last 14 days