How do I deploy GCP Cloud Filestore applications requiring file storage?
In this guide, we’ll walk through how to deploy GCP Cloud Filestore to set up a network file system for use in your cloud applications. We’ll cover the main components needed to deploy a Cloud Filestore instance, including the network resources and the instance itself.
Explanation of Resources
- Google Provider Configuration: This is needed to interact with Google Cloud resources.
- Google Compute Network: This creates a network for the Filestore instance.
- Google Compute Subnetwork: This defines a subnetwork within the created network.
- Google Filestore Instance: This resource creates the actual Filestore instance, specifying the tier, capacity, network configuration, and file share details.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
// Define a network
const filestoreNetwork = new gcp.compute.Network("filestore_network", {
name: "filestore-network",
autoCreateSubnetworks: false,
});
// Define a subnetwork
const filestoreSubnetwork = new gcp.compute.Subnetwork("filestore_subnetwork", {
name: "filestore-subnetwork",
ipCidrRange: "10.0.0.0/16",
region: "us-central1",
network: filestoreNetwork.id,
});
// Create a GCP Filestore instance
const filestoreInstance = new gcp.filestore.Instance("filestore_instance", {
name: "my-filestore",
tier: "STANDARD",
fileShares: {
name: "my-share",
capacityGb: 1024,
},
networks: [{
network: filestoreNetwork.id,
modes: ["MODE_IPV4"],
reservedIpRange: "10.0.0.0/29",
}],
});
export const filestoreInstanceName = filestoreInstance.name;
export const filestoreInstanceIpAddress = filestoreInstance.networks.apply(networks => networks[0].ipAddresses?.[0]);
Summary
We’ve created a configuration to deploy a Cloud Filestore instance on GCP. This configuration includes setting up a custom VPC network and subnetwork, then provisioning a Filestore instance within that network. We also output the Filestore instance name and its IP address for easy reference.
Deploy this code
Want to deploy this code? Sign up for a free Pulumi account to deploy in a few clicks.
Sign upNew to Pulumi?
Want to deploy this code? Sign up with Pulumi to deploy in a few clicks.
Sign upThank you for your feedback!
If you have a question about how to use Pulumi, reach out in Community Slack.
Open an issue on GitHub to report a problem or suggest an improvement.