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
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.
Create a Snapshot Resource
new Snapshot(name: string, args: SnapshotArgs, opts?: CustomResourceOptions);def Snapshot(resource_name, opts=None, description=None, labels=None, name=None, project=None, snapshot_encryption_key=None, source_disk=None, source_disk_encryption_key=None, zone=None, __props__=None);func NewSnapshot(ctx *Context, name string, args SnapshotArgs, opts ...ResourceOption) (*Snapshot, error)public Snapshot(string name, SnapshotArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args SnapshotArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args SnapshotArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SnapshotArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
Snapshot Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The Snapshot resource accepts the following input properties:
- Source
Disk string A reference to the disk used to create this snapshot.
- Description string
An optional description of this resource.
- Labels Dictionary<string, string>
Labels to apply to this Snapshot.
- Name string
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.- Project string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Snapshot
Encryption SnapshotKey Snapshot Encryption Key Args 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.
- Source
Disk SnapshotEncryption Key Source Disk Encryption Key Args 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.
- Zone string
A reference to the zone where the disk is hosted.
- Source
Disk string A reference to the disk used to create this snapshot.
- Description string
An optional description of this resource.
- Labels map[string]string
Labels to apply to this Snapshot.
- Name string
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.- Project string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Snapshot
Encryption SnapshotKey Snapshot Encryption Key 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.
- Source
Disk SnapshotEncryption Key Source Disk Encryption Key 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.
- Zone string
A reference to the zone where the disk is hosted.
- source
Disk string A reference to the disk used to create this snapshot.
- description string
An optional description of this resource.
- labels {[key: string]: string}
Labels to apply to this Snapshot.
- name string
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.- project string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- snapshot
Encryption SnapshotKey Snapshot Encryption Key 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.
- source
Disk SnapshotEncryption Key Source Disk Encryption Key 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.
- zone string
A reference to the zone where the disk is hosted.
- source_
disk str A reference to the disk used to create this snapshot.
- description str
An optional description of this resource.
- labels Dict[str, str]
Labels to apply to this Snapshot.
- name str
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.- project str
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- snapshot_
encryption_ Dict[Snapshotkey Snapshot Encryption Key] 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.
- source_
disk_ Dict[Snapshotencryption_ key Source Disk Encryption Key] 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.
- zone str
A reference to the zone where the disk is hosted.
Outputs
All input properties are implicitly available as output properties. Additionally, the Snapshot resource produces the following output properties:
- Creation
Timestamp string Creation timestamp in RFC3339 text format.
- Disk
Size intGb Size of the snapshot, specified in GB.
- Id string
- The provider-assigned unique ID for this managed resource.
- Label
Fingerprint string The fingerprint used for optimistic locking of this resource. Used internally during updates.
- Licenses List<string>
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.
- Self
Link string The URI of the created resource.
- Snapshot
Id int The unique identifier for the resource.
- Source
Disk stringLink - Storage
Bytes int A size of the storage used by the snapshot. As snapshots share storage, this number is expected to change with snapshot creation/deletion.
- Creation
Timestamp string Creation timestamp in RFC3339 text format.
- Disk
Size intGb Size of the snapshot, specified in GB.
- Id string
- The provider-assigned unique ID for this managed resource.
- Label
Fingerprint string The fingerprint used for optimistic locking of this resource. Used internally during updates.
- Licenses []string
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.
- Self
Link string The URI of the created resource.
- Snapshot
Id int The unique identifier for the resource.
- Source
Disk stringLink - Storage
Bytes int A size of the storage used by the snapshot. As snapshots share storage, this number is expected to change with snapshot creation/deletion.
- creation
Timestamp string Creation timestamp in RFC3339 text format.
- disk
Size numberGb Size of the snapshot, specified in GB.
- id string
- The provider-assigned unique ID for this managed resource.
- label
Fingerprint string The fingerprint used for optimistic locking of this resource. Used internally during updates.
- licenses string[]
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.
- self
Link string The URI of the created resource.
- snapshot
Id number The unique identifier for the resource.
- source
Disk stringLink - storage
Bytes number A size of the storage used by the snapshot. As snapshots share storage, this number is expected to change with snapshot creation/deletion.
- creation_
timestamp str Creation timestamp in RFC3339 text format.
- disk_
size_ floatgb Size of the snapshot, specified in GB.
- id str
- The provider-assigned unique ID for this managed resource.
- label_
fingerprint str The fingerprint used for optimistic locking of this resource. Used internally during updates.
- licenses List[str]
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.
- self_
link str The URI of the created resource.
- snapshot_
id float The unique identifier for the resource.
- source_
disk_ strlink - storage_
bytes float A size of the storage used by the snapshot. As snapshots share storage, this number is expected to change with snapshot creation/deletion.
Look up an 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): Snapshotstatic get(resource_name, id, opts=None, creation_timestamp=None, description=None, disk_size_gb=None, label_fingerprint=None, labels=None, licenses=None, name=None, project=None, self_link=None, snapshot_encryption_key=None, snapshot_id=None, source_disk=None, source_disk_encryption_key=None, source_disk_link=None, storage_bytes=None, zone=None, __props__=None);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)- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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:
- Creation
Timestamp string Creation timestamp in RFC3339 text format.
- Description string
An optional description of this resource.
- Disk
Size intGb Size of the snapshot, specified in GB.
- Label
Fingerprint string The fingerprint used for optimistic locking of this resource. Used internally during updates.
- Labels Dictionary<string, string>
Labels to apply to this Snapshot.
- Licenses List<string>
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.
- Name string
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.- Project string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Self
Link string The URI of the created resource.
- Snapshot
Encryption SnapshotKey Snapshot Encryption Key Args 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.
- Snapshot
Id int The unique identifier for the resource.
- Source
Disk string A reference to the disk used to create this snapshot.
- Source
Disk SnapshotEncryption Key Source Disk Encryption Key Args 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.
- Source
Disk stringLink - Storage
Bytes int A size of the storage used by the snapshot. As snapshots share storage, this number is expected to change with snapshot creation/deletion.
- Zone string
A reference to the zone where the disk is hosted.
- Creation
Timestamp string Creation timestamp in RFC3339 text format.
- Description string
An optional description of this resource.
- Disk
Size intGb Size of the snapshot, specified in GB.
- Label
Fingerprint string The fingerprint used for optimistic locking of this resource. Used internally during updates.
- Labels map[string]string
Labels to apply to this Snapshot.
- Licenses []string
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.
- Name string
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.- Project string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Self
Link string The URI of the created resource.
- Snapshot
Encryption SnapshotKey Snapshot Encryption Key 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.
- Snapshot
Id int The unique identifier for the resource.
- Source
Disk string A reference to the disk used to create this snapshot.
- Source
Disk SnapshotEncryption Key Source Disk Encryption Key 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.
- Source
Disk stringLink - Storage
Bytes int A size of the storage used by the snapshot. As snapshots share storage, this number is expected to change with snapshot creation/deletion.
- Zone string
A reference to the zone where the disk is hosted.
- creation
Timestamp string Creation timestamp in RFC3339 text format.
- description string
An optional description of this resource.
- disk
Size numberGb Size of the snapshot, specified in GB.
- label
Fingerprint string The fingerprint used for optimistic locking of this resource. Used internally during updates.
- labels {[key: string]: string}
Labels to apply to this Snapshot.
- licenses string[]
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.
- name string
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.- project string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- self
Link string The URI of the created resource.
- snapshot
Encryption SnapshotKey Snapshot Encryption Key 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.
- snapshot
Id number The unique identifier for the resource.
- source
Disk string A reference to the disk used to create this snapshot.
- source
Disk SnapshotEncryption Key Source Disk Encryption Key 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.
- source
Disk stringLink - storage
Bytes number A size of the storage used by the snapshot. As snapshots share storage, this number is expected to change with snapshot creation/deletion.
- zone string
A reference to the zone where the disk is hosted.
- creation_
timestamp str Creation timestamp in RFC3339 text format.
- description str
An optional description of this resource.
- disk_
size_ floatgb Size of the snapshot, specified in GB.
- label_
fingerprint str The fingerprint used for optimistic locking of this resource. Used internally during updates.
- labels Dict[str, str]
Labels to apply to this Snapshot.
- licenses List[str]
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.
- name str
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.- project str
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- self_
link str The URI of the created resource.
- snapshot_
encryption_ Dict[Snapshotkey Snapshot Encryption Key] 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.
- snapshot_
id float The unique identifier for the resource.
- source_
disk str A reference to the disk used to create this snapshot.
- source_
disk_ Dict[Snapshotencryption_ key Source Disk Encryption Key] 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.
- source_
disk_ strlink - storage_
bytes float A size of the storage used by the snapshot. As snapshots share storage, this number is expected to change with snapshot creation/deletion.
- zone str
A reference to the zone where the disk is hosted.
Supporting Types
SnapshotSnapshotEncryptionKey
- Raw
Key string Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. Note: This property is sensitive and will not be displayed in the plan.
- Sha256 string
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key that protects this resource.
- Raw
Key string Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. Note: This property is sensitive and will not be displayed in the plan.
- Sha256 string
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key that protects this resource.
- raw
Key string Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. Note: This property is sensitive and will not be displayed in the plan.
- sha256 string
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key that protects this resource.
- raw
Key str Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. Note: This property is sensitive and will not be displayed in the plan.
- sha256 str
- The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key that protects this resource.
SnapshotSourceDiskEncryptionKey
Package Details
- Repository
- https://github.com/pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
google-betaTerraform Provider.