All Products
Search
Document Center

Cloud Shell:Persistent storage

Last Updated:Sep 14, 2024

To prevent the files stored in the temporary storage space from being lost when your Cloud Shell instance is released, you can bind an Apsara File Storage NAS (NAS) file system to your Cloud Shell instance to store your common scripts and files persistently.

Prerequisites

  • You are familiar with NAS. Cloud Shell uses NAS to implement persistent storage. For more information about NAS, see What is NAS?

  • You are familiar with the billing rules of Performance NAS file systems. To mount a storage space, a pay-as-you-go Performance NAS file system is created. You are charged when you use the NAS file system. For more information, see Billing overview.

  • We recommend that you use a Resource Access Management (RAM) identity (RAM user or RAM role) to access Cloud Shell. You have granted the RAM identity the permission to create a NAS file system. For more information, see RAM-based access control.

Procedure

You can bind a NAS file system to your Cloud Shell instance. The NAS file system serves as the $HOME directory of your Cloud Shell instance. This directory can persistently store your common scripts and files, thereby preventing your files from being destroyed when the Cloud Shell instance is released.

Mount storage space

  1. In the toolbar, choose the storage icon > Mount File Storage.

    image

  2. On the page that appears, click Create Now. The system creates a NAS file system and binds it to your Cloud Shell instance. It takes several minutes to bind a NAS file system for the first time.

    image

  3. After the NAS file system is created and bound, Cloud Shell automatically recreates a virtual machine for you. This process does not require manual operations and takes up to 30 seconds.

  4. After the virtual machine is created, you can use the Cloud Shell instance. In the toolbar, choose the storage icon > Mount File Storage to view the File System ID of the bound NAS file system.

    image

  5. Click the File System ID to view the basic parameters of the NAS file system.

    image

Unbind storage space

  1. In the toolbar, choose the storage icon > Unmount File Storage.

    image

  2. On the page that appears, click Unmount Now to unbind the NAS file system from your Cloud Shell instance.

    Note
    • If you no longer use the NAS service, you can manually release the NAS file system. After the NAS file system is released, the files stored in the NAS file system are not retained. For more information, see Release a NAS file system.

    • If you do not release the NAS file system, this NAS file system is bound to your Cloud Shell instance when you mount storage space next time, and no new NAS file system is created.

    image

  3. After the NAS file system is unbound, Cloud Shell automatically recreates a virtual machine. This process does not require manual operations and takes up to 30 seconds.

  4. After the virtual machine is created, it uses a temporary storage space as the $HOME directory. Your custom settings and third-party software installed on your Cloud Shell instance are not retained. Files stored in the $HOME directory are lost after the Cloud Shell instance is released.

References