View AWS CloudShell persistent storage consumption

2 minute read
Content level: Foundational
0

Quickly examine the amount of persistent storage thats available for an AWS CloudShell session

With AWS CloudShell, you have persistent storage of 1 GB for each AWS Region at no cost. Persistent storage is located in your home directory ($HOME) and is private to you. Unlike ephemeral environment resources that are recycled after each shell session ends, data in your home directory persists between sessions.

There are times when you need to examine how much of this persistent storage is being consumed as you work with CloudShell or you might run into no space errors. This brief articles provides you the steps that you can take to review the storage usage.

To find out how much storage is left in your AWS CloudShell environment, you can use standard Linux commands to check the disk usage of your home directory. AWS CloudShell provides 1 GB of persistent storage in the $HOME directory per region, and this storage is where all your files are saved.

Here’s how you can check the storage usage and remaining space:

Steps to Check Storage in AWS CloudShell

  1. Launch AWS CloudShell: Open the AWS Management Console. Click on the CloudShell icon in the toolbar or search for "CloudShell" in the search bar.

  2. Check Total and Available Space: To see the total and available storage, use this command: bash df -h $HOME

This will show details like total size, used space, and available space for your home directory.

Example Output If you run df -h $HOME, you might see something like this:

FilesystemSizeUsedAvailUse%Mounted on
/dev/loop0974M164K907M1%/home/cloudshell-user

This indicates that: The total storage is 974 MB. 164K is used. 907 MB is available.

**Things to consider: **

Storage is limited to 1 GB per region, and it cannot be expanded. If you need more storage, consider using an Amazon S3 bucket for additional file storage. Persistent storage in CloudShell is tied to your $HOME directory and persists across sessions within the same region.

By using these commands, you can monitor your CloudShell storage usage effectively and ensure you stay within the provided limits.

profile picture
EXPERT
published 3 months ago138 views
2 Comments

The article is not 100% correct. The command

du -sh $HOME

can show (far) less that 1GB used while

df -h $HOME

can show 100% usage. This happens because files are allocated in storage blocks, file size is computed in bytes. So, if file allocation block size is 1KB, a 1 byte file will use the same storage as 1023 byte file.

replied 2 months ago

EnzoR - Thanks for pointing that out, I have updated the article to remove ref for du -sh $HOME.

profile picture
EXPERT
replied a month ago