gcloud alpha backup-dr backup-plans create Stay organized with collections Save and categorize content based on your preferences.
- NAME
- gcloud alpha backup-dr backup-plans create - creates a new Backup Plan
- SYNOPSIS
gcloud alpha backup-dr backup-plans create(BACKUP_PLAN:--location=LOCATION)--backup-rule=[PROPERTY=VALUE,…]--backup-vault=BACKUP_VAULT--resource-type=RESOURCE_TYPE[--async][--description=DESCRIPTION][--labels=[KEY=VALUE,…]][--max-custom-on-demand-retention-days=MAX_CUSTOM_ON_DEMAND_RETENTION_DAYS][GCLOUD_WIDE_FLAG …]
- DESCRIPTION
(ALPHA)Create a new backup plan in the project. It can only becreated in locations where Backup and DR is available.- EXAMPLES
- To create a new backup plan
in projectsample-backup-plan, at locationsample-project, with resource-typeus-central1and backup-vaultcompute.<UNIVERSE_DOMAIN>.com/Instancewith 2backup-rules:backup-vaultrun:
gcloudalphabackup-drbackup-planscreatesample-backup-plan--project=sample-project--location=us-central1--resource-type'compute.<UNIVERSE_DOMAIN>.com/Instance'--backup-vault<BACKUP-VAULT>--backup-rule<BACKUP-RULE>--backup-rule<BACKUP-RULE>Backup Rule Examples:
1. Hourly backup rule with hourly backup frequency of 6 hours and store it for30 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:
- rule-id = "sample-hourly-rule"
- retention-days = 30
- recurrence = HOURLY
- hourly-frequency = 6
- time-zone = UTC
- backup-window-start = 10
- backup-window-end = 20
2. Daily backup rule with daily backup frequency of 6 hours and store it for 7days
<BACKUP-RULE>:rule-id=sample-daily-rule,retention-days=7,recurrence=DAILY,backup-window-start=1,backup-window-end=14
Properties:
- rule-id = "sample-daily-rule"
- retention-days = 7
- recurrence = DAILY
- backup-window-start = 1
- backup-window-end = 14
3. Weekly backup rule with weekly backup frequency on every MONDAY & FRIDAYand store it for 21 days
<BACKUP-RULE>:rule-id=sample-weekly-rule,retention-days=21,recurrence=WEEKLY,days-of-week="MONDAYFRIDAY",backup-window-start=10,backup-window-end=20
Properties:
- rule-id = "sample-weekly-rule"
- retention-days: 21
- recurrence = WEEKLY
- days-of-week = "MONDAY FRIDAY"
- backup-window-start = 10
- backup-window-end = 20
- POSITIONAL ARGUMENTS
- Backup Plan resource - Name of the backup plan to be created. Once the backupplan is created, this name can't be changed. The name must be unique for aproject and location. The arguments in this group can be used to specify theattributes of this resource. (NOTE) Some attributes are not given arguments inthis group but can be set in other ways.
To set the
projectattribute:- provide the argument
BACKUP_PLANon the command line with a fullyspecified name; - provide the argument
--projecton the command line; - set the property
core/project.
This must be specified.
BACKUP_PLAN- ID of the Backup Plan or fully qualified identifier for the Backup Plan.
To set the
nameattribute:- provide the argument
BACKUP_PLANon the command line.
This positional argument must be specified if any of the other arguments in thisgroup are specified.
- provide the argument
--location=LOCATION- The location of the Backup Plan.
To set the
locationattribute:- provide the argument
BACKUP_PLANon the command line with a fullyspecified name; - provide the argument
--locationon the command line.
- provide the argument
- provide the argument
- Backup Plan resource - Name of the backup plan to be created. Once the backupplan is created, this name can't be changed. The name must be unique for aproject and location. The arguments in this group can be used to specify theattributes of this resource. (NOTE) Some attributes are not given arguments inthis group but can be set in other ways.
- REQUIRED FLAGS
--backup-rule=[PROPERTY=VALUE,…]- Backup rule that defines parameters for when and how a backup is created. Thisflag can be repeated to create more backup rules.Parameters for the backup rule include:
rule-id- Name of the backup rule. The name must be unique and start with a lowercaseletter followed by up to 62 lowercase letters, numbers, or hyphens.
retention-days- Duration for which backup data should be retained. It must be defined in "days".The value should be greater than or equal to the enforced retention period setfor the backup vault.
recurrence- Frequency for the backup schedule. It must be either: HOURLY, DAILY, WEEKLY,MONTHLY or YEARLY.
backup-window-start- Start time of the interval during which backup jobs should be executed. It canbe defined as backup-window-start=2, that means backup window starts at 2 a.m.The start time and end time must have an interval of 6 hours.
backup-window-end- End time of the interval during which backup jobs should be executed. It can bedefined as backup-window-end=14, that means backup window ends at 2 p.m. Thestart time and end time must have an interval of 6 hours.
Jobs are queued at the beginning of the window and will be marked as
SKIPPEDif they do not start by the end time. Jobs that are inprogress will not be canceled at the end time. time-zone- The time zone to be used for the backup schedule. The value must exist in theIANA tz database. The default valueis UTC. E.g., Europe/Paris
- Following flags are mutually exclusive:
hourly-frequency- Frequency for hourly backups. An hourly frequency of 2 means backup jobs willrun every 2 hours from start time till the end time defined. The hourlyfrequency must be between 4 and 23. The value is needed only if recurrence typeis HOURLY.
days-of-week- Days of the week when the backup job should be executed. The value is needed ifrecurrence type is WEEKLY. E.g., MONDAY,TUESDAY
days-of-month- Days of the month when the backup job should be executed. The value is neededonly if recurrence type is YEARLY. E.g.,"1,5,14"
months- Month for the backup schedule. The value is needed only if recurrence type isYEARLY. E.g., JANUARY, MARCH
week-day-of-month- Recurring day of the week in the month or year when the backup job should beexecuted. E.g. FIRST-SUNDAY, THIRD-MONDAY. The value can only be provided if therecurrence type is MONTHLY or YEARLY. Allowed values for the number of week -FIRST, SECOND, THIRD, FOURTH, LAST. Allowed values for days of the week - MONDAYto SUNDAY.
- E.g.,"rule-id=sample-daily-rule,recurrence=WEEKLY,backup-window-start=2,backup-window-end=14,retention-days=20,days-of-week='SUNDAYMONDAY'"
- Backup Vault resource - The backup vault where the backups gets stored usingthis backup plan. This represents a Cloud resource. (NOTE) Some attributes arenot given arguments in this group but can be set in other ways.
To set the
projectattribute:- provide the argument
--backup-vaulton the command line with afully specified name; - provide the argument
--projecton the command line; - set the property
core/project.
To set the
locationattribute:- provide the argument
--backup-vaulton the command line with afully specified name; - provide the argument
--locationon the command line.
This must be specified.
--backup-vault=BACKUP_VAULT- ID of the Backup Vault or fully qualified identifier for the Backup Vault.
To set the
nameattribute:- provide the argument
--backup-vaulton the command line.
- provide the argument
- provide the argument
--resource-type=RESOURCE_TYPE- Type of resource to which the backup plan should be applied. E.g.,
compute.<UNIVERSE_DOMAIN>.com/Instance
- OPTIONAL FLAGS
--async- Return immediately, without waiting for the operation in progress to complete.The default is
True. Enabled by default, use--no-asyncto disable. --description=DESCRIPTION- Provide a description of the backup plan, such as specific use cases andrelevant details, in 2048 characters or less.
E.g., This is a backup plan that performs a daily backup at 6 p.m. and retainsdata for 3 months.
--labels=[KEY=VALUE,…]- If you have assigned labels to your resources for grouping, you can provide thelabel using this flag.A label is a key-value pair.
Keys must start with a lowercase character and contain only hyphens (-),underscores (
), lowercase characters, and numbers. Values mustcontain only hyphens (-), underscores (), lowercase characters, andnumbers. --max-custom-on-demand-retention-days=MAX_CUSTOM_ON_DEMAND_RETENTION_DAYS- Configure the maximum retention period for on-demand backups. The value must begreater than or equal to the minimum enforced retention period set on the backupvault.
- GCLOUD WIDE FLAGS
- These flags are available to all commands:
--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 helpfor details. - BRIEF
- Creates a new backup plan
- NOTES
- This command is currently in alpha and might change without notice. If thiscommand fails with API permission errors despite specifying the correct project,you might be trying to access an API with an invitation-only early accessallowlist. This variant is also available:
gcloudbackup-drbackup-planscreate
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-11-18 UTC.