By Jeremy Pedersen
Welcome back for the fourth installment in our weekly Q&A blog series! This week we will be focusing on a very important question: how to get the most out of Alibaba Cloud without spending a fortune!
Cost control on the public cloud can be a complicated subject, regardless of cloud vendor. But don't worry! The Alibaba Cloud Academy team is here to make it a little easier.
In this blog post, we'll focus mostly on Elastic Compute Service (ECS), since this is the major cost center for the majority of Alibaba Cloud customers, but please check back next Friday for even more cost saving tips.
Essentially, ECS costs can be broken down into 3 categories:
In general, there are two ways to save money on ECS:
Of the two, the biggest impact comes from choosing the right payment plan, so we'll focus on that first. We'll address choosing the right hardware in a later blog post.
From a billing perspective, there are four types of ECS instances:
To make price comparisons between the four types easier, we will compare prices for g6.large
instances in Alibaba Cloud's Singapore
region.
Tip: If you are flexible about where you deploy your ECS instances, you can save money by choosing a region where ECS instance costs are lower.
ECS subscriptions are relatively easy to understand: you pay a fixed amount of money up-front to reserve an ECS instance for a certain amount of time.
A Subscription is permanently tied to a particular ECS virtual machine, so take time to review your ECS instance settings carefully before launching one.
There are two types of subscriptions: monthly and yearly. The yearly subscription is typically cheaper than the monthly subscription. Looking at a g6.large
in the Singapore
region with a 40 GB system disk, our prices are:
If we were to purchase a monthly subscription every month for a year, the cost would be 716.40 USD, so we see that the yearly subscription is about 15% cheaper. In general, longer-term subscriptions are cheaper on Alibaba Cloud.
Subscription instances are perfect for predictable, steady workloads. Systems that need to run 24/7 and have relatively predictable load are a great fit for this billing mode. This includes things like:
Because a Subscription is tied to a particular ECS virtual machine, you cannot release (delete) a Subscription ECS instance. If you want to move your workload to another Region or Zone, you'll have to apply for a refund through the support team.
If you need the flexibility to move your ECS instances around or change instance types, choose Reserved Instances or Pay-As-You-Go instead.
A Reserved Instance (RI) is essentially a discount that you can apply to Pay-As-You-Go ECS instances. An RI is like a "ticket" that entitles you to use a certain type of ECS instance in a particular Region or Zone.
Unlike a Subscription, an RI is not attached to a particular ECS instance. Let's say you purchase a g6.large
Reserved Instance (RI). This does not actually create any ECS virtual machines, it simply guarantees you a discount the next time a Pay-As-You-Go g6.large
ECS instance is created. This matching happens automatically in the background.
Because the RI is a fairly complex concept, you may want to take a look at this article to get a clearer picture of the RI before continuing on.
There are three types of RI:
Further, there are Zonal RIs which only apply to a specific Zone within a given Region, and Regional RIs which you can use within any Zone in a single Region. The prices for the Zonal and Regional RIs are the same.
Note that in the ECS console you may see the confusing terms Reserved and Not Reserved instead of Zonal and Regional. In the ECS console, Reserved = Zonal, and Not Reserved = Regional.
You can convert between Zonal and Regional RIs whenever you like, so don't worry too much about buying the wrong type.
A Zonal RI is limited to a particular instance type and a particular Zone. So an RI for a g6.xlarge
in Singapore Zone C can only apply specifically to a g6.xlarge
instance launched in Singapore Zone C, not in Zone A or Zone B. The advantage of the Zonal RI is that Alibaba Cloud will reserve capacity for you. This means that you will always be able to launch an instance that matches this RI, regardless of how much demand there is for this instance type from other cloud users in Singapore Zone C.
On the other hand a Regional RI allows you to launch instances in any Zone within a Region. Further, a Regional RI can match multiple instance types within a single instance family. This means that a g6.xlarge
RI for Singapore could be applied to two g6.large
ECS instances instead, since the CPU and memory used by two g6.large
instances is equivalent to one g6.xlarge
. Unlike a Zonal RI, a Regional RI does not reserve capacity for you. This means that during periods of peak demand, you might not be able to launch a Pay-As-You-Go instance that matches your RI.
In general, if you aren't sure which type to choose, choose the Regional RI.
RIs can be split and merged. For instance, if I bought an RI for a g6.xlarge
, I could split that single RI into two g6.large
RIs. This gives me more flexibility in the type and number of ECS instances I can launch.
The Reserved Instance offers 1 Year and 3 Year terms. For longer terms, you can potentially receive an even higher discount than the Subscription instance type offers.
Choose an RI when:
An RI is not quite as flexible as Pay-As-You-Go: RIs always apply to a particular instance family and Region, and cannot be moved between Regions.
Alibaba Cloud Pay-As-You-Go instances are billed per-hour. At the end of each month, your usage is calculated and you pay a monthly bill.
Pay-As-You-Go instances are the most flexible type of ECS instance offered: you can release them at any time, and can freely create and release ECS instances in any region using the Pay-As-You-Go payment model. However, this flexibility comes at a cost: Pay-As-You-Go instances are more expensive than either Subscription or RI instances.
Choose Pay-As-You-Go for fluctuating workloads (game hosting, video streaming) where the ability to automatically grow and shrink capacity is important. The ability to release Pay-As-You-Go instances at any time can save you money during off-peak times, and helps you avoid overpaying due to overprovisioning (buying more ECS instances than you need).
Cost is the biggest disadvantage for Pay-As-You-Go. PAYG is more expensive than either RI or Subscription. However, because Pay-As-You-Go does not tie you into a particular instance family or Region, it is the most flexible billing type.
Preemptible instances are effectively a special type of Pay-As-You-Go instance. They can be 30-50% cheaper than traditional Pay-As-You-Go instances, but their price fluctuates throughout the day and according to supply and demand.
You can think of Preemptible instances as being an auction for unused Alibaba Cloud compute capacity: we auction off unused ECS virtual machine capacity as Preemptible Instances, at a price below the normal Pay-As-You-Go instance price.
You submit a "bid" for a particular type of instance. If this bid is higher than (or equal to) the current "market" price for preemptible instances of this type, a new Preemptible instance will be launched.
Once created, the instance has a protection period of 1 hour, meaning the instance will run for at least one hour, regardless of any change in the market price.
After this protection period has ended, the system will check the current "market" price against your "bid" price every five minutes. If your bid price falls below the market price, your ECS instance will be shut down.
Note that you can use automatic bidding if you would like your preemptible instances to remain running: this will automatically match your bid to the market price. The advantage is that your preemptible ECS instance will continue to run despite changes in price, but it also means you could end up paying more for your ECS instance than your initial bid.
Use preemtible instances for interruptible background tasks, such as:
...or any other task that is non-time-sensitive and can be interrupted and restarted with minimal impact.
Preemptible instances can be reclaimed by Alibaba Cloud if the hourly price changes. This makes them unsuitable for long-running tasks.
Let's do some quick calculations to see what it would cost us to purchase a g6.large
in Singapore using the four payment methods described above. We will summarize everything in a table, then explain how the calculations were done so that you can try them for yourself for other Regions or Instance Types:
The Pay-As-You-Go prices used were:
For 1-Year Partial Upfront RIs, the price calculation was:
up-front amount + 6 months x 30 days/month x 24 hours/day x discounted RI PAYG price
For 3-Year Partial Upfront RIs, the price calculation was:
up-front amount + 18 months x 30 days/month x 24 hours/day x discounted RI PAYG price
From the table, it looks like Preemptible instances are the cheapest, but keep in mind that preemptible instance prices fluctuate constantly. In reality, a Preemptible instance run over a long period would likely have a cost somewhere between a PAYG instance and a Subscription instance, and would likely be shut down intermittently (when your bid price falls below the market price).
Let's sum it all up:
And most important of all: don't forget to mix-and-match! If you have an application which normally has a relatively steady load (say, 5,000 - 10,000 active users) but which sometimes spikes to 20,000 or 30,000 active users, you can run a mix of RI + PAYG or Subscription + PAYG for better savings. Use RI or Subscription to handle steady loads, and PAYG to scale in and out to handle peak loads. Stay flexible!
So far, we have talked only about compute pricing. What about storage?
In general, storage pricing is tied to ECS instance pricing: Subscription instances pay for Cloud Disks on a monthly or yearly basis. Pay-As-You-Go instances pay for storage on an hourly basis.
How can we save money on storage across multiple Cloud Disks? What about other types of storage like OSS Buckets, NAS, or ECS Disk Snapshots? That's where the SCU (Storage Capacity Unit) comes in!
The SCU is sort of like an RI for storage: it can be used to reduce the cost for Pay-As-You-Go storage products. Right now, that includes:
Since the SCU is independent from your actual disks, you can create, destroy, and resize disks without needing to change your SCU. If you exceed the size (in GB) of the SCU, the storage that exceeds the SCU will be charged at the normal Pay-As-You-Go rate.
It's also possible to stack SCUs, which means purchasing multiple SCUs that apply over the same period of time, so you can always buy more if you exceed the capacity of your original SCU.
Each SCU you purchase applies to a particular Region. They can be used to offset the Pay-As-You-Go costs for NAS, OSS, Cloud Disk, and Snapshot storage usage in that Region, but cannot offset Subscription storage costs (say, for Subscription Cloud Disks).
Further, SCUs can't be used to offset the costs of disks created when you create Preemptible Instances.
This depends on the size and term of the SCU. Larger SCUs save you more money. SCUs with a longer term (say 1 year or 3 years) also offer greater savings than shorter ones.
SCUs come in different sizes from 20 GB up to 50 TB, but this can be a little misleading, because the actual amount of storage the SCU will "cover" (pay for) varies based on something called the Deduction Factor. This means that a 10 TB SCU could potentially be used to buy 20 TB worth of one type of storage, while only covering 5 TB of another type.
This happens because each service (Cloud Disk, OSS, NAS) has different underlying costs. This is especially true for Cloud Disks, which come in several different types with different levels of I/O performance and throughput.
This will be clearer once we see an example.
Let's do all our examples assuming we want to buy 10 TB of ESSD PL1 Cloud Disk storage in Singapore.
The SCU prices are easy to calculate. Since ESSD PL1 disk storage has a Deduction Factor of 1, buying 10 TB of ESSD PL1-type Cloud Disk requires a 10 TB SCU:
Figuring out the Pay-As-You-Go prices for the same amount of disk capacity (10 TB, ESSD PL1) is a little harder. This is because Alibaba Cloud gives disk costs in GiB, not GB, so we have to do some converting.
To keep it simple, I took 10 TB (10,000 GB) and converted it into "GiB" using the Google Search unit converter tool. Searching for "10000 GB to GiB" on Google should show you that 10 TB (10,000 GB) is about 9,313 GiB.
Since the Pay-As-You-Go (PAYG) cost of ESSD PL1 Cloud Disks is 0.05 USD / 100 GiB / Hour, this gives us an hourly cost of 0.05 x 9313/100 = 4.6565 = 4.66 USD / hour.
From here, we can assume a 30-day month, and work out one month, one year, and three year PAYG costs:
So how much cheaper is the SCU, compared with ordinary Pay-As-You-Go?
So in general, purchasing an SCU is a good idea over the long term, and an especially good idea for very long term storage.
Take a look at the SCU Pricing Page for more information.
Use SCUs when:
Alibaba Cloud charges for public (IPv4) network traffic in two ways:
Network traffic charges apply to any traffic to and from the public Internet. Typically this means:
How can you spread the cost of traffic usage across multiple interfaces without knowing in advance which interfaces will end up generating the most network traffic? How can you avoid locking yourself into a specific bandwidth, if your application experiences frequent traffic spikes?
Enter the Data Transfer Plan. With a Data Transfer Plan, you can pay up front for a certain amount of bandwidth, and then share it among multiple network interfaces.
Data Transfer Plans are either monthly or yearly, and can be anywhere from 50 GB to 50 TB in size. Unlike the SCU, the Data Transfer Plan is usually not limited to a particular Alibaba Cloud Region (such as Shanghai or Singapore). Instead, Data Transfer Plans are limited to a particular geographical area, such as "Mainland China", "Overseas (non-Mainland China)" or "Hong Kong".
This depends on whether you are using Pay-By-Bandwidth or Pay-By-Traffic. Let's consider both of these cases, assuming you have a single ECS instance in Singapore, with a public IP address.
Let's say you use Pay By Traffic, and you find that your average traffic is about 10 Mbps, 24 hours per day.
10 Mbps, 24 hours a day, for 30 days would be about 3,164 GB. The cost per GB in Singapore is 0.081 USD, for a total cost of 256.28 USD.
Let's assume Pay-By-Bandwidth instead. For 6 Mbps or greater, the cost "per-Mbps" is 0.021 USD/hour. We want 10 Mbps of bandwidth, which gives us a cost of 0.21 USD/hour.
Thus, our total cost for the month ends up being: 0.21 x 24 (hours/day) x 30 (days/month) = 151.20 USD.
Our total monthly usage was about 3,164 GB, or about 3 TB. For the "Overseas" plan, 3 TB Data Transfer Plan, the price is 189.00 USD.
3 TB = 3072 GB, so we'd still have to cover about 92 GB of traffic costs outside the traffic package. At the Pay-By-Bandwidth rate that would cost about 7.45 USD, for a total cost closer to 196.45.
This is cheaper than Pay-By-Traffic, but a little more expensive than Pay-By-Bandwidth. Let's extend our usage out to a full year, and see how the costs compare. Since the Data Transfer Plan charges by total traffic, we need to extend our 3164 GB out to a full year, for 3164 x 12 = 37968 GB, or about 37 TB. There is no 37 TB Data Transfer Plan, but we are allowed to stack Transfer Plans. So let's assume we buy 8 x 5 TB Data Transfer Plans, for a total of 40 TB of bandwidth:
Again, we see that the Data Transfer Plan is cheaper than Pay-By-Traffic but not as cheap as Pay-By-Bandwidth. So when should we use Data Transfer Plans?
Much like the SCUs we discussed earlier, Data Transfer Plans are best when you need to save costs across multiple Pay-As-You-Go (Pay-By-Traffic) network interfaces. The Data Transfer Plan lets you consolidate costs across multiple interfaces. This makes it ideal for:
Looking beyond billing, there are other ways to save costs, including:
We'll take a look at some of these in next week's blog, so stay tuned!
Great! Reach out to me at jierui.pjr@alibabacloud.com
and I'll do my best to answer in a future Friday Q&A blog.
You can also follow the Alibaba Cloud Academy LinkedIn Page. We'll re-post these blogs there each Friday.
Friday Q&A - Week 5 - Cost Control On Alibaba Cloud: Getting More For Your Dollar (Part 2)
JDP - April 23, 2021
JDP - April 15, 2022
JDP - March 26, 2021
JDP - July 30, 2021
JDP - July 23, 2021
JDP - April 30, 2021
An easy-to-use and cost-effective data traffic package that offers affordable traffic-billed pricing.
Learn MoreUnified billing for Internet data transfers and cross-region data transfers
Learn MoreAlibaba Cloud provides beginners and programmers with online course about cloud computing and big data certification including machine learning, Devops, big data analysis and networking.
Learn MoreAlibaba Cloud provides products and services to help you properly plan and execute data backup, massive data archiving, and storage-level disaster recovery.
Learn MoreMore Posts by JDP