backup_plans
Creates, updates, deletes, gets or lists a backup_plans resource.
Overview
| Name | backup_plans |
| Type | Resource |
| Id | aws.backup.backup_plans |
Fields
The following fields are returned by SELECT queries:
- get_backup_plan
- list_backup_plans
| Name | Datatype | Description |
|---|---|---|
advanced_backup_settings | array | Contains a list of BackupOptions for each resource type. The list is populated only if the advanced option is set for the backup plan. |
backup_plan | object | Specifies the body of a backup plan. Includes a BackupPlanName and one or more sets of Rules. |
backup_plan_arn | string | An Amazon Resource Name (ARN) that uniquely identifies a backup plan; for example, arn:aws:backup:us-east-1:123456789012:plan:8F81F553-3A74-4A3F-B93D-B3360DC80C50. |
backup_plan_id | string | Uniquely identifies a backup plan. |
creation_date | string (date-time) | The date and time that a backup plan is created, in Unix format and Coordinated Universal Time (UTC). The value of CreationDate is accurate to milliseconds. For example, the value 1516925490.087 represents Friday, January 26, 2018 12:11:30.087 AM. |
creator_request_id | string | A unique string that identifies the request and allows failed requests to be retried without the risk of running the operation twice. |
deletion_date | string (date-time) | The date and time that a backup plan is deleted, in Unix format and Coordinated Universal Time (UTC). The value of DeletionDate is accurate to milliseconds. For example, the value 1516925490.087 represents Friday, January 26, 2018 12:11:30.087 AM. |
last_execution_date | string (date-time) | The last time this backup plan was run. A date and time, in Unix format and Coordinated Universal Time (UTC). The value of LastExecutionDate is accurate to milliseconds. For example, the value 1516925490.087 represents Friday, January 26, 2018 12:11:30.087 AM. |
scheduled_runs_preview | array | List of upcoming scheduled backup runs. Only included when MaxScheduledRunsPreview parameter is greater than 0. Contains up to 10 future backup executions with their scheduled times, execution types, and associated rule IDs. |
version_id | string | Unique, randomly generated, Unicode, UTF-8 encoded strings that are at most 1,024 bytes long. Version IDs cannot be edited. |
| Name | Datatype | Description |
|---|---|---|
advanced_backup_settings | array | Contains a list of BackupOptions for a resource type. |
backup_plan_arn | string | An Amazon Resource Name (ARN) that uniquely identifies a backup plan; for example, arn:aws:backup:us-east-1:123456789012:plan:8F81F553-3A74-4A3F-B93D-B3360DC80C50. |
backup_plan_id | string | Uniquely identifies a backup plan. |
backup_plan_name | string | The display name of a saved backup plan. |
creation_date | string (date-time) | The date and time a resource backup plan is created, in Unix format and Coordinated Universal Time (UTC). The value of CreationDate is accurate to milliseconds. For example, the value 1516925490.087 represents Friday, January 26, 2018 12:11:30.087 AM. |
creator_request_id | string | A unique string that identifies the request and allows failed requests to be retried without the risk of running the operation twice. This parameter is optional. If used, this parameter must contain 1 to 50 alphanumeric or '-_.' characters. |
deletion_date | string (date-time) | The date and time a backup plan is deleted, in Unix format and Coordinated Universal Time (UTC). The value of DeletionDate is accurate to milliseconds. For example, the value 1516925490.087 represents Friday, January 26, 2018 12:11:30.087 AM. |
last_execution_date | string (date-time) | The last time this backup plan was run. A date and time, in Unix format and Coordinated Universal Time (UTC). The value of LastExecutionDate is accurate to milliseconds. For example, the value 1516925490.087 represents Friday, January 26, 2018 12:11:30.087 AM. |
version_id | string | Unique, randomly generated, Unicode, UTF-8 encoded strings that are at most 1,024 bytes long. Version IDs cannot be edited. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_backup_plan | select | backup_plan_id, region | versionId, MaxScheduledRunsPreview | Returns BackupPlan details for the specified BackupPlanId. The details are the body of a backup plan in JSON format, in addition to plan metadata. |
list_backup_plans | select | region | nextToken, maxResults, includeDeleted | Lists the active backup plans for the account. |
create_backup_plan | insert | region, BackupPlan | Creates a backup plan using a backup plan name and backup rules. A backup plan is a document that contains information that Backup uses to schedule tasks that create recovery points for resources. If you call CreateBackupPlan with a plan that already exists, you receive an AlreadyExistsException exception. | |
update_backup_plan | update | backup_plan_id, region, BackupPlan | Updates the specified backup plan. The new version is uniquely identified by its ID. | |
delete_backup_plan | delete | backup_plan_id, region | Deletes a backup plan. A backup plan can only be deleted after all associated selections of resources have been deleted. Deleting a backup plan deletes the current version of a backup plan. Previous versions, if any, will still exist. | |
export_backup_plan_template | exec | backup_plan_id, region | Returns the backup plan that is specified by the plan ID as a backup template. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
backup_plan_id | string | Uniquely identifies a backup plan. |
region | string | AWS region (default: us-east-1) |
MaxScheduledRunsPreview | integer | Number of future scheduled backup runs to preview. When set to 0 (default), no scheduled runs preview is included in the response. Valid range is 0-10. |
includeDeleted | boolean | A Boolean value with a default value of FALSE that returns deleted backup plans when set to TRUE. |
maxResults | integer | The maximum number of items to be returned. |
nextToken | string | The next item following a partial list of returned items. For example, if a request is made to return MaxResults number of items, NextToken allows you to return more items in your list starting at the location pointed to by the next token. |
versionId | string | Unique, randomly generated, Unicode, UTF-8 encoded strings that are at most 1,024 bytes long. Version IDs cannot be edited. |
SELECT examples
- get_backup_plan
- list_backup_plans
Returns BackupPlan details for the specified BackupPlanId. The details are the body of a backup plan in JSON format, in addition to plan metadata.
SELECT
advanced_backup_settings,
backup_plan,
backup_plan_arn,
backup_plan_id,
creation_date,
creator_request_id,
deletion_date,
last_execution_date,
scheduled_runs_preview,
version_id
FROM aws.backup.backup_plans
WHERE backup_plan_id = '{{ backup_plan_id }}' -- required
AND region = '{{ region }}' -- required
AND versionId = '{{ versionId }}'
AND MaxScheduledRunsPreview = '{{ MaxScheduledRunsPreview }}'
;
Lists the active backup plans for the account.
SELECT
advanced_backup_settings,
backup_plan_arn,
backup_plan_id,
backup_plan_name,
creation_date,
creator_request_id,
deletion_date,
last_execution_date,
version_id
FROM aws.backup.backup_plans
WHERE region = '{{ region }}' -- required
AND nextToken = '{{ nextToken }}'
AND maxResults = '{{ maxResults }}'
AND includeDeleted = '{{ includeDeleted }}'
;
INSERT examples
- create_backup_plan
- Manifest
Creates a backup plan using a backup plan name and backup rules. A backup plan is a document that contains information that Backup uses to schedule tasks that create recovery points for resources. If you call CreateBackupPlan with a plan that already exists, you receive an AlreadyExistsException exception.
INSERT INTO aws.backup.backup_plans (
BackupPlan,
BackupPlanTags,
CreatorRequestId,
region
)
SELECT
'{{ BackupPlan }}' /* required */,
'{{ BackupPlanTags }}',
'{{ CreatorRequestId }}',
'{{ region }}'
RETURNING
advanced_backup_settings,
backup_plan_arn,
backup_plan_id,
creation_date,
version_id
;
# Description fields are for documentation purposes
- name: backup_plans
props:
- name: region
value: "{{ region }}"
description: Required parameter for the backup_plans resource.
- name: BackupPlan
description: |
Contains an optional backup plan display name and an array of BackupRule objects, each of which specifies a backup rule. Each rule in a backup plan is a separate scheduled task.
value:
BackupPlanName: "{{ BackupPlanName }}"
Rules:
- RuleName: "{{ RuleName }}"
TargetBackupVaultName: "{{ TargetBackupVaultName }}"
TargetLogicallyAirGappedBackupVaultArn: "{{ TargetLogicallyAirGappedBackupVaultArn }}"
ScheduleExpression: "{{ ScheduleExpression }}"
StartWindowMinutes: {{ StartWindowMinutes }}
CompletionWindowMinutes: {{ CompletionWindowMinutes }}
Lifecycle:
MoveToColdStorageAfterDays: {{ MoveToColdStorageAfterDays }}
DeleteAfterDays: {{ DeleteAfterDays }}
OptInToArchiveForSupportedResources: {{ OptInToArchiveForSupportedResources }}
DeleteAfterEvent: "{{ DeleteAfterEvent }}"
RecoveryPointTags: "{{ RecoveryPointTags }}"
CopyActions: "{{ CopyActions }}"
EnableContinuousBackup: {{ EnableContinuousBackup }}
ScheduleExpressionTimezone: "{{ ScheduleExpressionTimezone }}"
IndexActions: "{{ IndexActions }}"
ScanActions: "{{ ScanActions }}"
AdvancedBackupSettings:
- ResourceType: "{{ ResourceType }}"
BackupOptions: "{{ BackupOptions }}"
ScanSettings:
- MalwareScanner: "{{ MalwareScanner }}"
ResourceTypes: "{{ ResourceTypes }}"
ScannerRoleArn: "{{ ScannerRoleArn }}"
- name: BackupPlanTags
value: "{{ BackupPlanTags }}"
- name: CreatorRequestId
value: "{{ CreatorRequestId }}"
UPDATE examples
- update_backup_plan
Updates the specified backup plan. The new version is uniquely identified by its ID.
UPDATE aws.backup.backup_plans
SET
BackupPlan = '{{ BackupPlan }}'
WHERE
backup_plan_id = '{{ backup_plan_id }}' --required
AND region = '{{ region }}' --required
AND BackupPlan = '{{ BackupPlan }}' --required
RETURNING
advanced_backup_settings,
backup_plan_arn,
backup_plan_id,
creation_date,
scan_settings,
version_id;
DELETE examples
- delete_backup_plan
Deletes a backup plan. A backup plan can only be deleted after all associated selections of resources have been deleted. Deleting a backup plan deletes the current version of a backup plan. Previous versions, if any, will still exist.
DELETE FROM aws.backup.backup_plans
WHERE backup_plan_id = '{{ backup_plan_id }}' --required
AND region = '{{ region }}' --required
;
Lifecycle Methods
- export_backup_plan_template
Returns the backup plan that is specified by the plan ID as a backup template.
EXEC aws.backup.backup_plans.export_backup_plan_template
@backup_plan_id='{{ backup_plan_id }}' --required,
@region='{{ region }}' --required
;