AWS Pricing and Billing (Part 3)
Tags: aws, pricing, billing, devops
Published: 2020-01-18 15:56:35

In [my last article](https://dev.to/markfreedman/aws-pricing-and-billing-part-2-770), we discussed S3 pricing, which was an entire topic on its own. In this part, we’ll discuss other key service charges, and the options and decisions we need to make when planning.

I don’t believe the exams will ask about specific prices, as these can always change. But the important thing is understanding the relative pricing, so you could be able to make intelligent cost analysis decisions.

Because there are often many details and variables that go into cost calculation, I’ll also link directly to the AWS pages for each service cost.

####Snowball####
**Snowball** is a physical petabyte-scale device used for migrating gigantic data sets into and out of AWS S3 storage. It’s much cheaper and faster to get on-premise data into and out of AWS using a physical device, especially when we’re talking petabytes.

####Elastic Block Store (EBS)####
In [my first article on billing and pricing](https://dev.to/markfreedman/aws-pricing-and-billing-part-1-4f0g), we discussed the support options’ costs and EC2 pricing. There are a few services that work hand-in-hand with EC2 that we’ll discuss here. First off, an EC2 (or any server instance) is useless without disk storage. EBS is AWS’s virtual disks in the cloud. These disks are not tied to any single EBS instance. The flexibility of keeping it independent allows us to detach it from one EC2 instance and attach it to another, like moving a physical hard drive from one physical server to another. But like physical servers, an EBS instance can only be attached to a single EC2 instance at a time. In addition, EBS instances can only be attached to EC2 instances in the same region.

EBS pricing is based on media type and provisioned storage (not necessarily what’s physically used). The monthly prices shown are current as of this writing, and subject to change, but it will still give you an idea of relative costs:

- **General purpose SSD (gp2)** volumes are 10 cents per GB. These are perfect for boot drives and general file storage purposes.
**Provisioned IOPS SSD (io1)** volumes are 12.5 cents per GB. Because 10s of 1000s of these volumes can be attached to a single EC2 instance, we’re also charged 6.5 cents each per month. These are mainly for I/O-intensive and database workloads. I’m still not exactly sure why so many volumes are desirable, so I hope to learn more about that soon.

- **Throughput Optimized HDD (st1)** volumes are 4.5 cents per GB. These are magnetic drives good for large, sequential workloads and data warehouses.

- Cold HDD (sc1) volumes are 2.5 cents per GB. These magnetic drives are for inexpensive block storage where throughput is more important than speed.

- **EBS Snapshots** are incremental backups of any EBS store, and are charged at 5 cents per GB of actual data stored; not provisioned size.

There’s a service fee per “job.” A job is the shipping/loading/shipping/unloading of a single Snowball device. There are two sizes of Snowball; 50 TB and 80 TB. The service fee for each is $200 and $250 ($320 for Singapore and Seoul), respectively. Standard shipping charges are extra. There’s also a daily charge for holding onto the device, although the first 10 days are free. If we go beyond 10 days, we’re charged an extra $15 ($20 for Singapore and Seoul) per day afterwards. It’s free to transfer the data into S3. But transferring data out of S3 runs between 3 and 5 cents per GB, depending upon region.

####Relational Database Service (RDS)####
There are no up-front fees for setting up RDS use. But Amazon prices RDS use by the following:

- Clock hours of server time.
- Instance type and size.
- Provisioned storage.
- Additional storage.
- Requests.
- Engine.
- Data transfer.

The monthly prices differ by instance type and database engine:

- **Aurora** could potentially be a more cost-effective option if you can take advantage of the performance gains over MySQL and PostgreSQL, and you are looking for no-touch administration. But it could be up to 20% more expensive. Storage is 10 cents per GB and I/O is 20 cents per million requests. Backup storage runs between 2 and 2.5 cents per GB, depending on region.

- **MySQL, PostgreSQL, and MariaDB** costs vary significantly based upon instance type and region. Single-AZ on-demand costs can run from 1.7 cents per hour to almost $14 per hour! These prices double when running in multiple AZs. As with EC2 instances, we can also get significant discounts by reserving instances. 1-year terms can save us around 25%, while 3-year terms can save us around 50%. The savings can even increase as the instance type grows.

- **Oracle and SQL Server** prices can vary quite a bit depending upon license and instance size. I’d avoid these engines unless you have very specific needs.

####DynamoDB####
There are two “capacity modes” for **DynamoDB**:

- **On-Demand** capacity doesn’t require the need to predict usage. **Provisioned** capacity offers significant savings, if we can predict our need. We’re charged by the following:
  - Read request units.
  - Write request units.
  - Data storage.
  - Continuous backups.
  - On-demand backups.
  - Backup table restore.
  - Global tables.
  - Accelerator (DAX).
  - Streams.
  - Data transfer.

Pricing details for all of the above are too numerous to go through here, so I recommend reading all the details on the [AWS site](https://aws.amazon.com/dynamodb/pricing/). Suffice it to say that **DynamoDB** is a lot cheaper than **RDS** costs, so only reserve **RDS** use for where you really need relational access.

####CloudFront####
**CloudFront** is relatively cheap considering the benefits. There are no up-front fees.

- **Free Tier** consists of 50 GB monthly of outbound data transfer and 2 million HTTP/HTTPS monthly requests over a year.

- **On-Demand** pricing for data transferred out to the Internet is on a sliding scale based on volume per month, and by region. This can range from 2 to 17 cents per GB. For regional transfer inside of AWS, the prices range from 2 to 16 cents per GB. HTTP method calls are all around 1 cent per 10,000 calls.

####Elastic Load Balancer (ELB)####
In order to calculate **Elastic Load Balancer** pricing, we first have to understand what a **Load Balancer Capacity Unit (LCU)** is. It’s based on the highest of the following:

- New connections per second (up to 25 = 1 **LCU**).

- Active connections per minute (up to 3,000 active connections per minute = 1 **LCU**).

ELBs are charged at a bit over 2 cents per hour (or partial hour), differing slightly by region. In addition, we’re charged 0.8 cents per LCU-hour (as described above). So if you think about it, we’d be paying well under a dollar a day for a load balancer; probably around $15 or so per month. Definitely not where we’ll take a big hit budget-wise.

####Lambda####
Serverless computing has become enormously popular over the last few years, especially as we consider solutions for [microservices](https://microservices.io/). AWS Lambda allows us to write small functions to respond to several types of events in a “single responsibility principle” model — and if you think about it, virtually everything in computing is triggered by an “event.” We can choose from various popular languages for coding these, which eliminates any real learning curve. AWS handles all the provisioning, scaling, and infrastructure for us at very low cost:

- **Request pricing**
  - Free tier: 1 million requests per month. Great bargain.
20 cents per 1 million requests thereafter.

- **Duration pricing** — this is based on processing time and allocated memory.
  - 400,000 GB-seconds per month free up to 3.2 million seconds.
  - $0.00001667 for every GB-second used thereafter.

- *Please keep in mind that we are still charged for the resources our Lambda functions use, such as S3 and database transactions.*

One of the criticisms of Lambda is its cold startup time when it hasn’t been used for awhile. Each Lambda function is containerized, so even though containers are much more efficient than VMs, there is still start-up latency. AWS offers **Provisioned Concurrency Pricing** to help alleviate this issue, at a cost. As they say on their site, this “keeps functions initialized and hyper-ready to respond in double-digit milliseconds.” **Provisioned Concurrency Pricing** involves several variables, so it’s best to look at the [examples on the AWS website](https://aws.amazon.com/lambda/pricing/#Provisioned_Concurrency_Pricing).

####Free is for Me####
AWS gives us several free service options as well:

- [Free user tier](https://aws.amazon.com/free/free-tier-faqs/) for new accounts:
  - Free EC2 micro instances for a year.
  - Free S3 usage tier.
  - Free Elastic Block Store (EBS).
  - Free Elastic Load Balancing (ELB).
  - Free data transfer.
  - Etc.

- Free services
  - VPC (virtual data center in the cloud)
  - Elastic Beanstalk (but provisioned resources aren’t free)
  - CloudFormation (but provisioned resources aren’t free)
  - Identity Access Management (IAM)
  - Auto Scaling (but provisioned resources aren’t free)
  - Opsworks (similar to Elastic Beanstalk)
  - Amplify
  - AppSync
  - CodeStar
  - Consolidated Billing
  - Cost Explorer
  - AMIs (exception: if creating from a running instance, we pay for running a micro instance (about 2 cents per hour, depending on region) plus some EBS fees).

####Pricing Calculators####
AWS provides us with a couple of tools for estimating costs. Apparently, this is a big part of the [AWS Certified Cloud Practitioner](https://dev.to/markfreedman/aws-certified-cloud-practitioner-2mi3) exam, so practice using them:

- [Simple Monthly Calculator](https://calculator.s3.amazonaws.com/index.html)
  - Allows us to build out environments for estimating costs.
  - Calculates running-cost estimates.
  - Hosted on S3 (trivia).

- [Total Cost of Ownership (TCO) Calculator](https://aws.amazon.com/tco-calculator/)
  - This is a great tool for generating reports to convince C-level management the cost benefits of moving to the cloud.
  - Allows us to compare on-premise vs. AWS cloud costs.
  - Breaks things down into four categories (for overhead, space, power, and cooling costs):
        - Server costs
        - Storage costs
        - Network costs
        - IT labor costs

Again, practice, practice, practice.