AWS SAA - Design Cost-Optimized Architectures

  1. Part One: Understanding Cost Effective Storage in AWS
  2. Part Two: Understanding Cost Effective Compute in AWS
  3. Part Three: Understanding Database Pricing and Cost Optimization
  4. Part Four: Understanding Cost Optimized Network Architectures
  5. Part Five: Making Cost-optimized Decisions

Part One: Understanding Cost Effective Storage in AWS

Globomantics

  • Global health care organization
  • Been using AWS for some time
  • Most core service such as EC2, RDS, S3 etc.
  • We have been asked to
    • identify solutions that will help reduce costs
    • maintain the same level of service and availability

Module Overview

  1. S3
    • Using S3 storage classes to reduce costs
  2. S3 glacier
    • When to use S3 glacier and S3 glacier heep archieve
  3. EBS storage
    • EBS pricing points and storage options

S3 Storage Classes

  1. Influences availability, durability and cost for objects stored in S3
  2. Applied at an object level, each S3 bucket can host objects with different classes
  3. An objects storage class can be changed throughout its lifetime
  4. Using the wrong storage class will lead to unnecessary spending
  • Standard: Charged based on object size
  • Standard - IA: Charged based on object size and retrieval
  • One Zone - IA: Stores objects in a single AZ
  • S3 Glacier: Used as an additional S3 storage class
  • Intelligent - Tiering: Transitions objects between classes based on their access frequencies

Lifecycle rules

  • Use lifecycle rules to transition objects between classes and expire objects

Caching

  • Downloading objects cost money, use caching to avoid unnecessary downloads and reduce S3 costs

Globomantics Requirements

  • Use an appropriate storage class for each object
  • Avoid one zone -IA as it reduces availability (store data we can reproduce in OZ - IA)
  • Use lifecycle rules
    • Transition to standard - IA
    • Transition to S3 Glacier
    • Expire objects(delete)

S3 Glacier and Deep Archive

Globomantics Requirements

  • Need to store some data long term for compliance
  • Data must be stored for at least 10 years
  • Meet the following requirements
    • Stored as cheaply as possible
    • Still be highly durable and available
    • Must be secure
    • Data won’t be needed again except for compliance requests

S3 Glacier

  • Long term archival storage
  • Two classes S3 Glacier and Deep Archive
  • Using S3 glacier we can retrieve archives in minutes
  • Using S3 glacier deep archive we can retrieve data within 12 hours
  • Data in S3 glacier are not available to you. You need to request a retrival.

Comparing Storage Costs

  • S3 Standard - 10TB - eu-west-1 $245.64
  • S3 Glacier - 10TB - eu-west-1 $46.08
  • S3 Glacier Deep Archive - 10TB - eu-west-1 $18.44

EBS Storage

  • Block storage for EC2 virtual machines
  • Persistent storage of up to 16TB per disk
  • SSD backed and HDD backed volumes
  • Provisioned storage priced at a GB per month rate
  • You are charged for the entire volume as soon as you created it. You can create a smaller EBS than increase it when you need it in the future

Options

  1. Cold HDD volumes, $0.025 per GB per month
  2. Throughput optimized HDD volumes, $0.045 per GB per month
  3. General purpose SSD volumes, $0.10 per GB per month
  4. Provisioned IOPS SSD volumes, $0.125 per GB per month and $0.065 per provisioned IOPS per month

EBS Snapshots

  • Snapshots consist of the used space in an EBS volume not the provisioned space
  • Charged on a per GB per month basis
  • Additional cost for EBS fast snapshot restore
  • If you have a 1000 GB provisioned EBS and only used 100 GB space, when you create a snapshot of this EBS, you will only be charged of 100 GB.

Summary

  1. Use S3 storage classes to reduce costs
  2. Use S3 Glacier and its role in reducing costs
  3. EBS storage pricing

Part Two: Understanding Cost Effective Compute in AWS

Module Overview

  1. Discuss EC2 payment types
  2. Discuss right sizing EC2 to optimize costs
  3. Introduce cost benefits of serverless compute

Pricing points

  1. EC2 instance uptime
  2. EBS storage
  3. Data transfer out

Instance types

On Demand instances

  • Charged by the hour or second (minimum 60 seconds)
  • No upfront commitment, billed when instances are in a running state
  • Great when you want uninterrupted compute

Reserved Instances

  • 1-year or 3-year commitment
  • pay all, parital or no upront (the more you pay upfront, the bigger discount you will get)
  • Convertible RIs available
  • Capacity reservation with Zonal RIs
  • Instance size flexibility
  • Up to 72% saving

Spot Instances

  • You are biding on unused capacity in an AZ
  • If your bid is higher than the spot price you pay the lower amount
  • Spot, Spot fleets (multiple machines, only launch when all of them can be launched at the same time), and spot blocks (multiple machines, only launch them when they can be running for a certain peroid of time) are available
  • When you loose the spot bid
    • 2-minute warning (to transfer your data)
    • instance terminate/hibernate/stop depend on your choice

In addition

  • Scheduled reserved instance: Useful if you are only running your instance periodically
  • Savings plans: Alternative to reserved instances, useful if you have mixed EC2 instance, AWS fargate and AWS lambda

Globomantics Requirements

  • Use a minture of EC2 instances sizes and types
  • Currently only on-demand instance type used
  • EC2 instance characteristic
    • Some instances run 24/7 and are expected to do so for at least 1 year (reserved instances with 1-year commitment)
    • Some instances are brought online for 48 hours every week to run weeekly batch jobs (scheduled reserved instances)
    • Other instances are brought online as needed to run short processes that must be completed within 2 hours (on-demand or spot block)
  • Note using spot block you might need to wait for some time (when your bid is higher) before your instances can be launched

Right Sizing EC2 to Optimize Costs

  • Eight instance familes: Groups of instances such as general purpose, compute optimized and memory optimized
  • Instance sizes: Each family has a range of instance sizes that offer different combinations of resources

Burstable and Fixed performance instances

  • Fixed performance (e.g. M5) offers fixed compute
  • Burstable performance (e.g. T3) provide a baseline level of CPU (e.g. 20%) with the ability to burst above the baseline.
  • Standard and unlimited: For burstable instances, if you are not using your CPU, you will get tokens(credit) which you can use later when you need extra CPU power. For Standard, your compute power will reduce to original when you use up your tokens. For unlimited, you will be charged the on-demand price for the compute power but can still use the extra CPU power for as long as you need.

Tools for Right EC2 Sizing

  • Amazon CloudWatch: Monitor CPU, network throughput, disk I/O
  • AWS Cost Explorer: Monitor your spending and view resource optimization recommendations
  • AWS Trusted Advisor: Best practice advice including advice on reduing costs

AWS Serverless Platform

  • Compute: AWS lambda, AWS fargate
  • Storage: S3
  • Data Stores: DynamoDB, Aurora
  • API Proxy: Amazon API Gateway
  • Integration: Amazon SNS, Amazon SQS

Benefits of Serverless Compute

  • No server management: No need to provision administer or maintain EC2 instance
  • Flexible scaling: Scale automatically without downtime by adjusting capacity
  • High availability: Built for automated high availability and fault tolerance

Globomantics Requirements

  • Deployed a 2-tier customer facing web application to AWS
  • Deployed using EC2 and RDS MySQL
  • Interested to know how this application would be deployed using serverless services?
  • Would there be cost benefits?

Summary

  1. Discussed different ways to pay for EC2
  2. Demonstrated EC2 savings plans
  3. Discussed right sizing of EC2
  4. Discussed how serverless compute can help reduce costs

Part Three: Understanding Database Pricing and Cost-optimization

Module Overview

  • Discuss RDS Pricing
  • Discuss DynamoDB Pricing

RDS Pricing Points

  1. Instance type and size
  2. Database storage
  3. Data transfer out between AZs and between regions
  4. Backup storage

Amazon RDS Instance Types

  1. General purpose: Including M4 and M5, good balance between computer memory and network resources
  2. Memory optimized: Including R4 and R5, designed for memory-intensive database workloads
  3. Burstable performance: Offering a baseline level of CPU with the ability to burst above the baseline

RDS Payment Options

  1. On-Demand: Pay as you go, no upfront payments
  2. Reserved instances: 1-year or 3-year commitment for up to 69% saving

RDS Storage

  1. General purpose SSD: From 20GB to 64GB prices at a $ per GB per month
  2. Provisioned IOPS SSD: Priced on a $ per GB per month plus $ per IOPS per month
  3. Magnetic storage: Cheapest storage, not recommended for new deployments

Amazon Aurora

  1. Faster than MySQL and PostgreSQL
  2. Offers additional features like Aurora serverless
  3. Cheaper than both MySQL and PostgreSQL

DynamoDB Pricing Points

  1. On-demend: Charged foe the data reads and writes your application performs
  2. Provisioned capacity: You buy the read and write capacity units that you need for your application

DynamoDB Capacity Units

  1. WCU(Write Capacity Units)
    • Each WCU is equivalent to one 1KB write per second.
    • e.g. If each of your record is 10KB, and you need to write 5 records per second, then you need 50 WCU
  2. RCU(Read Capacity Units)
    • Eventual < Strongly < transactional consistency
    • Each RCU is equivalent to one 4KB strongly consistent read per second.
    • Each RCU is equivalent to two 4KB eventual consistent read per second
    • Each RCU is equivalent to 0.5 transactional consistent read per second
  • DynamoDB auto scaling: Dynamically adjusts provisioned throughput in response to traffic patterns
  • Reserved capacity: Purchase RCUs and WCUs with a 1-year or 3-year commitment at a reduced rate

Additional DynamoDB Costs

  • Global secondary indexes need their own capacity units
  • Global DynamoDB tables will need additional capacity units
  • DynamoDB backups will increase costs

Summary

  • Discussed RDS pricing options
  • Discussed DynamoDB pricing options

Part Four: Understanding Cost-optimized Network Architectures

Module Overview

  • Discuss using ELB and Auto Scale to reduce costs
  • Discuss VPC routing and hybrid connectivity cost decisions
  • Discuss using offloading to reduce costs

ELB and Auto Scaling

Globomantics Requirements

  1. Deployed a 3-tier customer facing web application to AWS
  2. Deployed using EC2 and RDS MySQL
  3. Peak time for the application is Friday and Saturday where up to two times the amount of compute is needed

  1. Right size the EC2 instances and RDS instances
  2. Introduce EC2 auto scale for the web and app tier
  3. Introduce load balancing for the app tier

Auto Scaling Saves Money

  1. With auto scaling we design for the normal
  2. Auto scaling leads to better cost management
  3. Integrate with load balancing to make use of launched instance
  4. Using min and max values allow us to better predict costs

VPC Routing and Hybrid Connectivity Decisions

Globalmantics Requirements

  1. Connect Globalmantics HQ and smaller regional offices to their AWS deployed VPC
  2. Connect resources in their AWS deployed VPC to S3
  3. Connect Globalmantics application VPC to a VPC that contains monitoring servers
  4. Cost is a major factor, all designs should balance performance, funcationality and cost

  1. For connecting HQ to AWS VPC, we can use Direct connect or site-to-site VPN, Direct connect will give us better performance but more expensive.
  2. For connecting Branch offices to AWS VPC, site-to-site VPN should be good enough considering offices are small.
  3. For connecting Application VPC to Monitoring VPC, we could use VPC peering, it will only charge us for data transfer. The others options are: Transit Gateway and site-to-site VPNs (more expensive).
  4. For connecting Application VPC to S3, we could use VPC endpoints. Other option is to use public gateway but that is less secure(need to go through public internet).

AWS Connectivity

  • Keep as much traffic as possible on the AWS backbone
  • Consider using Direct Connect hosted connections
  • Use AWS services to reduce development and management costs
  • Balance performance, functionality and cost

Offloading with CloudFront

How can deploying a additional technology like CloudFront reduce costs?

  • S3 charges a retrieval fee per GB and fees based on the type of request
  • CloudFront charges a retrieval fee and a fee for HTTP or HTTPS requests
  • CloudFront fees are cheaper than S3 fees
  • Serving content from CloudFront can be cheaper then serving content from S3

Summary

  • Learned how ELB and auto scale can help reduce costs
  • Discussed VPC routing and hybrid connectivity options
  • Learned how offloading can help reduce costs

Part Five: Making Cost-optimized Decisions

Overview

  • Discuss factors that can affect costs
  • Work with AWS tools to monitor and estimate costs

Some factors that can affect cost

  • AWS region and zone: Resource are priced per-region and per-availability zone
  • EC2 size and type: Instance type and size will have a big impact on the cost of your compute
  • S3 storage class: Choose the correct class for the objects you are storing

Tips to Help Save Money in AWS

  • EC2 Payment: Use the correct payment model
  • Databases: Use reservation for RDS and DynamoDB
  • Tag Everything: Introduce and effective tagging policy
  • Intriduce SCPs(Service Control Policy): Use SCPs to restrict available features
  • Monitor everything: Use all the monitoring tools available to you
  • AutoScale: Implement AutoScale to avoid planning for peak
  • Offloading: Use offloading in your architectures (CloudFront, ElasticCache, RDS Read Replicas)
  • Turn things off: Shutdown and delete resources that you are not using

Course Summary

Storage and Compute

  1. S3 Storage classes
  2. S3 lifecycle rules
  3. EBS storage options
  4. EC2 pricing
  5. EC2 right sizing
  6. Serverless compute

Databases and networks

  1. RDS pricing and optimization
  2. DynamoDB pricing and optimization
  3. Cost optimized networks
    • ELB and autoscale
    • Hybrid connectivity
    • VPC connectivity
    • Offloading with CloudFront