1
0
Fork 0
mirror of https://github.com/imjasonh/gcloud-help synced 2026-07-08 10:35:03 +00:00
gcloud-help/gcloud/backup-dr/backup-plans/create
2024-11-20 10:03:22 +00:00

246 lines
9.4 KiB
Text

NAME
gcloud backup-dr backup-plans create - creates a new Backup Plan
SYNOPSIS
gcloud 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,...]] [GCLOUD_WIDE_FLAG ...]
DESCRIPTION
Create a new backup plan in the project. It can only be created in
locations where Backup and DR is available.
EXAMPLES
To create a new backup plan sample-backup-plan in project sample-project,
at location us-central1, with resource-type
compute.<UNIVERSE_DOMAIN>.com/Instance and backup-vault backup-vault with 2
backup-rules:
run:
$ gcloud backup-dr backup-plans create sample-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
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:
▪ 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 7 days
<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 & 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:
▪ 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
backup plan is created, this name can't be changed. The name must be
unique for a project and location. The arguments in this group can be used
to specify the attributes of this resource. (NOTE) Some attributes are not
given arguments in this group but can be set in other ways.
To set the project attribute:
◆ provide the argument BACKUP_PLAN on the command line with a fully
specified name;
◆ provide the argument --project on 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 name attribute:
▸ provide the argument BACKUP_PLAN on the command line.
This positional argument must be specified if any of the other
arguments in this group are specified.
--location=LOCATION
The location of the Backup Plan.
To set the location attribute:
▸ provide the argument BACKUP_PLAN on the command line with a fully
specified name;
▸ provide the argument --location on the command line.
REQUIRED FLAGS
--backup-rule=[PROPERTY=VALUE,...]
Backup rule that defines parameters for when and how a backup is
created. This flag 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
lowercase letter 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 set for 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 can be 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 be defined as backup-window-end=14, that means
backup window ends at 2 p.m. The start 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 SKIPPED if they do not start by the end time. Jobs that are in
progress 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 the IANA tz database (https://www.iana.org/time-zones).
The default value is UTC. E.g., Europe/Paris
Following flags are mutually exclusive:
hourly-frequency
Frequency for hourly backups. An hourly frequency of 2 means backup
jobs will run every 2 hours from start time till the end time
defined. The hourly frequency must be between 6 and 23. The value
is needed only if recurrence type is HOURLY.
days-of-week
Days of the week when the backup job should be executed. The value
is needed if recurrence type is WEEKLY. E.g., MONDAY,TUESDAY
days-of-month
Days of the month when the backup job should be executed. The value
is needed only if recurrence type is YEARLY. E.g.,"1,5,14"
months
Month for the backup schedule. The value is needed only if
recurrence type is YEARLY. E.g., JANUARY, MARCH
week-day-of-month
Recurring day of the week in the month or year when the backup job
should be executed. E.g. FIRST-SUNDAY, THIRD-MONDAY. The value can
only be provided if the recurrence type is MONTHLY or YEARLY.
Allowed values for the number of week - FIRST, SECOND, THIRD,
FOURTH, LAST. Allowed values for days of the week - MONDAY to
SUNDAY.
E.g.,
"rule-id=sample-daily-rule,recurrence=WEEKLY,backup-window-start=2,backup-window-end=14,retention-days=20,days-of-week='SUNDAY
MONDAY'"
Backup Vault resource - The backup vault where the backups gets stored
using this backup plan. This represents a Cloud resource. (NOTE) Some
attributes are not given arguments in this group but can be set in other
ways.
To set the project attribute:
◆ provide the argument --backup-vault on the command line with a fully
specified name;
◆ provide the argument --project on the command line;
◆ set the property core/project.
To set the location attribute:
◆ provide the argument --backup-vault on the command line with a fully
specified name;
◆ provide the argument --location on 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 name attribute:
▸ provide the argument --backup-vault on the command line.
--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-async to
disable.
--description=DESCRIPTION
Provide a description of the backup plan, such as specific use cases
and relevant details, in 2048 characters or less.
E.g., This is a backup plan that performs a daily backup at 6 p.m. and
retains data for 3 months.
--labels=[KEY=VALUE,...]
If you have assigned labels to your resources for grouping, you can
provide the label 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 must
contain only hyphens (-), underscores (), lowercase characters, and
numbers.
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 help for details.
BRIEF
Creates a new backup plan
NOTES
This variant is also available:
$ gcloud alpha backup-dr backup-plans create