copyright | lastupdated | keywords | subcollection | ||
---|---|---|---|---|---|
|
2024-07-22 |
backup for VPC, backup service, backup plan, backup policy, restore, restore volume, restore data |
vpc |
{{site.data.keyword.attribute-definition-list}}
{: #backup-use-policies}
Apply backup policies by adding user tags to new or existing volumes. When these tags match a backup policy tag, a backup is created. {: shortdesc}
Up to 100 tags can be attached or detached in the same operation. Keeping the number of tags low can make it easier to track their usage and your backups.
{: #backup-gen-proc-tags}
- Create a backup policy and plan.
- Find the resources that you want to back up.
- Apply backup policy tags to your target volumes, or virtual server instances in the console.{: ui}
- Apply backup policy tags to your target volumes, or virtual server instances from the CLI.{: cli}
- Apply backup policy tags to your target volumes, or virtual server instances with the API.{: api}
- Apply backup policy tags to your target volumes, or virtual server instances with Terraform.{: terraform}
- Verify that your selected resource is associated with a backup policy. For more information, see View a list of resources that have a backup policy.
{: #backup-apply-tags-ui} {: ui}
Apply tags to new or existing volumes, virtual server instances in any of these ways:
- Add tags to volumes directly from the volumes list views by using the tags column.
- Add tags from the volume details pages.
- Add user tags to volumes during instance provisioning.
{: #backup-tags-volumes-list-ui}
- Go to the list of volumes.
- Locate an available volume. In the Tags column, volumes with tags show a number that indicates the tags that are already applied. You can view the tags by clicking the number link. Volumes without tags have an Add tags link.
- Click Add tags.
- In the new window, type a tag in the User tags text box.
- Click Save.
{: #backup-tags-vol-details}
- Go to the list of volumes.
- Click the name of a volume in the list.
- On the volume details page, click the Edit icon next to the {{site.data.keyword.block_storage_is_short}} volume name.
- In the new window, type a tag in the User tags text box.
- Click Save.
{: #backup-apply-tags-volumes-cli} {: cli}
{: ##backup-apply-tags-volumes-cli-prereq}
Before you can use the CLI, you must install the IBM Cloud CLI and the VPC CLI plug-in. For more information, see the CLI prerequisites. {: requirement}
Log in to the IBM Cloud.
ibmcloud login --sso -a cloud.ibm.com
{: pre}
This command returns a URL and prompts for a passcode. Go to that URL in your browser and log in. If successful, you get a one-time passcode. Copy this passcode and paste it as a response on the prompt. After successful authentication, you are prompted to choose your account. If you have access to multiple accounts, select the account that you want to log in as. Respond to any remaining prompts to finish logging in.
{: #backup-apply-tags-cli}
Issue the ibmcloud is volume-update VOLUME
command with the --tags
option to update the user tags of a volume. The volume argument can be defined by either the volume ID or the volume name.
Use the same option to add tags to a volume when you create a volume by using ibmcloud is volume-create
.
{: tip}
The following example adds user tags env:test
and bkp:test
to a volume identified by ID. The output shows information such as name, status, capacity, performance profile, and location. The updated tags appear at the end of the response.
cloudshell:~$ ibmcloud is volume-update r010-bdb8fc70-8afb-4622-826a-d65a9fc477a4 --tags env:test,bkp:test,bcp:test
Updating volume r010-bdb8fc70-8afb-4622-826a-d65a9fc477a4 under account Test Account as user [email protected]...
ID r010-bdb8fc70-8afb-4622-826a-d65a9fc477a4
Name my-bootable-snapshot-restore-21
CRN crn:v1:bluemix:public:is:eu-de-2:a/a1234567::volume:r010-bdb8fc70-8afb-4622-826a-d65a9fc477a4
Status available
Capacity 100
IOPS 3000
Bandwidth(Mbps) 393
Profile general-purpose
Encryption key -
Encryption provider_managed
Resource group defaults
Created 2023-02-23T18:52:00+00:00
Zone eu-de-2
Health State ok
Volume Attachment Instance Reference -
Source snapshot ID Name
r138-92c3efcb-4588-4c9c-828b-c52836629954 my-bootable-snapshot
Operating system CentOS 7.x - Minimal Install (amd64)
Source image ID Name
r010-067bd38b-7ddd-49d9-a7f3-6e0a798e0554 ibm-centos-7-9-minimal-amd64-5
Active false
Busy false
Tags env:test,bkp:test,bcp:test
{: screen}
{: #backup-apply-tags-volumes-api} {: api}
To apply tags to a {{site.data.keyword.block_storage_is_short}} volume, follow these steps:
-
Make a
GET /volumes/{volume_id}
call and copy the hash string from theEtag
property in the response header. You need to use the hash string when you specifyIf-Match
in thePATCH /volumes/{volume_id}
request to create user tags for the volume in step 2. To generate the response header information, make an API call similar to the following example:curl -sSL -D GET\ "https://us-south.iaas.cloud.ibm.com/v1/volumes/{volume_id}?version=2022-04-25&generation=2"\ -H "Authorization: Bearer $TOKEN" -o /dev/null
{: pre}
In the response header, you see something like this:
HTTP/2 200 date: Tue, 28 Apr 2022 17:48:03 GMT content-type: application/json; charset=utf-8 content-length: 1049 cf-ray: 69903d250c4966ef-DFW cache-control: max-age=0, no-cache, no-store, must-revalidate expires: -1 strict-transport-security: max-age=31536000; includeSubDomains cf-cache-status: DYNAMIC expect-ct: max-age=604800, report-uri="[uri...]" pragma: no-cache x-content-type-options: nosniff x-request-id: 1fbe2384-6828-4503-ae7d-050426d1b11b x-xss-protection: 1; mode=block server: cloudflare etag: W/xxxyyyzzz123
{: codeblock}
-
Make a
PATCH /volumes/{volume_id}
request. Specify the Etag-hash-string for theIf-Match
property in the header. Specify the user tag in theuser_tags
property.You can also add tags when you make a
POST /volumes
call to create a volume and specify theuser_tags
property. {: tip}This example updates the volume by specifying user tags
env:test
andenv:prod
. The value that you obtained from theEtag
parameter is specified in theIf-Match
header in the call.curl -X PATCH\ "$vpc_api_endpoint/v1/volumes/50fda9c3-eecd-4152-b473-a98018ccfb10?version=2022-04-25&generation=2"\ -H "Authorization: Bearer"\ -H "If-Match: <_Etag-hash-string_>"\ -d `{ "user_tags": [ "env:test", "env:prod" ] }'
{: codeblock}
The response shows the tags that were added to the volume:
{ "id":"50fda9c3-eecd-4152-b473-a98018ccfb10", "crn": "crn:[...]", "name":"my-volume-update1", "href":"https://us-south.iaas.cloud.ibm/v1/volumes/50fda9c3-eecd-4152-b473-a98018ccfb10", "capacity":50, "iops":100, "encryption":"provider_managed", "status":"pending", "zone":{ "name":"us-south-1", "href":"https://us-south.iaas.cloud.ibm/v1/regions/us-south/zones/us-south-1" }, "profile":{ "name":"custom", "href":"https://us-south.iaas.cloud.ibm/v1/volume/profiles/custom" }, "resource_group":{ "id":"4bbce614c13444cd8fc5e7e878ef8e21", "href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/4bbce614c13444cd8fc5e7e878ef8e21", "name":"Default" }, "volume_attachments":[], "created_at":"2022-04-28T17:46:17.000Z", "status_reasons":[], "active":false, "busy":false, "bandwidth":128, "user_tags":[ "env:test", "env:prod" ] }
{: codeblock}
{: #backup-apply-tags-volumes-terraform} {: terraform}
To use Terraform, download the Terraform CLI and configure the {{site.data.keyword.cloud_notm}} Provider plug-in. For more information, see Getting started with Terraform. {: requirement}
VPC infrastructure services use a specific regional endpoint, which targets to us-south
by default. If your VPC is created in another region, make sure to target the appropriate region in the provider block in the provider.tf
file.
See the following example of targeting a region other than the default us-south
.
provider "ibm" {
region = "eu-de"
}
{: screen}
To apply user tags to a volume, use the ibm_is_volume
resource. The following example specifies the volume r010-bdb8fc70-8afb-4622-826a-d65a9fc477a4
and the tags env:test
, bkp:test
, and bcp:test
to be attached to the volume.
resource "ibm_is_volume" "example" {
name = "example-volume"
profile = "10iops-tier"
zone = "us-south-1"
tags = ["dev:test"]
}
{: codeblock}
For more information about the arguments and attributes, see ibm_is_volume{: external}.
{: #backup-next-steps-use}