1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. nas
  5. Snapshot
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.nas.Snapshot

Explore with Pulumi AI

Provides a File Storage (NAS) Snapshot resource.

For information about File Storage (NAS) Snapshot and how to use it, see What is Snapshot.

NOTE: Available in v1.152.0+.

NOTE: Only Extreme NAS file systems support the snapshot feature.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const config = new pulumi.Config();
const name = config.get("name") || "testacc";
const _default = alicloud.nas.getZones({
    fileSystemType: "extreme",
});
const defaultFileSystem = new alicloud.nas.FileSystem("default", {
    fileSystemType: "extreme",
    protocolType: "NFS",
    zoneId: _default.then(_default => _default.zones?.[0]?.zoneId),
    storageType: "standard",
    capacity: 100,
});
const defaultSnapshot = new alicloud.nas.Snapshot("default", {
    fileSystemId: defaultFileSystem.id,
    description: name,
    retentionDays: 20,
    snapshotName: name,
});
Copy
import pulumi
import pulumi_alicloud as alicloud

config = pulumi.Config()
name = config.get("name")
if name is None:
    name = "testacc"
default = alicloud.nas.get_zones(file_system_type="extreme")
default_file_system = alicloud.nas.FileSystem("default",
    file_system_type="extreme",
    protocol_type="NFS",
    zone_id=default.zones[0].zone_id,
    storage_type="standard",
    capacity=100)
default_snapshot = alicloud.nas.Snapshot("default",
    file_system_id=default_file_system.id,
    description=name,
    retention_days=20,
    snapshot_name=name)
Copy
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/nas"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cfg := config.New(ctx, "")
		name := "testacc"
		if param := cfg.Get("name"); param != "" {
			name = param
		}
		_default, err := nas.GetZones(ctx, &nas.GetZonesArgs{
			FileSystemType: pulumi.StringRef("extreme"),
		}, nil)
		if err != nil {
			return err
		}
		defaultFileSystem, err := nas.NewFileSystem(ctx, "default", &nas.FileSystemArgs{
			FileSystemType: pulumi.String("extreme"),
			ProtocolType:   pulumi.String("NFS"),
			ZoneId:         pulumi.String(_default.Zones[0].ZoneId),
			StorageType:    pulumi.String("standard"),
			Capacity:       pulumi.Int(100),
		})
		if err != nil {
			return err
		}
		_, err = nas.NewSnapshot(ctx, "default", &nas.SnapshotArgs{
			FileSystemId:  defaultFileSystem.ID(),
			Description:   pulumi.String(name),
			RetentionDays: pulumi.Int(20),
			SnapshotName:  pulumi.String(name),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var name = config.Get("name") ?? "testacc";
    var @default = AliCloud.Nas.GetZones.Invoke(new()
    {
        FileSystemType = "extreme",
    });

    var defaultFileSystem = new AliCloud.Nas.FileSystem("default", new()
    {
        FileSystemType = "extreme",
        ProtocolType = "NFS",
        ZoneId = @default.Apply(@default => @default.Apply(getZonesResult => getZonesResult.Zones[0]?.ZoneId)),
        StorageType = "standard",
        Capacity = 100,
    });

    var defaultSnapshot = new AliCloud.Nas.Snapshot("default", new()
    {
        FileSystemId = defaultFileSystem.Id,
        Description = name,
        RetentionDays = 20,
        SnapshotName = name,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.nas.NasFunctions;
import com.pulumi.alicloud.nas.inputs.GetZonesArgs;
import com.pulumi.alicloud.nas.FileSystem;
import com.pulumi.alicloud.nas.FileSystemArgs;
import com.pulumi.alicloud.nas.Snapshot;
import com.pulumi.alicloud.nas.SnapshotArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var config = ctx.config();
        final var name = config.get("name").orElse("testacc");
        final var default = NasFunctions.getZones(GetZonesArgs.builder()
            .fileSystemType("extreme")
            .build());

        var defaultFileSystem = new FileSystem("defaultFileSystem", FileSystemArgs.builder()
            .fileSystemType("extreme")
            .protocolType("NFS")
            .zoneId(default_.zones()[0].zoneId())
            .storageType("standard")
            .capacity(100)
            .build());

        var defaultSnapshot = new Snapshot("defaultSnapshot", SnapshotArgs.builder()
            .fileSystemId(defaultFileSystem.id())
            .description(name)
            .retentionDays(20)
            .snapshotName(name)
            .build());

    }
}
Copy
configuration:
  name:
    type: string
    default: testacc
resources:
  defaultFileSystem:
    type: alicloud:nas:FileSystem
    name: default
    properties:
      fileSystemType: extreme
      protocolType: NFS
      zoneId: ${default.zones[0].zoneId}
      storageType: standard
      capacity: 100
  defaultSnapshot:
    type: alicloud:nas:Snapshot
    name: default
    properties:
      fileSystemId: ${defaultFileSystem.id}
      description: ${name}
      retentionDays: 20
      snapshotName: ${name}
variables:
  default:
    fn::invoke:
      function: alicloud:nas:getZones
      arguments:
        fileSystemType: extreme
Copy

Create Snapshot Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new Snapshot(name: string, args: SnapshotArgs, opts?: CustomResourceOptions);
@overload
def Snapshot(resource_name: str,
             args: SnapshotArgs,
             opts: Optional[ResourceOptions] = None)

@overload
def Snapshot(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             file_system_id: Optional[str] = None,
             description: Optional[str] = None,
             retention_days: Optional[int] = None,
             snapshot_name: Optional[str] = None)
func NewSnapshot(ctx *Context, name string, args SnapshotArgs, opts ...ResourceOption) (*Snapshot, error)
public Snapshot(string name, SnapshotArgs args, CustomResourceOptions? opts = null)
public Snapshot(String name, SnapshotArgs args)
public Snapshot(String name, SnapshotArgs args, CustomResourceOptions options)
type: alicloud:nas:Snapshot
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. SnapshotArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. SnapshotArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. SnapshotArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. SnapshotArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. SnapshotArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var examplesnapshotResourceResourceFromNassnapshot = new AliCloud.Nas.Snapshot("examplesnapshotResourceResourceFromNassnapshot", new()
{
    FileSystemId = "string",
    Description = "string",
    RetentionDays = 0,
    SnapshotName = "string",
});
Copy
example, err := nas.NewSnapshot(ctx, "examplesnapshotResourceResourceFromNassnapshot", &nas.SnapshotArgs{
	FileSystemId:  pulumi.String("string"),
	Description:   pulumi.String("string"),
	RetentionDays: pulumi.Int(0),
	SnapshotName:  pulumi.String("string"),
})
Copy
var examplesnapshotResourceResourceFromNassnapshot = new Snapshot("examplesnapshotResourceResourceFromNassnapshot", SnapshotArgs.builder()
    .fileSystemId("string")
    .description("string")
    .retentionDays(0)
    .snapshotName("string")
    .build());
Copy
examplesnapshot_resource_resource_from_nassnapshot = alicloud.nas.Snapshot("examplesnapshotResourceResourceFromNassnapshot",
    file_system_id="string",
    description="string",
    retention_days=0,
    snapshot_name="string")
Copy
const examplesnapshotResourceResourceFromNassnapshot = new alicloud.nas.Snapshot("examplesnapshotResourceResourceFromNassnapshot", {
    fileSystemId: "string",
    description: "string",
    retentionDays: 0,
    snapshotName: "string",
});
Copy
type: alicloud:nas:Snapshot
properties:
    description: string
    fileSystemId: string
    retentionDays: 0
    snapshotName: string
Copy

Snapshot Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Snapshot resource accepts the following input properties:

FileSystemId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the file system.
Description Changes to this property will trigger replacement. string
The description of the snapshot. It must be 2 to 256 characters in length and cannot start with https:// or https://.
RetentionDays Changes to this property will trigger replacement. int
The retention period of the snapshot. Unit: days. Valid values:

  • -1: The default value. Auto snapshots are permanently retained. After the number of auto snapshots exceeds the upper limit, the earliest auto snapshot is automatically deleted.
SnapshotName Changes to this property will trigger replacement. string
SnapshotName. It must be 2 to 128 characters in length and must start with a letter, but cannot start with https:// or https://.
FileSystemId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the file system.
Description Changes to this property will trigger replacement. string
The description of the snapshot. It must be 2 to 256 characters in length and cannot start with https:// or https://.
RetentionDays Changes to this property will trigger replacement. int
The retention period of the snapshot. Unit: days. Valid values:

  • -1: The default value. Auto snapshots are permanently retained. After the number of auto snapshots exceeds the upper limit, the earliest auto snapshot is automatically deleted.
SnapshotName Changes to this property will trigger replacement. string
SnapshotName. It must be 2 to 128 characters in length and must start with a letter, but cannot start with https:// or https://.
fileSystemId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the file system.
description Changes to this property will trigger replacement. String
The description of the snapshot. It must be 2 to 256 characters in length and cannot start with https:// or https://.
retentionDays Changes to this property will trigger replacement. Integer
The retention period of the snapshot. Unit: days. Valid values:

  • -1: The default value. Auto snapshots are permanently retained. After the number of auto snapshots exceeds the upper limit, the earliest auto snapshot is automatically deleted.
snapshotName Changes to this property will trigger replacement. String
SnapshotName. It must be 2 to 128 characters in length and must start with a letter, but cannot start with https:// or https://.
fileSystemId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the file system.
description Changes to this property will trigger replacement. string
The description of the snapshot. It must be 2 to 256 characters in length and cannot start with https:// or https://.
retentionDays Changes to this property will trigger replacement. number
The retention period of the snapshot. Unit: days. Valid values:

  • -1: The default value. Auto snapshots are permanently retained. After the number of auto snapshots exceeds the upper limit, the earliest auto snapshot is automatically deleted.
snapshotName Changes to this property will trigger replacement. string
SnapshotName. It must be 2 to 128 characters in length and must start with a letter, but cannot start with https:// or https://.
file_system_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the file system.
description Changes to this property will trigger replacement. str
The description of the snapshot. It must be 2 to 256 characters in length and cannot start with https:// or https://.
retention_days Changes to this property will trigger replacement. int
The retention period of the snapshot. Unit: days. Valid values:

  • -1: The default value. Auto snapshots are permanently retained. After the number of auto snapshots exceeds the upper limit, the earliest auto snapshot is automatically deleted.
snapshot_name Changes to this property will trigger replacement. str
SnapshotName. It must be 2 to 128 characters in length and must start with a letter, but cannot start with https:// or https://.
fileSystemId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the file system.
description Changes to this property will trigger replacement. String
The description of the snapshot. It must be 2 to 256 characters in length and cannot start with https:// or https://.
retentionDays Changes to this property will trigger replacement. Number
The retention period of the snapshot. Unit: days. Valid values:

  • -1: The default value. Auto snapshots are permanently retained. After the number of auto snapshots exceeds the upper limit, the earliest auto snapshot is automatically deleted.
snapshotName Changes to this property will trigger replacement. String
SnapshotName. It must be 2 to 128 characters in length and must start with a letter, but cannot start with https:// or https://.

Outputs

All input properties are implicitly available as output properties. Additionally, the Snapshot resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Status string
The status of the snapshot.
Id string
The provider-assigned unique ID for this managed resource.
Status string
The status of the snapshot.
id String
The provider-assigned unique ID for this managed resource.
status String
The status of the snapshot.
id string
The provider-assigned unique ID for this managed resource.
status string
The status of the snapshot.
id str
The provider-assigned unique ID for this managed resource.
status str
The status of the snapshot.
id String
The provider-assigned unique ID for this managed resource.
status String
The status of the snapshot.

Look up Existing Snapshot Resource

Get an existing Snapshot resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: SnapshotState, opts?: CustomResourceOptions): Snapshot
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        description: Optional[str] = None,
        file_system_id: Optional[str] = None,
        retention_days: Optional[int] = None,
        snapshot_name: Optional[str] = None,
        status: Optional[str] = None) -> Snapshot
func GetSnapshot(ctx *Context, name string, id IDInput, state *SnapshotState, opts ...ResourceOption) (*Snapshot, error)
public static Snapshot Get(string name, Input<string> id, SnapshotState? state, CustomResourceOptions? opts = null)
public static Snapshot get(String name, Output<String> id, SnapshotState state, CustomResourceOptions options)
resources:  _:    type: alicloud:nas:Snapshot    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Description Changes to this property will trigger replacement. string
The description of the snapshot. It must be 2 to 256 characters in length and cannot start with https:// or https://.
FileSystemId Changes to this property will trigger replacement. string
The ID of the file system.
RetentionDays Changes to this property will trigger replacement. int
The retention period of the snapshot. Unit: days. Valid values:

  • -1: The default value. Auto snapshots are permanently retained. After the number of auto snapshots exceeds the upper limit, the earliest auto snapshot is automatically deleted.
SnapshotName Changes to this property will trigger replacement. string
SnapshotName. It must be 2 to 128 characters in length and must start with a letter, but cannot start with https:// or https://.
Status string
The status of the snapshot.
Description Changes to this property will trigger replacement. string
The description of the snapshot. It must be 2 to 256 characters in length and cannot start with https:// or https://.
FileSystemId Changes to this property will trigger replacement. string
The ID of the file system.
RetentionDays Changes to this property will trigger replacement. int
The retention period of the snapshot. Unit: days. Valid values:

  • -1: The default value. Auto snapshots are permanently retained. After the number of auto snapshots exceeds the upper limit, the earliest auto snapshot is automatically deleted.
SnapshotName Changes to this property will trigger replacement. string
SnapshotName. It must be 2 to 128 characters in length and must start with a letter, but cannot start with https:// or https://.
Status string
The status of the snapshot.
description Changes to this property will trigger replacement. String
The description of the snapshot. It must be 2 to 256 characters in length and cannot start with https:// or https://.
fileSystemId Changes to this property will trigger replacement. String
The ID of the file system.
retentionDays Changes to this property will trigger replacement. Integer
The retention period of the snapshot. Unit: days. Valid values:

  • -1: The default value. Auto snapshots are permanently retained. After the number of auto snapshots exceeds the upper limit, the earliest auto snapshot is automatically deleted.
snapshotName Changes to this property will trigger replacement. String
SnapshotName. It must be 2 to 128 characters in length and must start with a letter, but cannot start with https:// or https://.
status String
The status of the snapshot.
description Changes to this property will trigger replacement. string
The description of the snapshot. It must be 2 to 256 characters in length and cannot start with https:// or https://.
fileSystemId Changes to this property will trigger replacement. string
The ID of the file system.
retentionDays Changes to this property will trigger replacement. number
The retention period of the snapshot. Unit: days. Valid values:

  • -1: The default value. Auto snapshots are permanently retained. After the number of auto snapshots exceeds the upper limit, the earliest auto snapshot is automatically deleted.
snapshotName Changes to this property will trigger replacement. string
SnapshotName. It must be 2 to 128 characters in length and must start with a letter, but cannot start with https:// or https://.
status string
The status of the snapshot.
description Changes to this property will trigger replacement. str
The description of the snapshot. It must be 2 to 256 characters in length and cannot start with https:// or https://.
file_system_id Changes to this property will trigger replacement. str
The ID of the file system.
retention_days Changes to this property will trigger replacement. int
The retention period of the snapshot. Unit: days. Valid values:

  • -1: The default value. Auto snapshots are permanently retained. After the number of auto snapshots exceeds the upper limit, the earliest auto snapshot is automatically deleted.
snapshot_name Changes to this property will trigger replacement. str
SnapshotName. It must be 2 to 128 characters in length and must start with a letter, but cannot start with https:// or https://.
status str
The status of the snapshot.
description Changes to this property will trigger replacement. String
The description of the snapshot. It must be 2 to 256 characters in length and cannot start with https:// or https://.
fileSystemId Changes to this property will trigger replacement. String
The ID of the file system.
retentionDays Changes to this property will trigger replacement. Number
The retention period of the snapshot. Unit: days. Valid values:

  • -1: The default value. Auto snapshots are permanently retained. After the number of auto snapshots exceeds the upper limit, the earliest auto snapshot is automatically deleted.
snapshotName Changes to this property will trigger replacement. String
SnapshotName. It must be 2 to 128 characters in length and must start with a letter, but cannot start with https:// or https://.
status String
The status of the snapshot.

Import

File Storage (NAS) Snapshot can be imported using the id, e.g.

$ pulumi import alicloud:nas/snapshot:Snapshot example <id>
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.