- Newest
- Most votes
- Most comments
I finally got it to work like this
$BackupJob = Get-BAKBackupJobList | ? ResourceName -eq "testrestore"
$BackupMetadata = Get-B{forbidden word}Metadata -RecoveryPointArn $BackupJob.RecoveryPointArn -BackupVaultName $BackupJob.BackupVaultName
# If we provide all metadata, it gives an error. All of the data that AWS needs is in the backup that it created. So, we shouldn't have to do any of this. CLI restore is seriously broken.
# Metadata must be provided as a hash.
$SelectMetadata = @{
BlockDeviceMappings=$BackupMetadata.RestoreMetadata['BlockDeviceMappings']
VpcId = $BackupMetadata.RestoreMetadata['VpcId']
SubnetId = $BackupMetadata.RestoreMetadata['SubnetId']
}
$RestoreJobId = Start-BAKRestoreJob -Metadata $SelectMetadata -IamRoleArn $BackupJob.IamRoleArn -RecoveryPointArn $BackupJob.RecoveryPointArn -ResourceType $BackupJob.ResourceType
- forbidden word = AK RecoveryPointRestore without the space. WTF?
To be a real restore of the virtual machine, more metadata would need to be added. But, I'm only trying to get the storage volumes out of it; so, I'm going to delete the EC2 instance when I'm done anyway. Now to figure out how to prevent it from automatically powering on at the end of restore. Seems kind of crazy that that is the default. Still have to remember that AWS was created with the assumption that people are using AWS for a web farm.
answered a year ago
To restore an EC2 instance using AWS Backup's Start-BAKRestoreJob command, you need to provide specific metadata parameters. The error you're receiving indicates that the required metadata is missing.
For EC2 instance restores, you'll need to include metadata that defines how the restored instance should be configured. While the exact metadata requirements aren't explicitly listed in the available information for EC2 specifically, you can obtain the necessary metadata values by using the Get-BAKRecoveryPointRestoreMetadata cmdlet.
Here's how you can approach this:
- First, identify the recovery point ARN for your backup:
$recoveryPoint = Get-BAKBackupJobList | Where-Object ResourceName -eq "testrestore" | Select-Object RecoveryPointArn
- Then, retrieve the required metadata for that recovery point:
$metadata = Get-BAKRecoveryPointRestoreMetadata -RecoveryPointArn $recoveryPoint.RecoveryPointArn
- Finally, use that metadata in your restore job:
Start-BAKRestoreJob -RecoveryPointArn $recoveryPoint.RecoveryPointArn -Metadata $metadata -IamRoleArn "arn:aws:iam::account:role/service-role/AWSBackupDefaultServiceRole"
The metadata requirements vary by resource type. For EC2 instances, you might need to specify parameters like subnet IDs, security groups, and instance type. The Get-BAKRecoveryPointRestoreMetadata cmdlet will provide you with the specific metadata values needed for your particular EC2 instance restore.
Sources
StartRestoreJob - AWS Backup
answered a year ago
Relevant content
asked 3 years ago
asked 5 years ago
- AWS OFFICIALUpdated a year ago

This AI response does not work.