Saturday, November 28, 2020

AWS - How to stop EC2 billing with EBS volume


I have received an email from Amazon AWS as below. Somehow, they billed even though I stopped my EC2 instance. I only created an instance for testing and stopped it. What happened?

● Email from AWS

Greetings from Amazon Web Services,

This e-mail confirms that your latest billing statement, for the account ending in ****1234, is available on the AWS web site. Your account will be charged the following:

Total: $3.36

You can see a complete break down of all charges on the Billing & Cost Management page located here:

https://console.aws.amazon.com/billing/home#/

● EC2 Instances

As you can see below, my Instance was stopped.


● Billing Details

I had to figure out why AWS charged for my stopped instance.
AWS Bills

I found out that the EBS volume caused it. AWS says about that as below.

● EBS volume


Why am I being charged for Amazon EBS when all my instances are stopped?

Amazon EC2 instances accrue charges only while they're running, but EBS volumes attached to instances continue to retain information and accrue charges, even when the instance is stopped.

To stop Amazon EBS-related charges, delete EBS volumes and Amazon EBS snapshots that you don't need.

You can't delete a volume if it's attached to an instance. To delete a volume, you must first detach it. For more information, see Detaching an Amazon EBS volume from a Linux instance.

▶ Detaching an Amazon EBS volume from a Linux instance

Unmount and detach a volume

Use the following procedure to unmount and detach a volume from an instance. This can be useful when you need to attach the volume to a different instance.

▶ To detach an EBS volume using the console

1. From your Linux instance, use the following command to unmount the /dev/sdh device.

[ec2-user ~]$ umount -d /dev/sdh

2. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.


3. In the navigation pane, choose Volumes.
4. Select a volume and choose Actions, Detach Volume.
5. When prompted for confirmation, choose Yes, Detach.

▶ Deleting an Amazon EBS volume


To delete an EBS volume using the console
1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

2. In the navigation pane, choose Volumes.
3. Select a volume and choose Actions, Delete Volume. If Delete Volume is greyed out, the volume is attached to an instance.
4. In the confirmation dialog box, choose Yes, Delete.

Now, I hope that AWS doesn't charge for stopped instances anymore.


1 comment:

  1. Came across this for the same reason, now I was able to solve it too. It helped me a lot. Thank you for this post

    ReplyDelete