Create a Filestore instance using the Google Cloud console

This quickstart shows you how to perform basic operations in Filestore using this Google Cloud console. In the quickstart, you will:

  • Create a Filestore instance.
  • Mount the file share from that instance on a Compute Engine client VM instance.
  • Create a file on the mounted file share.
  • Delete the Filestore instance.

Before you begin

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project : Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project : To create a project, you need the Project Creator role ( roles/resourcemanager.projectCreator ), which contains the resourcemanager.projects.create permission. Learn how to grant roles .

    Go to project selector

  3. If you're using an existing project for this guide, verify that you have the permissions required to complete this guide . If you created a new project, then you already have the required permissions.

  4. Verify that billing is enabled for your Google Cloud project .

  5. Enable the Filestore API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role ( roles/serviceusage.serviceUsageAdmin ), which contains the serviceusage.services.enable permission. Learn how to grant roles .

    Enable the API

  6. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project : Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project : To create a project, you need the Project Creator role ( roles/resourcemanager.projectCreator ), which contains the resourcemanager.projects.create permission. Learn how to grant roles .

    Go to project selector

  7. If you're using an existing project for this guide, verify that you have the permissions required to complete this guide . If you created a new project, then you already have the required permissions.

  8. Verify that billing is enabled for your Google Cloud project .

  9. Enable the Filestore API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role ( roles/serviceusage.serviceUsageAdmin ), which contains the serviceusage.services.enable permission. Learn how to grant roles .

    Enable the API

Required roles

To get the permissions that you need to complete this quickstart, ask your administrator to grant you the following IAM roles on your project:

  • Create and manage Filestore instances: Cloud Filestore Editor ( roles/file.editor )
  • Create and manage Compute Engine instances: Compute Instance Admin (v1) ( roles/compute.instanceAdmin.v1 )
  • Create, modify, and delete networking resources, except for firewall rules: Compute Network Admin ( roles/compute.networkAdmin )
  • Run operations on IAM service accounts: Service Account User ( roles/iam.serviceAccountUser )
  • Manage network and related Google Cloud resources: Network Administrator ( roles/iam.networkAdmin )

For more information about granting roles, see Manage access to projects, folders, and organizations .

You might also be able to get the required permissions through custom roles or other predefined roles .

When you finish the tasks that are described in this document, you can avoid continued billing by deleting the resources that you created. For more information, see Clean up .

Create a Compute Engine VM instance to be the client

  1. In the Google Cloud console, go to the VM Instances page.

    Go to the Compute Engine instances page

  2. Click Create Instanceand configure the instance as follows.

    • Set Nameto nfs-client .
    • Set Zoneto us-central1-c.
    • Keep the default boot disk.
    • In the Networking> Firewallsection, select the Allow HTTP trafficcheckbox.
    • Keep the network as default.
  3. Click Createto create the instance.

Create a Filestore instance

This quickstart shows how to create an instance in the Regionaltier with custom performance enabled. For details on creating instances, see create an instance .

  1. In the Google Cloud console, go to the Filestore Instancespage.

    Go to the Filestore Instances page

  2. Click Create Instanceand configure the instance as follows:

    • Set Instance IDto nfs-server .
    • Set Instance typeto Regional.
    • In Capacity, enter 1 TiB .
    • In Performance, click the Custom performancetoggle to enable custom performance. By default, you get 12,000 IOPS in the Performancefield. The Scale performance with capacitycheckbox is checked, so if you change the value in the Capacityfield, performance scales accordingly. For details on configuration options, see configure performance .

    • Set Regionto us-central1.

    • Set VPC networkto default.

    • Set File share nameto vol1 .

    • Set Allocated IP rangeto Use an automatically allocated IP range.

    • Set Access controlsto Grant access to all clients.

  3. Click Create.

Mount the Filestore file share on the client

  1. In the Google Cloud console, go to the VM Instances page.

    Go to the VM instances page

  2. In the list of VM instances, click the SSHbutton for nfs-clientto open a terminal window connected to that instance.

  3. Install NFS by running the following commands:

     sudo apt-get -y update &&
    sudo apt-get -y install nfs-common 
    
  4. Make a mount directory for the Filestore file share by running the following command:

     sudo mkdir -p /mnt/test 
    
  5. Mount the file share by running the mount command and specifying the Filestore instance IP address and file share name:

     sudo mount MOUNT-POINT-DIRECTORY 
    /mnt/test 
    

    where:

    MOUNT-POINT-DIRECTORY is the path to the directory where the Filestore file share is mounted. For example: 10.0.0.2:/vol1

  6. Optional: Confirm that the Filestore file share is mounted:

      df 
      
     - 
     h 
      
     -- 
     type 
     = 
     nfs 
     
    
  7. Make the file share accessible by changing the permissions:

      sudo 
      
     chmod 
      
     go 
     + 
     rw 
      
     / 
     mnt 
     / 
     test 
     
    

Create a file on the file share

  1. In the terminal window that is connected to the nfs-clientinstance, create a file named testfile by running the following command:

     echo 'This is a test' > /mnt/test/testfile 
    
  2. Confirm that the file was created by running the following command:

     ls /mnt/test 
    

    and verifying that testfile is listed.

Clean up

To avoid incurring charges to your Google Cloud account for the resources used on this page, follow these steps.

Delete the Google Cloud project

  1. In the Google Cloud console, go to the Manage resources page.

    Go to Manage resources

  2. In the project list, select the project that you want to delete, and then click Delete .
  3. In the dialog, type the project ID, and then click Shut down to delete the project.

Delete the Filestore instance

  1. In the Google Cloud console, go to the Filestore Instances page.

    Go to the Filestore instances page

  2. Click the nfs-server instance ID to open the instance details page.

  3. Click Delete .

  4. When prompted, type the instance ID.

  5. Click Delete.

Delete the Compute Engine instance

  1. In the Google Cloud console, go to the Filestore Instances page.

    Go to the VM instances page

  2. Select the checkbox next to the nfs-client instance name.

  3. Click Delete .

  4. When prompted, click Deleteagain.

What's next

Design a Mobile Site
View Site in Mobile | Classic
Share by: