Skip to content

StartBackupJob

Source: src/AWS/Backup/StartBackupJob.ts

Runtime binding for the StartBackupJob operation (IAM actions backup:StartBackupJob on the vault ARN + iam:PassRole on the backup role) — take an on-demand backup of any supported resource from a deployed Function.

The binding is constructed with the target BackupVault and the backup role (the IAM role AWS Backup assumes to read the resource and write the recovery point; its trust policy must allow backup.amazonaws.com). Both are injected into every runtime request. Provide the implementation with Effect.provide(AWS.Backup.StartBackupJobHttp).

// deploy time — bind the vault and the backup role
const startBackupJob = yield* AWS.Backup.StartBackupJob(vault, backupRole);
// runtime — snapshot the table before a risky migration
const tableArn = yield* table.tableArn;
const job = yield* startBackupJob({
ResourceArn: tableArn,
Lifecycle: { DeleteAfterDays: 7 },
});
yield* Effect.log(`backup job ${job.BackupJobId} started`);