CloudWiki
Resource

Snapshot

Microsoft Azure
Compute
An Azure Snapshot is a point-in-time copy of a virtual machine (VM) disk. It captures the contents of a disk at a specific moment and creates a read-only copy that can be used to restore or create new virtual machines. Azure Snapshots provide a way to create a backup of a virtual machine disk without having to shut down the virtual machine. They are incremental in nature, meaning that only the changes made to the original disk since the last snapshot are saved, reducing the storage required for each snapshot. Snapshots are stored in Azure Storage and can be used to create new virtual machines or to restore an existing virtual machine to a previous state. They can also be used to migrate virtual machines between Azure regions or to recover from data corruption or other system failures.‍
Terraform Name
terraform
azurerm_snapshot
Snapshot
attributes:

The following arguments are supported:

  • name - (Required) Specifies the name of the Snapshot resource. Changing this forces a new resource to be created.
  • resource_group_name - (Required) The name of the resource group in which to create the Snapshot. Changing this forces a new resource to be created.
  • location - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
  • create_option - (Required) Indicates how the snapshot is to be created. Possible values are Copy or Import.

Note:

One of source_uri, source_resource_id or storage_account_id must be specified.

  • source_uri - (Optional) Specifies the URI to a Managed or Unmanaged Disk. Changing this forces a new resource to be created.
  • source_resource_id - (Optional) Specifies a reference to an existing snapshot, when create_option is Copy. Changing this forces a new resource to be created.
  • storage_account_id - (Optional) Specifies the ID of an storage account. Used with source_uri to allow authorization during import of unmanaged blobs from a different subscription. Changing this forces a new resource to be created.
  • disk_size_gb - (Optional) The size of the Snapshotted Disk in GB.
  • encryption_settings - (Optional) A encryption_settings block as defined below.

NOTE:

Removing encryption_settings forces a new resource to be created.

  • incremental_enabled - (Optional) Specifies if the Snapshot is incremental.
  • tags - (Optional) A mapping of tags to assign to the resource.

The encryption_settings block supports:

  • disk_encryption_key - (Optional) A disk_encryption_key block as defined below.
  • key_encryption_key - (Optional) A key_encryption_key block as defined below.

The disk_encryption_key block supports:

  • secret_url - (Required) The URL to the Key Vault Secret used as the Disk Encryption Key. This can be found as id on the azurerm_key_vault_secret resource.
  • source_vault_id - (Required) The ID of the source Key Vault. This can be found as id on the azurerm_key_vault resource.

The key_encryption_key block supports:

  • key_url - (Required) The URL to the Key Vault Key used as the Key Encryption Key. This can be found as id on the azurerm_key_vault_key resource.
  • source_vault_id - (Required) The ID of the source Key Vault. This can be found as id on the azurerm_key_vault resource.

Associating resources with a
Snapshot
Resources do not "belong" to a
Snapshot
Rather, one or more Security Groups are associated to a resource.
Create
Snapshot
via Terraform:
The following HCL manages a disk snapshot
Syntax:

resource "azurerm_resource_group" "example" {
 name     = "snapshot-rg"
 location = "West Europe"
}

resource "azurerm_managed_disk" "example" {
 name                 = "managed-disk"
 location             = azurerm_resource_group.example.location
 resource_group_name  = azurerm_resource_group.example.name
 storage_account_type = "Standard_LRS"
 create_option        = "Empty"
 disk_size_gb         = "10"
}

resource "azurerm_snapshot" "example" {
 name                = "snapshot"
 location            = azurerm_resource_group.example.location
 resource_group_name = azurerm_resource_group.example.name
 create_option       = "Copy"
 source_uri          = azurerm_managed_disk.example.id
}

Create
Snapshot
via CLI:
Parametres:

az snapshot create --name
                  --resource-group
                  [--accelerated-network {false, true}]
                  [--architecture {Arm64, x64}]
                  [--copy-start {false, true}]
                  [--disk-access]
                  [--disk-encryption-set]
                  [--edge-zone]
                  [--encryption-type {EncryptionAtRestWithCustomerKey, EncryptionAtRestWithPlatformAndCustomerKeys, EncryptionAtRestWithPlatformKey}]
                  [--for-upload {false, true}]
                  [--hyper-v-generation {V1, V2}]
                  [--incremental {false, true}]
                  [--location]
                  [--network-access-policy {AllowAll, AllowPrivate, DenyAll}]
                  [--no-wait]
                  [--public-network-access {Disabled, Enabled}]
                  [--size-gb]
                  [--sku {Premium_LRS, Standard_LRS, Standard_ZRS}]
                  [--source]
                  [--source-storage-account-id]
                  [--tags]

Example:

az snapshot create -g MyResourceGroup -n MySnapshot2 --source MyDisk

aws cost
Costs
Direct Cost
Indirect Cost
No items found.
Best Practices for
Snapshot

Categorized by Availability, Security & Compliance and Cost

Low
Access allowed from VPN
No items found.
Low
Auto Scaling Group not in use
No items found.
Medium
Connections towards DynamoDB should be via VPC endpoints
No items found.
Medium
Container in CrashLoopBackOff state
No items found.
Low
EC2 with GPU capabilities
No items found.
Medium
EC2 with high privileged policies
No items found.
Medium
ECS cluster delete alarm
No items found.
Critical
ECS task with Admin access (*:*)
Medium
ECS task with high privileged policies
No items found.
Critical
EKS cluster delete alarm
No items found.
Medium
ElastiCache cluster delete alarm
No items found.
Medium
Ensure Container liveness probe is configured
No items found.
Medium
Ensure ECS task definition has memory limit
No items found.
Critical
Ensure EMR cluster master nodes are not publicly accessible
No items found.
More from
Microsoft Azure