This is an archive version of the document. To get the most up-to-date information, see the current version.

Create Backup Policy

You can create a new backup policy.

Request

To create a backup policy, send the HTTP POST request to the /policies endpoint.

HTTP Request

POST https://<hostname>:<port>/api/v1/policies

Request Headers

The request contains the following headers.

Header

Required/Optional

Value

Description

Authorization

Required

Bearer <Access-Token>

Authenticates a client who sends the request to the server. Must contain the access token for the current logon session in the Bearer <Access-Token> format.

x-api-version

Required

1.0-rev0

Specifies the current revision of the Veeam Backup for AWS REST API.

Content-Type

Required

application/json

Identifies a media type that is used in the body of the request.

Accept

Optional

  • application/json
  • application/problem+json

Specifies a media type of representation that is required in the response message. If the requested type is not supported, the server will return the response in the application/json media type.

Request Body

To create the backup policy, send the parameters of the PolicySpec schema in the request body.

Note

Before you create a backup policy, you can check whether the backup policy settings you plan to specify are valid. For more information, see Run Backup Policy Check.

Set the parameter values in the following format:

{

 "snapshotSettings": {

   "additionalTags": [

     {

       "key": "string",

       "value": "string"

     }

   ],

   "copyTagsFromVolumeEnabled": true/false,

   "tryCreateVSSSnapshot": true/false

 },

 "replicaSettings": {

   "mapping": [

     {

       "sourceRegionId": "string($uuid)",

       "targetRegionId": "string($uuid)",

       "targetAmazonAccountId": "string($uuid)",

       "encryptionKey": "string"

     }

   ],

   "additionalTags": [

     {

       "key": "string",

       "value": "string"

     }

   ],

   "copyTagsFromVolumeEnabled": true/false

 },

 "backupSettings": {

   "targetRepositoryId": "string($uuid)"

 },

 "regionIds": [

   "string($uuid)"

 ],

 "selectedItems": {

   "virtualMachineIds": [

     "string($uuid)"

   ],

   "tagIds": [

     "string($uuid)"

   ]

 },

 "excludedItems": {

   "virtualMachineIds": [

     "string($uuid)"

   ],

   "tagIds": [

     "string($uuid)"

   ]

 },

 "scheduleSettings": {

   "dailyScheduleEnabled": true/false,

   "dailySchedule": {

     "kind": "Everyday",

     "runsPerHour": integer($int32),

     "days": [

       "Sunday"

     ],

     "snapshotOptions": {

       "retention": {

         "count": integer($int32)

       },

       "schedule": {

         "hours": [

           true

         ]

       }

     },

     "backupOptions": {

       "retention": {

         "type": "Days",

         "count": integer($int32)

       },

       "schedule": {

         "hours": [

           true

         ]

       }

     },

     "replicaOptions": {

       "retention": {

         "count": integer($int32)

       },

       "schedule": {

         "hours": [

           true

         ]

       }

     }

   },

   "weeklyScheduleEnabled": true/false,

   "weeklySchedule": {

     "timeLocal": "string($date-time)",

     "snapshotOptions": {

       "retention": {

         "count": integer($int32)

       },

       "schedule": {

         "days": [

           "Sunday"

         ]

       }

     },

     "backupOptions": {

       "retention": {

         "type": "Days",

         "count": integer($int32)

       },

       "schedule": {

         "days": [

           "Sunday"

         ]

       }

     },

     "replicaOptions": {

       "retention": {

         "count": integer($int32)

       },

       "schedule": {

         "days": [

           "Sunday"

         ]

       }

     }

   },

   "monthlyScheduleEnabled": true/false,

   "monthlySchedule": {

     "timeLocal": "string($date-time)",

     "dayNumberInMonth": "First",

     "dayOfWeek": "Sunday",

     "dayOfMonth": integer($int32),

     "snapshotOptions": {

       "retention": {

         "count": integer($int32)

       },

       "schedule": {

         "months": [

           "January"

         ]

       }

     },

     "backupOptions": {

       "retention": {

         "type": "Days",

         "count": integer($int32)

       },

       "schedule": {

         "months": [

           "January"

         ]

       }

     },

     "replicaOptions": {

       "retention": {

         "count": integer($int32)

       },

       "schedule": {

         "months": [

           "January"

         ]

       }

     }

   },

   "yearlyScheduleEnabled": true/false,

   "yearlySchedule": {

     "timeLocal": "string($date-time)",

     "dayNumberInMonth": "First",

     "dayOfWeek": "Sunday",

     "dayOfMonth": integer($int32),

     "month": "January",

     "retention": {

       "count": integer($int32),

       "type": "Years"

     }

   }

 },

 "name": "string",

 "description": "string",

 "amazonAccountId": "string($uuid)",

 "retrySettings": {

   "retryTimes": integer($int32)

 },

 "policyNotificationSettings": {

   "recipient": "string",

   "notifyOnSuccess": true/false,

   "notifyOnWarning": true/false,

   "notifyOnFailure": true/false

 },

 "backupType": "AllItems"

}

Response

The server returns the following response to the client.

Response Code

A successfully completed operation returns a response code 201 (Created).

Response Headers

The response to this request contains the following headers. The response may also include additional standard HTTP headers.

Header

Value

Description

Content-Length

integer

Identifies the length of the response body message, in bytes.

Content-Type

  • application/json
  • application/problem+json

Identifies the media type of the response body message.

Response Body

In the response body, Veeam Backup for AWS returns a representation of the created backup policy. The Policy schema is used for the resource representation.

Create Backup PolicyExample

The following request creates a backup policy with the following settings.

Request:

POST https://135.169.170.192:11005/api/v1/policies

 

Request Header:

Authorization: Bearer <Access-Token>

x-api-version: 1.0-rev0

Content-Type: application/json

 

Request Body:

{

 "snapshotSettings": {

   "copyTagsFromVolumeEnabled": true,

   "tryCreateVSSSnapshot": false

 },

 "backupSettings": {

   "targetRepositoryId": "a7bcabe6-91f7-40ca-ad73-915d43a8e86b"

 },

 "regionIds": [

   "b7ec414c-dff8-467a-8dd9-fa52e5d684f8"

 ],

 "selectedItems": {

   "virtualMachineIds": [

     "2c9e17f0-6690-41a3-aa95-f5e824bf4307"

   ]

 },

 "scheduleSettings": {

   "dailyScheduleEnabled": true,

   "dailySchedule": {

     "kind": "SelectedDays",

     "runsPerHour": 2,

     "days": [

       "Sunday"

     ],

     "snapshotOptions": {

       "retention": {

         "count": 7

       },

       "schedule": {

         "hours":  [

           false,

           false,

           false,

           false,

           false,

           false,

           false,

           false,

           false,

           true,

           false,

           false,

           true,

           false,

           true,

           false,

           false,

           false,

           false,

           false,

           false,

           false,

           false,

           false

         ]

       }

     },

     "backupOptions": {

       "retention": {

         "type": "Days",

         "count": 21

       },

       "schedule": {

         "hours":  [

           false,

           false,

           false,

           false,

           false,

           false,

           false,

           false,

           false,

           false,

           false,

           false,

           true,

           false,

           true,

           false,

           false,

           false,

           false,

           false,

           false,

           false,

           false,

           false

         ]

       }

     }

   },

   "weeklyScheduleEnabled": false,

   "monthlyScheduleEnabled": false,

   "yearlyScheduleEnabled": true,

   "yearlySchedule": {

     "dayNumberInMonth": "First",

     "dayOfWeek": "Sunday",

     "month": "January",

     "timeLocal": "12:00:00",

     "retention": {

       "type": "Years",

       "count": 2

     }

   }

 },

 "name": "Backup Policy for LE",

 "description": "account dept",

 "amazonAccountId": "d98f4d37-7874-4be1-9702-770078f5c9cd",

 "retrySettings": {

   "retryTimes": 2

 },

 "backupType": "SelectedItems"

}

 

Response:

201

 

Response Body:

{

 "backupType": "SelectedItems",

 "id": "13b63f23-aa07-4a94-b383-04aec194ba8c",

 "snapshotSettings": {

   "additionalTags": [],

   "copyTagsFromVolumeEnabled": true,

   "tryCreateVSSSnapshot": false

 },

 "backupSettings": {

   "targetRepositoryId": "a7bcabe6-91f7-40ca-ad73-915d43a8e86b"

 },

 "regionIds": [

   "b7ec414c-dff8-467a-8dd9-fa52e5d684f8"

 ],

 "selectedItems": {

   "virtualMachineIds": [

     "2c9e17f0-6690-41a3-aa95-f5e824bf4307"

   ],

   "tagIds": []

 },

 "excludedItems": {

   "virtualMachineIds": [],

   "tagIds": []

 },

 "scheduleSettings": {

   "dailyScheduleEnabled": true,

   "dailySchedule": {

     "kind": "SelectedDays",

     "runsPerHour": 2,

     "days": [

       "Sunday"

     ],

     "snapshotOptions": {

       "retention": {

         "count": 7

       },

       "schedule": {

         "hours": [

           false,

           false,

           false,

           false,

           false,

           false,

           false,

           false,

           false,

           false,

           false,

           false,

           true,

           false,

           true,

           false,

           false,

           false,

           false,

           false,

           false,

           false,

           false,

           false

         ]

       }

     },

     "backupOptions": {

       "retention": {

         "type": "Days",

         "count": 21

       },

       "schedule": {

         "hours": [

           false,

           false,

           false,

           false,

           false,

           false,

           false,

           false,

           false,

           false,

           false,

           false,

           true,

           false,

           true,

           false,

           false,

           false,

           false,

           false,

           false,

           false,

           false,

           false

         ]

       }

     }

   },

   "weeklyScheduleEnabled": false,

   "monthlyScheduleEnabled": false,

   "yearlyScheduleEnabled": true,

   "yearlySchedule": {

     "dayNumberInMonth": "First",

     "dayOfWeek": "Sunday",

     "month": "January",

     "timeLocal": "2020-06-02T12:00:00",

     "retention": {

       "type": "Years",

       "count": 2

     }

   }

 },

 "name": "Backup Policy for LE",

 "description": "account dept",

 "priority": 6,

 "amazonAccountId": "d98f4d37-7874-4be1-9702-770078f5c9cd",

 "retrySettings": {

   "retryTimes": 2

 },

 "isEnabled": true,

 "createdBy": "administrator",

 "modifiedBy": "administrator",

 "usn": 0,

 "_embeddedResources": {

   "targetRepository": {

     "method": "GET",

     "rel": "TargetRepository",

     "href": "https://135.169.170.192:11005/api/v1/repositories/a7bcabe6-91f7-40ca-ad73-915d43a8e86b"

   },

   "protectedResources": {

     "method": "GET",

     "rel": "SelectedItems",

     "href": "https://135.169.170.192:11005/api/v1/policies/13b63f23-aa07-4a94-b383-04aec194ba8c/selectedItems"

   },

   "excludedResources": {

     "method": "GET",

     "rel": "ExcludedItems",

     "href": "https://135.169.170.192:11005/api/v1/policies/13b63f23-aa07-4a94-b383-04aec194ba8c/excludedItems"

   },

   "regions": {

     "method": "GET",

     "rel": "Regions",

     "href": "https://135.169.170.192:11005/api/v1/policies/13b63f23-aa07-4a94-b383-04aec194ba8c/regions"

   }

 },

 "_links": [

   {

     "method": "GET",

     "rel": "self",

     "href": "https://135.169.170.192:11005/api/v1/policies/13b63f23-aa07-4a94-b383-04aec194ba8c"

   },

   {

     "method": "PUT",

     "rel": "update",

     "href": "https://135.169.170.192:11005/api/v1/policies/13b63f23-aa07-4a94-b383-04aec194ba8c"

   },

   {

     "method": "DELETE",

     "rel": "delete",

     "href": "https://135.169.170.192:11005/api/v1/policies/13b63f23-aa07-4a94-b383-04aec194ba8c"

   },

   {

     "method": "POST",

     "rel": "disable",

     "href": "https://135.169.170.192:11005/api/v1/policies/13b63f23-aa07-4a94-b383-04aec194ba8c/disable"

   }

 ]

}