This document outlines strategies for optimizing AWS costs based on the lessons learned from Scrooge McDuck. It discusses using the right instance types, reserved instances, spot instances, monitoring usage, redesigning architecture, and removing idle and unnecessary resources. It provides examples of policies for automatically stopping and starting test environments outside of business hours to save on costs. Specifically, it shows policies for suspending auto scaling groups, stopping EC2 instances and RDS databases in test environments during off hours, and resuming them during on hours.
● Designing ourAWS infrastructure
● Discovery of new tools
● Experimentation
● Start spending!
2
The beginning of our journey
3.
● Optimisation
● Costsaving initiative
● Integration with third party
● etc...
3
Half way through
4.
● Do everythingyou need BUT!!
● Spend as little as you can!
● If possible, do not pay for anything at all
4
Scrooge McDuck lessons!
5.
● Use theright instance type
● Reserved instance
● Spot instances
● Monitoring and analysing your usage
● Don’t use AWS support
● Redesign the whole architecture
● Idle resources
● Remove unnecessary resources
● and the list goes on….
5
AWS cost saving measures
policies:
- name: remediate-extant-keys
description:Scan through all s3 buckets in an account and ensure all objects are encrypted (default to AES256).
resource: s3
actions:
- encrypt-keys
- name: ec2-require-non-public-and-encrypted-volumes
resource: ec2
description: Provision a lambda and cloud watch event target that looks at all new instances and terminates those with unencrypted
volumes.
mode:
type: cloudtrail
events:
- RunInstances
filters:
- type: ebs
key: Encrypted
value: false
actions:
- terminate
7
Sample Policy
8.
● Amazon MachineImages (AMI)
● Application Load Balancers (AppELB)
● Auto Scaling Groups (ASG)
● ElastiCache Clusters
● ElastiCache Cluster Snapshots
● CloudFormation
● Elastic Block Store Volumes (EBS Volumes)
● Elastic Block Store Snapshots (EBS Snapshots)
● Elastic Cloud Compute (EC2)
● Elastic Load Balancers (ELB)
● Key Management Service (KMS)
● Relational Database Service (RDS)
● Relational Database Service DB Clusters (RDS DB Clusters)
● Relational Database Service DB Cluster Snapshots (RDS DB Cluster Snapshots)
● Relational Database Service DB Snapshots (RDS DB Snapshots)
● Redshift
● Simple Storage Service (S3)
8
Supported Resources
9.
● Multiple environments
○4 test environments
● Multiple EC2 hosts (SAP)
● Multiple RDS instances
● ECS cluster per environment
○ All test environments share a single cluster
● Tagging
● Public IP
9
Scenario