This page explains how to edit and manage existing backup plans for vaulted resources. For a description of what backup plans are and how they are used, see Backup plans in the Google Cloud console. To create a backup plan, see Create a backup plan for vaulted resources.
Edit a backup plan
Use the following instructions to edit an existing backup plan for vaulted resources.
Console
In the Google Cloud console, go to the Backup and DR Backup plans page.
Select the backup plan that you want to edit, or check its box and click the
icon.Click Edit.
You can edit the Backup plan description for the backup plan.
You can add a new rule Add rule by clicking Add Rule.
In the Add a backup rule pane, enter your backup rule information and click Save.
- Name your backup rule: Enter a name for the backup rule.
- Choose when to create backups: Specify the recurrence and frequency of the backup.
- Window: Select the Timezone, Start time, and Endtime for the backup job.
- Choose how long backups are kept before they are deleted: Enter the duration in days that the backups should be retained before they are deleted. Note that this value must be equal to or greater than the backup vault minimum enforced retention period.
You can also edit an existing rule or remove a rule from the backup plan by clicking the icons at the end of the rule row.
Click Save Changes.
gcloud
Update a specific backup plan in the project. A backup plan can only be updated in regions supported by Backup and DR Service.
gcloud backup-dr backup-plans update BACKUP_PLAN_NAME \ --project=PROJECT_ID\ --location=LOCATION \ --description=DESCRIPTION \ --backup-rule=BACKUP_RULE \ --add-backup-rule=ADD_BACKUP_RULE \ --remove-backup-rule=REMOVE_BACKUP_RULE
Replace the following:
BACKUP_PLAN_NAME
: the name of the backup plan.PROJECT_ID
: the name of the project where you want to create the backup plan.LOCATION
: the location where you want to create the backup plan.DESCRIPTION
: the updated description of the backup plan.BACKUP_RULE
: Full definition of an existing backup rule with updated values.ADD_BACKUP_RULE
: Parameters of the backup rule to be added to the backup plan. This flag can be repeated to add more backup rules.REMOVE_BACKUP_RULE
: The existing backup rule to be removed from the backup plan.
Example: To update two backup rules and description of an existing backup plan sample-backup-plan in project sample-project, at location us-central1:
Run:
gcloud alpha backup-dr backup-plans update sample-backup-plan \ --project=sample-project --location=us-central1 \ --backup-rule=BACKUP_RULE \ --add-backup-rule=ADD_BACKUP_RULE \ --description "This is a sample backup plan"
Example: To add backup rules to an existing backup plan sample-backup-plan in project sample-project, at location us-central1:
Run:
gcloud alpha backup-dr backup-plans update sample-backup-plan \ --project=sample-project --location=us-central1 \ --add-backup-rule BACKUP_RULE_1 --add-backup-rule BACKUP_RULE_2
Example: To remove a backup rule with ID sample-daily-rule from an existing backup plan sample-backup-plan in project sample-project, at location us-central1:
Run:
gcloud alpha backup-dr backup-plans update sample-backup-plan \ --project=sample-project --location=us-central1 \ --remove-backup-rule sample-daily-rule
Example: To override backup rules in an existing backup plan sample-backup-plan in project sample-project, at location us-central1, pass a path containing backup rules in YAML or JSON format: This flag is mutually exclusive with --add-backup-rule, --remove-backup-rule and --backup-rule flags.
Run:
gcloud alpha backup-dr backup-plans update sample-backup-plan \ --project=sample-project --location=us-central1 \ --backup-rules-from-file (FILE_PATH)
Examples of filling in BACKUP_RULE details
Properties in these examples:
RULE_NAME
: the name of the backup rule.BACKUP_RETENTION
: the retention period of the backup. Note that the backup retention period must be equal to or greater than the backup vault enforced minimum retention period.RECURRENCE
: the frequency at which backups to be created. It can be hourly, daily, weekly, monthly, or yearly.HOURS
: the frequency of the hourly backups. Specify this value only if you set the recurrence to hourly. The minimum hourly is always set to six hours.TIME_ZONE
: the time zone for the backup plan, such as UTC. Use the IANA time zone format to include the timezone for the backup plan.START_TIME
: the start time is the hour of the day in a 24 hour format. The start time must be before the end time and is inclusive for the backup window.END_TIME
: the end time is the hour of the day in a 24 hour format. The end time must be after the start time and is exclusive for the backup window.
Example: Hourly backup rule with hourly backup frequency of 6 hours and store it for 30 days, and expect the backups to run only between 10:00 to 20:00 UTC
rule-id=sample-hourly-rule,retention-days=30,recurrence=HOURLY,hourly-frequency=6,time-zone=UTC,backup-window-start=10,backup-window-end=20 Properties for this example: rule-id = "sample-hourly-rule" \ retention-days = 30 \ recurrence = HOURLY \ hourly-frequency = 6 \ time-zone = UTC \ backup-window-start = 10 \ backup-window-end = 20
Example: Daily backup rule with daily backup frequency of 6 hours and store it for 7 days
rule-id=sample-daily-rule,retention-days=7,recurrence=DAILY,backup-window-start=1,backup-window-end=14 Properties for this example: rule-id = "sample-daily-rule" \ retention-days = 7 \ recurrence = DAILY \ backup-window-start = 1 \ backup-window-end = 14
YAML file example:
backup-rules: - rule-id: weekly-rule retention-days: 7 recurrence: WEEKLY backup-window-start: 0 backup-window-end: 23 days-of-week: [MONDAY, TUESDAY] time-zone: UTC - rule-id: daily-rule retention-days: 1 recurrence: DAILY backup-window-start: 1 backup-window-end: 24 time-zone: UTC
JSON file example:
{ "backup-rules": [ { "rule-id": "weekly-rule", "retention-days": 7, "recurrence": "WEEKLY", "backup-window-start": 0, "backup-window-end": 23, "days-of-week": ["MONDAY", "TUESDAY"], "time-zone": "UTC" }, { "rule-id": "daily-rule", "retention-days": 1, "recurrence": "DAILY", "backup-window-start": 1, "backup-window-end": 24, "time-zone": "UTC" } ] }
Run $ Google Cloud CLI help for details.
View revisions of a backup plan
You can only review revisions to backup plans using Google Cloud CLI.
gcloud
To list the revisions to a backup plan:
gcloud alpha backup-dr backup-plan-revisions list \ --backup-plan=BACKUP_PLAN --location=LOCATION \
Replace the following:
BACKUP_PLAN
: the name of the edited backup plan.LOCATION
: the location of the edited backup plan.
Example: To list all backup plan revisions for a backup plan my-backup-plan in location us-central1, run:
gcloud alpha backup-dr backup-plan-revisions list \ --backup-plan=my-backup-plan --location=us-central1