CreateBackupPlanCommand

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.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { BackupClient, CreateBackupPlanCommand } from "@aws-sdk/client-backup"; // ES Modules import
// const { BackupClient, CreateBackupPlanCommand } = require("@aws-sdk/client-backup"); // CommonJS import
const client = new BackupClient(config);
const input = { // CreateBackupPlanInput
  BackupPlan: { // BackupPlanInput
    BackupPlanName: "STRING_VALUE", // required
    Rules: [ // BackupRulesInput // required
      { // BackupRuleInput
        RuleName: "STRING_VALUE", // required
        TargetBackupVaultName: "STRING_VALUE", // required
        ScheduleExpression: "STRING_VALUE",
        StartWindowMinutes: Number("long"),
        CompletionWindowMinutes: Number("long"),
        Lifecycle: { // Lifecycle
          MoveToColdStorageAfterDays: Number("long"),
          DeleteAfterDays: Number("long"),
          OptInToArchiveForSupportedResources: true || false,
        },
        RecoveryPointTags: { // Tags
          "<keys>": "STRING_VALUE",
        },
        CopyActions: [ // CopyActions
          { // CopyAction
            Lifecycle: {
              MoveToColdStorageAfterDays: Number("long"),
              DeleteAfterDays: Number("long"),
              OptInToArchiveForSupportedResources: true || false,
            },
            DestinationBackupVaultArn: "STRING_VALUE", // required
          },
        ],
        EnableContinuousBackup: true || false,
        ScheduleExpressionTimezone: "STRING_VALUE",
        IndexActions: [ // IndexActions
          { // IndexAction
            ResourceTypes: [ // ResourceTypes
              "STRING_VALUE",
            ],
          },
        ],
      },
    ],
    AdvancedBackupSettings: [ // AdvancedBackupSettings
      { // AdvancedBackupSetting
        ResourceType: "STRING_VALUE",
        BackupOptions: { // BackupOptions
          "<keys>": "STRING_VALUE",
        },
      },
    ],
  },
  BackupPlanTags: {
    "<keys>": "STRING_VALUE",
  },
  CreatorRequestId: "STRING_VALUE",
};
const command = new CreateBackupPlanCommand(input);
const response = await client.send(command);
// { // CreateBackupPlanOutput
//   BackupPlanId: "STRING_VALUE",
//   BackupPlanArn: "STRING_VALUE",
//   CreationDate: new Date("TIMESTAMP"),
//   VersionId: "STRING_VALUE",
//   AdvancedBackupSettings: [ // AdvancedBackupSettings
//     { // AdvancedBackupSetting
//       ResourceType: "STRING_VALUE",
//       BackupOptions: { // BackupOptions
//         "<keys>": "STRING_VALUE",
//       },
//     },
//   ],
// };

CreateBackupPlanCommand Input

See CreateBackupPlanCommandInput for more details

Parameter
Type
Description
BackupPlan
Required
BackupPlanInput | undefined

The body of a backup plan. Includes a BackupPlanName and one or more sets of Rules.

BackupPlanTags
Record<string, string> | undefined

The tags to assign to the backup plan.

CreatorRequestId
string | undefined

Identifies the request and allows failed requests to be retried without the risk of running the operation twice. If the request includes a CreatorRequestId that matches an existing backup plan, that plan is returned. This parameter is optional.

If used, this parameter must contain 1 to 50 alphanumeric or '-_.' characters.

CreateBackupPlanCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
AdvancedBackupSettings
AdvancedBackupSetting[] | undefined

The settings for a resource type. This option is only available for Windows Volume Shadow Copy Service (VSS) backup jobs.

BackupPlanArn
string | undefined

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.

BackupPlanId
string | undefined

The ID of the backup plan.

CreationDate
Date | undefined

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.

VersionId
string | undefined

Unique, randomly generated, Unicode, UTF-8 encoded strings that are at most 1,024 bytes long. They cannot be edited.

Throws

Name
Fault
Details
AlreadyExistsException
client

The required resource already exists.

InvalidParameterValueException
client

Indicates that something is wrong with a parameter's value. For example, the value is out of range.

LimitExceededException
client

A limit in the request has been exceeded; for example, a maximum number of items allowed in a request.

MissingParameterValueException
client

Indicates that a required parameter is missing.

ServiceUnavailableException
server

The request failed due to a temporary failure of the server.

BackupServiceException
Base exception class for all service exceptions from Backup service.