Instructor: Hi, and welcome to this lecture
on EC2 Instances Purchasing Options.
So we've been using so far, on-demand EC2 instances.
They allow us to run instances on demands,
that means they're good for short workloads,
we get predictable pricing,
and we're going to pay by the second.
But if you have different kind of workloads,
you can optimize your discounts and your pricing
by specifying it to AWS.
For example, you can use reserved instances
and you have one year or three years term,
and they're meant for long workloads.
So if you know you're going to run a database
for a long time, then a reserved instance is great.
And if you want to have a flexible instance type,
so for example, you want to change
the instance type over time,
then convertible reserved instances are for you.
And by the way, don't worry,
I'm going to do a deep dive in all of those over time.
Okay, next we have savings plan
and savings plan are one and three years term,
and they're more modern
because instead of committing to a specific instance type,
you commit to a specific amount of usage in dollars,
and there again, for long workloads.
Spot instances instead are meant
for very short workloads,
they're very, very cheap,
but at any time you can lose these instances
and that makes them less reliable.
Dedicated host allows you to book an entire physical server
and control instance placements.
And dedicated instances means that
no other customers will share your hardware.
Finally, capacity reservations allow you to reserve capacity
in a specific AZ for any duration.
Now let's look at EC2 on-demand.
So you're going to pay for what you use.
So that means that if you're using Linux or Windows,
you're going to be getting a billing per second
after the first minute,
or for all the other operating systems,
you're going to get a billing per hour.
It has the highest cost but no upfront payments
and no long-term commitments.
That means it's definitely recommended for a short-term
and uninterrupted workload
where you cannot predict how the application will behave.
Now for reserved instances,
and by the way, the numbers I show you can change over time,
so I will not update this video every time,
but it gives you an idea of what the numbers can be.
So the reserved instances give you a 72% discounts
compared to on-demand.
And you reserve a specific instance attributes.
For example, the instance type, the region,
the tenancy, and the OS.
You specify a reservation period one year or three years,
to get even more discounts,
and whether or not you wanna pay upfront,
partially upfront, or not upfront.
And all upfront of course gives you
the maximum amount of discounts.
In terms of the scope,
do you want the scope to be
into a specific region or a zone?
That means reserve capacity in a specific AZ.
And so you would use reserved instances
for the steady-state usage applications,
think for example, for a database.
And you can buy or sell your reserved instances
in a marketplace if you don't need them anymore.
And there is a specific kind of reserved instances
called the convertible reserved instance,
which is allowing you to change the instance type,
the instance family, the operating system,
the scope and the tenancy.
And because you have more flexibility,
well you get a bit less discounts
you get up to 66% discounts.
So that's for reserved instances.
And now you have the EC2 savings plans
which is to allow you to get a discount
based on long-term usage,
which is the same 70% as reserved instances.
But instead, you're going to say,
"I want to spend $10 per hour for the next 1, 2, 3 years."
And any usage beyond the savings plan
is going to be billed at the on-demand price.
So with savings plans,
you're locked to a specific instance family and region.
For example, you say,
"I want to have M5 type of instance family in us-east-1."
But you're flexible across the instance size.
So you can have m5.xlarge, m5.2xlarge and so on.
The OS, so you can switch
between Linux and Windows and so on.
And the tenancy, you can switch
between host, dedicated and default.
Now, for spot instances,
they have the most aggressive discounts,
so up to 90% discounts compared to on-demand,
but they are instances you can lose at any point of time
because you define a max price
you're willing to pay for your spot instances.
And if the spot price goes over it,
then you're going to lose it.
So they're the most cost-efficient instances in AWS
and they're going to be very helpful
if you have a workload that is resilient to failure.
So what could they be?
Well, it could be batch jobs, data analysis,
image processing, any kind of distributed workloads,
or workloads that have a flexible start and end time.
They are not suited for critical jobs or databases
and the exam will test you on that.
Next we have dedicated hosts.
So you get an actual physical server
with EC2 instances capacity
fully dedicated to your use case.
And you want to have dedicated hosts
in the use case of, you have compliance requirements
or you need to use your existing
server-bound software licenses that has billing
based on a per-socket, per-core, per VM software licenses.
This is in these kind of use cases
that you need to access the physical server
and get a dedicated host.
So for dedicated hosts, you get on-demand,
and you're gonna pay per second,
or you can reserve them for one or three years.
They're the most expensive option of AWS
because you actually reserve a physical server.
And so again, a use case is when you have
a software that comes with a licensing model
that is bring your own license.
Or if you have a company that has strong regulatory
or compliance needs.
We also have dedicated instances,
and there are instances that runs on hardware
that's dedicated to you,
which is different from the physical server.
But you may share the hardware with other instances
in the same accounts
and you have no control over instance placements.
So there's a difference between dedicated instances
and hosts, that is here.
At the exam, honestly, it doesn't trick you
into one or the other,
but remember that dedicated instances
mean that you have your own instance on your own hardware,
whereas dedicated host,
you get access to the physical server itself
and it gives you visibility into the lower level hardware.
Next, we have capacity reservations for EC2.
So you can reserve on-demand instances
in a specific AZ for any duration.
And then you get access to that capacity
whenever you need it.
You have no time commitment so you can reserve capacity
or cancel your reservation at any time.
And no billing discounts.
The only purpose is to reserve capacity.
So if you want to get billing discounts,
you need to combine it with regional reserved instances
or your savings plan.
And you're charged at the on-demand rates,
whether or not you run instances.
So that means that your reserved capacity,
you're going to be billed for it,
and you know for sure that if you want to launch instances
they're going to be available,
but if you don't launch them,
you're still going to get charged.
So they're very suitable
for short-term uninterrupted workloads
that need to be in a specific AZ.
So it gets difficult to understand
which purchasing option is right for me,
especially if you are a beginner.
But let me give you a summary.
The first one is on-demand.
So we'll take a resort as an analogy.
And with on-demand,
you have a resort and you come in whenever you like
and whenever you like, you pay the full price.
For reserved, well, you like to plan ahead
and you know you're going to stay a very long time
in your resort, one, two, three years,
and then you're going to get a good discount
because we know you're going to stay long time.
Savings plan is saying,
"Hey, I know for sure that in my resort
I'm going to spend a specific amount.
So I'm going to spend maybe $300 per month
every month for the next 12 months."
And therefore, you may wanna change the room type over time.
So king, suite, sea view, and so on.
But the savings plan is saying,
"Hey, you're to commit
to a specific spending in your hotel."
Spot instances are whenever
the hotel runs very last-minute discounts
because they have empty rooms and they wanna attract people.
So they get empty rooms
and people bid on getting this empty room.
And so you get very, very discounts.
But in this specific resort,
well, you can get kicked out of at any time
if someone is willing to pay more
for your room than what you did.
But I don't wanna stay in such a resort.
Dedicated host is saying,
"Hey, I want to book the entire building of the resort."
So you get your own hardware, your own resort.
And then capacity reservation is saying,
"I'm going to book a room,
I'm not even sure if I don't stay in,
but I know that if I want to stay in, I will have it."
And you will pay full price
for booking that room nonetheless.
In terms of price comparison,
I've just put together this table to give you
one example at one point of time.
So I took an m4.large in us-east-1,
and the on-demand price is 10 cents,
but then the spot price is going to be up to,
for example, 61% off in my example.
Then if you want to reserve your instance,
as you can see, you have different pricing.
If you wanted to have for one year, for three years,
and pay no upfront or all upfront.
Same for the EC2 savings plan
we see that it is the same as a reserved instance discounts.
We also get reserved convertible instances
and we have dedicated host,
which is at the on-demand price.
The dedicated host reservation which is up to 70% off
because you reserve your host.
And capacity reservation again at the on-demand price.
So the exam will ask you to just know
which type of instance is the right one
based on your workloads.
And by now, you should have some good hints,
and don't worry, we will practice this over time.
All right, that's it for this lecture,
I hope you liked it.
And I will see you in the next lecture.