All Products
Search
Document Center

Cloud Backup:CreatePolicyV2

Last Updated:Jun 11, 2026

Membuat kebijakan.

Deskripsi operasi

A backup policy configures your backups. When a policy runs, it initiates a backup job to track its progress and outcome. A successful backup job creates a snapshot that you can use to create a restore job.

  • A backup policy supports multiple data sources, including NAS backup, OSS backup, ECS instance backup, ECS file backup, on-premises file backup, Tablestore backup, and CPFS backup.

  • A backup policy can have only one backup schedule with a fixed interval.

  • A backup policy backs up data to a single backup vault.

Coba sekarang

Coba API ini di OpenAPI Explorer tanpa perlu penandatanganan manual. Panggilan yang berhasil akan secara otomatis menghasilkan contoh kode SDK sesuai dengan parameter Anda. Unduh kode tersebut dengan kredensial bawaan yang aman untuk penggunaan lokal.

Test

RAM authorization

Tabel berikut menjelaskan otorisasi yang diperlukan untuk memanggil API ini. Anda dapat menentukannya dalam kebijakan Resource Access Management (RAM). Kolom pada tabel dijelaskan sebagai berikut:

  • Action: Aksi yang dapat digunakan dalam elemen Action pada pernyataan kebijakan izin RAM untuk memberikan izin guna melakukan operasi tersebut.

  • API: API yang dapat Anda panggil untuk melakukan aksi tersebut.

  • Access level: Tingkat akses yang telah ditentukan untuk setiap API. Nilai yang valid: create, list, get, update, dan delete.

  • Resource type: Jenis resource yang mendukung otorisasi untuk melakukan aksi tersebut. Ini menunjukkan apakah aksi tersebut mendukung izin tingkat resource. Resource yang ditentukan harus kompatibel dengan aksi tersebut. Jika tidak, kebijakan tersebut tidak akan berlaku.

    • Untuk API dengan izin tingkat resource, jenis resource yang diperlukan ditandai dengan tanda bintang (*). Tentukan Nama Sumber Daya Alibaba Cloud (ARN) yang sesuai dalam elemen Resource pada kebijakan.

    • Untuk API tanpa izin tingkat resource, ditampilkan sebagai All Resources. Gunakan tanda bintang (*) dalam elemen Resource pada kebijakan.

  • Condition key: Kunci kondisi yang didefinisikan oleh layanan. Kunci ini memungkinkan kontrol granular, berlaku baik hanya untuk aksi maupun untuk aksi yang terkait dengan resource tertentu. Selain kunci kondisi spesifik layanan, Alibaba Cloud menyediakan serangkaian common condition keys yang berlaku di semua layanan yang didukung RAM.

  • Dependent action: Aksi dependen yang diperlukan untuk menjalankan aksi tersebut. Untuk menyelesaikan aksi tersebut, pengguna RAM atau role RAM harus memiliki izin untuk melakukan semua aksi dependen.

Action

Access level

Resource type

Condition key

Dependent action

hbr:CreatePolicyV2

create

*全部资源

*

None None

Parameter permintaan

Parameter

Type

Required

Description

Example

PolicyName

string

No

Nama kebijakan cadangan.

每天本地备份 + 异地备份

PolicyType

string

No

Tipe kebijakan cadangan. Nilai valid:

  • STANDARD: Kebijakan cadangan standar. Mendukung sumber data selain cadangan Instance ECS.

  • UDM_ECS_ONLY: Kebijakan cadangan yang hanya mendukung cadangan Instance ECS.

Jika Anda tidak menentukan parameter ini, Cloud Backup secara otomatis mengatur tipe kebijakan berdasarkan apakah penyimpanan cadangan ditentukan dalam aturan kebijakan:

  • Jika penyimpanan cadangan ditentukan dalam aturan, tipe kebijakan diatur ke STANDARD.

  • Jika tidak ada penyimpanan cadangan yang ditentukan dalam aturan, tipe kebijakan diatur ke UDM_ECS_ONLY.

STANDARD

PolicyDescription

string

No

Deskripsi kebijakan cadangan.

每天早上10点备份一次,异地备份到上海。

Rules

array<object>

No

Daftar aturan kebijakan.

array<object>

No

A policy rule.

RuleType

string

Yes

The type of the rule. Each policy requires at least one BACKUP rule and exactly one TRANSITION rule. Valid values:

  • BACKUP: A backup rule.

  • TRANSITION: A lifecycle rule.

  • REPLICATION: A replication rule.

  • TAG: A rule to associate data sources with the policy by using tags.

BACKUP

Schedule

string

No

This parameter is required only when RuleType is set to BACKUP. The backup schedule. Valid formats:

  • I|{startTime}|{interval}: Runs a backup job at the specified interval starting from {startTime}. For example, I|1631685600|P1D runs a backup job every day, starting from 2021-09-15 14:00:00.

    • startTime: The backup start time in UNIX time, in seconds.

    • interval: The backup interval in ISO 8601 format. For example, PT1H specifies an interval of 1 hour. P1D specifies an interval of 1 day.

  • C|{startTime}|{crontab}: Runs a backup job based on the specified crontab expression starting from {startTime}. For example, C|1631685600|0 0 2 ? * 3,5,7 runs a backup job at 02:00:00 on every Tuesday, Thursday, and Saturday, starting from 2021-09-15 14:00:00.

    • startTime: The backup start time in UNIX time, in seconds.

    • crontab: A crontab expression. For example, 0 0 2 ? * 3,5,7 specifies 02:00:00 on every Tuesday, Thursday, and Saturday.

Missed backup jobs are not run retroactively. If a backup job is still running, the next scheduled job is not triggered.

I|1648647166|P1D

BackupType

string

No

This parameter is required only when RuleType is set to BACKUP. The backup type. The value COMPLETE specifies a full backup.

COMPLETE

Retention

integer

No

This parameter is required only when RuleType is set to BACKUP, TRANSITION, or REPLICATION. The retention period in days.

  • If RuleType is BACKUP: The backup retention period. A Retention parameter in a TRANSITION rule overrides this setting. The value must be between 1 and 364635.

  • If RuleType is TRANSITION: The backup retention period. The value must be between 1 and 364635.

  • If RuleType is REPLICATION: The retention period for cross-region backups. The value must be between 1 and 364635.

7

ReplicationRegionId

string

No

This parameter is required only when RuleType is set to REPLICATION. The ID of the destination region for replication.

cn-shanghai

RetentionRules

array<object>

No

This parameter is required only when RuleType is set to TRANSITION. The advanced retention rules.

object

No

An advanced retention rule.

AdvancedRetentionType

string

No

The type of the advanced retention rule. Valid values:

  • DAILY: Daily backups.

  • WEEKLY: Weekly backups.

  • MONTHLY: Monthly backups.

  • YEARLY: Yearly backups.

YEARLY

WhichSnapshot

integer

No

The ordinal number of the backup to keep based on the AdvancedRetentionType. For example, a value of 1 indicates the first backup. Currently, only a value of 1 is supported.

1

Retention

integer

No

The retention period in days for this advanced rule. The minimum value is 1.

730

VaultId

string

No

This parameter is required only when RuleType is set to BACKUP. The ID of the backup vault.

v-0001************aseg

KeepLatestSnapshots

integer

No

Specifies whether to permanently retain at least one backup version. Valid values:

  • 0: Do not retain.

  • 1: Retain.

1

Immutable

boolean

No

Valid only when PolicyType is set to UDM_ECS_ONLY. Specifies whether to enable backup lock for the backups.

true

DataSourceFilters

array<object>

No

This parameter is required only when RuleType is set to TAG. The filter rules for data sources.

object

No

SourceType

string

No

The type of the data source. Valid values:

  • UDM_ECS: ECS instance backup. Supported only when PolicyType is set to UDM_ECS_ONLY.

  • OSS: OSS backup. Supported only when PolicyType is set to STANDARD.

  • NAS: NAS backup. Supported only when PolicyType is set to STANDARD.

  • ECS_FILE: ECS file backup. Supported only when PolicyType is set to STANDARD.

  • OTS: Tablestore backup. Supported only when PolicyType is set to STANDARD.

UDM_ECS

DataSourceIds

array

No

This parameter is deprecated.

string

No

This parameter is deprecated.

已废弃。

TagFilters

array<object>

No

This parameter is required only when RuleType is set to TAG. The filter rules for resource tags.

object

No

Key

string

No

The tag key.

env

Value

string

No

The tag value. If you leave this parameter empty, the filter matches any value for the specified tag key.

prod

Operator

string

No

The operator for matching tags. Valid values:

  • EQUAL: Matches both the tag key and tag value.

  • NOT: Matches the tag key but not the tag value.

EQUAL

Elemen respons

Element

Type

Description

Example

object

CreatePolicyResponse

Success

boolean

Indicates whether the request succeeded. Valid values:

  • true: The request succeeded.

  • false: The request failed.

true

Code

string

The return code. A value of 200 indicates that the request succeeded.

200

Message

string

The response message. successful is returned for a successful request. An error message is returned for a failed request.

successful

RequestId

string

The request ID.

EEC65C22-2152-5E31-8AD6-D6CBF1BFF49F

PolicyId

string

The policy ID.

po-000000zemnuyx2li3y9y

Contoh

Respons sukses

JSONformat

{
  "Success": true,
  "Code": "200",
  "Message": "successful",
  "RequestId": "EEC65C22-2152-5E31-8AD6-D6CBF1BFF49F",
  "PolicyId": "po-000000zemnuyx2li3y9y"
}

Kode kesalahan

Lihat Error Codes untuk daftar lengkap.

Catatan rilis

Lihat Release Notes untuk daftar lengkap.