ChatGPT解决这个技术问题 Extra ChatGPT

Do you get charged for a 'stopped' instance on EC2? [closed]

Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 10 years ago. Improve this question

Bit confused here, I have an on-demand instance but do I get charged even when I stop the instance?


r
rogerdpack

No.

You get charged for:

Online time Storage space (assumably you store the image on S3 [EBS]) Elastic IP addresses Bandwidth

So... if you stop the EC2 instance you will only have to pay for the storage of the image on S3 (assuming you store an image ofcourse) and any IP addresses you've reserved.


I just got a reply from AWS customer support explaining a stopped instance in the same region could cause it be treated as running and hence charged. They refunded the amount charged me for this and recommended me to terminate the instance. This could be a design flaw / bug waiting to be fixed.
Second paragraph of the AWS EC2 doc says: We don't charge hourly usage for a stopped instance, or data transfer fees, but we do charge for the storage for any Amazon EBS volumes.... Each time you start a stopped instance we charge a full instance hour, even if you make this transition multiple times within a single hour.... As soon as the state of an instance changes to shutting-down or terminated, we stop charging for that instance
It seems that we charge a full instance hour part is changed now. Following is from the same EC2 doc you have linked: Each time you start a stopped instance we charge a minimum of one minute for usage. After one minute, we charge only for the seconds you use. For example, if you run an instance for 20 seconds and then stop it, we charge for a full one minute. If you run an instance for 3 minutes and 40 seconds, we charge for exactly 3 minutes and 40 seconds of usage
I had this issue, one thing that didn't make this list is that NAT Gateways are also being charged under EC2 Billing.
N
Nate

This may have changed since the question was asked, but there is a difference between stopping an instance and terminating an instance.

If your instance is EBS-based, it can be stopped. It will remain in your account, but you will not be charged for it (you will continue to be charged for EBS storage associated with the instance and unused Elastic IP addresses). You can re-start the instance at any time.

If the instance is terminated, it will be deleted from your account. You’ll be charged for any remaining EBS volumes, but by default the associated EBS volume will be deleted. This can be configured when you create the instance using the command-line EC2 API Tools.


What about the storage that comes with the instance itself, does this persist and effectively not be charged for then?
If you are talking about instance storage (not EBS), it will be destroyed when you terminate the instance. For instances that boot from instance storage, they don’t even have a “stop” option, only “terminate”. Of course, you can attach an EBS volume to your instance, even if it boots from instance storage. In that case the EBS volumes will stay around after the instance is terminated, as long as they don’t have the “delete on termination” flag set.
NB that a stopped instance "loses" its IP address and is re-assigned it when it restarts (hence the need for elastic IP addresses). If it doesn't use EBS then see Nate's note (there is no stop option--only terminate--i.e. it always has to keep running basically).
It is mostly depend on the EC2 type of your choice. Unlike EC2-Classic, if you select EC2-VPC a stopped instance retains its associated Elastic IP addresses when it restarts.
L
Lee

When you stop an instance, it is 'deleted'. As such there's nothing to be charged for. If you have an Elastic IP or EBS, then you'll be charged for those - but nothing related to the instance itself.


Yes I do have an EBS, thanks for clarifying.
@Alexandre - as mentioned, yes if you have EBS, then you'll be charged for that. The 'instance' in actual EC2 terms no longer exists however. Have EBS as a boot disk, is not an instance - it's merely the equivalent of a Virtual Hard Disk.
Will I be charged for the root volume of the volume? basically If i have a m1.medium instance with the 8gb root volume and no attached ebs, stopped. will I be charged for it.
@shshank Non-EBS instances cannot be stopped, they can only be terminated -- and terminating a non-EBS instance will delete the node's storage completely.
EC2 instanced CAN be stopped. I'm not sure if that was correct in '16 @cdhowie but it certainly is now.
m
mwright

Short answer - no.

You will only be charged for the time that your instance is up and running, in hour increments. If you are using other services in conjunction you may be charged for those but it would be separate from your server instance.