gcloud backup-dr backup-plans update (BACKUP_PLAN : --location=LOCATION) [--add-backup-rule=[PROPERTY=VALUE,…]] [--async] [--backup-rule=[PROPERTY=VALUE,…]] [--backup-rules-from-file=PATH_TO_FILE] [--compute-instance-properties=[PROPERTY=VALUE,…]] [--description=DESCRIPTION] [--disk-properties=[PROPERTY=VALUE,…]] [--max-custom-on-demand-retention-days=MAX_CUSTOM_ON_DEMAND_RETENTION_DAYS] [--remove-backup-rule=RULE-ID] [GCLOUD_WIDE_FLAG …]
sample-backup-plan in project
sample-project, at location
us-central1:
run:
gcloud backup-dr backup-plans update sample-backup-plan --project=sample-project --location=us-central1 --backup-rule <BACKUP-RULE> --backup-rule <BACKUP-RULE> --description "This is a sample backup plan"
To add backup rules to an existing backup plan
in project
sample-backup-plan, at location
sample-project:
us-central1
run:
gcloud backup-dr backup-plans update sample-backup-plan --project=sample-project --location=us-central1 --add-backup-rule <BACKUP-RULE> --add-backup-rule <BACKUP-RULE>
To remove a backup rule with id
from an existing backup
plan sample-daily-rule in project
sample-backup-plan, at location
sample-project:
us-central1
run:
gcloud backup-dr backup-plans update sample-backup-plan --project=sample-project --location=us-central1 --remove-backup-rule sample-daily-rule
To override backup rules in an existing backup plan
in project
sample-backup-plan, at location
sample-project, pass a file 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.
us-central1
run:
gcloud backup-dr backup-plans update sample-backup-plan --project=sample-project --location=us-central1 --backup-rules-fom-file <FILE_PATH>Backup Rule Examples:
1. 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
<BACKUP-RULE>: 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:
2. Daily backup rule with daily backup frequency of 6 hours and store it for 7 days
<BACKUP-RULE>: rule-id=sample-daily-rule,retention-days=7,recurrence=DAILY,backup-window-start=1,backup-window-end=14
Properties:
3. Weekly backup rule with weekly backup frequency on every MONDAY & FRIDAY and store it for 21 days
<BACKUP-RULE>: rule-id=sample-weekly-rule,retention-days=21,recurrence=WEEKLY,days-of-week="MONDAY FRIDAY",backup-window-start=10,backup-window-end=20
Properties:
YAML and JSON file examples:
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" } ] }
To set the project attribute:
backup_plan on the command line with a fully
specified name;
--project on the command line;
core/project.
BACKUP_PLAN
To set the name attribute:
backup_plan on the command line.
--location=LOCATIONlocation attribute:
backup_plan on the command line with a fully
specified name;
--location on the command line.
--add-backup-rule=[PROPERTY=VALUE,…]--asyncTrue. Enabled by default, use
--no-async to disable.
--backup-rule=[PROPERTY=VALUE,…]rule-idretention-daysrecurrencebackup-window-startbackup-window-endSKIPPED if they do not start by the end time. Jobs that are in
progress will not be canceled at the end time.
time-zonehourly-frequencydays-of-weekdays-of-monthmonthsweek-day-of-month--backup-rules-from-file=PATH_TO_FILE--compute-instance-properties=[PROPERTY=VALUE,…]guest-flush--description=DESCRIPTION--disk-properties=[PROPERTY=VALUE,…]guest-flush--max-custom-on-demand-retention-days=MAX_CUSTOM_ON_DEMAND_RETENTION_DAYS--remove-backup-rule=RULE-ID--access-token-file,
--account, --billing-project,
--configuration,
--flags-file,
--flatten, --format, --help, --impersonate-service-account,
--log-http,
--project, --quiet, --trace-token, --user-output-enabled,
--verbosity.
Run $ gcloud help for details.
gcloud alpha backup-dr backup-plans updategcloud beta backup-dr backup-plans update
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-05-27 UTC.