Class Snapshot
Represents a Persistent Disk Snapshot resource.
Use snapshots to back up data from your persistent disks. Snapshots are different from public images and custom images, which are used primarily to create instances or configure instance templates. Snapshots are useful for periodic backup of the data on your persistent disks. You can create snapshots from persistent disks even while they are attached to running instances.
Snapshots are incremental, so you can create regular snapshots on a persistent disk faster and at a much lower cost than if you regularly created a full image of the disk.
To get more information about Snapshot, see:
- API documentation
- How-to Guides
- Official Documentation
Warning: All arguments including
snapshot_encryption_key.raw_keyandsource_disk_encryption_key.raw_keywill be stored in the raw state as plain-text. Read more about secrets in state.
Example Usage - Snapshot Basic
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var debian = Output.Create(Gcp.Compute.GetImage.InvokeAsync(new Gcp.Compute.GetImageArgs
{
Family = "debian-9",
Project = "debian-cloud",
}));
var persistent = new Gcp.Compute.Disk("persistent", new Gcp.Compute.DiskArgs
{
Image = debian.Apply(debian => debian.SelfLink),
Size = 10,
Type = "pd-ssd",
Zone = "us-central1-a",
});
var snapshot = new Gcp.Compute.Snapshot("snapshot", new Gcp.Compute.SnapshotArgs
{
SourceDisk = persistent.Name,
Zone = "us-central1-a",
Labels =
{
{ "my_label", "value" },
},
});
}
}
Inherited Members
Namespace: Pulumi.Gcp.Compute
Assembly: Pulumi.Gcp.dll
Syntax
public class Snapshot : CustomResource
Constructors
View SourceSnapshot(String, SnapshotArgs, CustomResourceOptions)
Create a Snapshot resource with the given unique name, arguments, and options.
Declaration
public Snapshot(string name, SnapshotArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| SnapshotArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceCreationTimestamp
Creation timestamp in RFC3339 text format.
Declaration
public Output<string> CreationTimestamp { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Description
An optional description of this resource.
Declaration
public Output<string> Description { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
DiskSizeGb
Size of the snapshot, specified in GB.
Declaration
public Output<int> DiskSizeGb { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Int32> |
LabelFingerprint
The fingerprint used for optimistic locking of this resource. Used internally during updates.
Declaration
public Output<string> LabelFingerprint { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Labels
Labels to apply to this Snapshot.
Declaration
public Output<ImmutableDictionary<string, string>> Labels { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.String>> |
Licenses
A list of public visible licenses that apply to this snapshot. This can be because the original image had licenses attached (such as a Windows image). snapshotEncryptionKey nested object Encrypts the snapshot using a customer-supplied encryption key.
Declaration
public Output<ImmutableArray<string>> Licenses { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<System.String>> |
Name
Name of the resource; provided by the client when the resource is
created. The name must be 1-63 characters long, and comply with
RFC1035. Specifically, the name must be 1-63 characters long and match
the regular expression a-z? which means the
first character must be a lowercase letter, and all following
characters must be a dash, lowercase letter, or digit, except the last
character, which cannot be a dash.
Declaration
public Output<string> Name { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Project
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
Declaration
public Output<string> Project { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
SelfLink
The URI of the created resource.
Declaration
public Output<string> SelfLink { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
SnapshotEncryptionKey
The customer-supplied encryption key of the snapshot. Required if the source snapshot is protected by a customer-supplied encryption key. Structure is documented below.
Declaration
public Output<SnapshotSnapshotEncryptionKey> SnapshotEncryptionKey { get; }
Property Value
| Type | Description |
|---|---|
| Output<SnapshotSnapshotEncryptionKey> |
SnapshotId
The unique identifier for the resource.
Declaration
public Output<int> SnapshotId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Int32> |
SourceDisk
A reference to the disk used to create this snapshot.
Declaration
public Output<string> SourceDisk { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
SourceDiskEncryptionKey
The customer-supplied encryption key of the source snapshot. Required if the source snapshot is protected by a customer-supplied encryption key. Structure is documented below.
Declaration
public Output<SnapshotSourceDiskEncryptionKey> SourceDiskEncryptionKey { get; }
Property Value
| Type | Description |
|---|---|
| Output<SnapshotSourceDiskEncryptionKey> |
SourceDiskLink
Declaration
public Output<string> SourceDiskLink { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
StorageBytes
A size of the the storage used by the snapshot. As snapshots share storage, this number is expected to change with snapshot creation/deletion.
Declaration
public Output<int> StorageBytes { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Int32> |
Zone
A reference to the zone where the disk is hosted.
Declaration
public Output<string> Zone { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, SnapshotState, CustomResourceOptions)
Get an existing Snapshot resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static Snapshot Get(string name, Input<string> id, SnapshotState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| SnapshotState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| Snapshot |