Skip to content

Start-BAKRestoreJob without auto start

0

How can I restore an EC2 instance using Powershell cmdlet Start-BAKRestoreJob without the newly created virtual machine automatically starting? I want it to remain in a stopped state and never start.

asked 15 days ago27 views
1 Answer
0

When restoring an EC2 instance using AWS Backup via PowerShell, you can control the instance's startup behavior by specifying the appropriate metadata parameters in your Start-BAKRestoreJob command.

To restore an EC2 instance that remains in a stopped state, you need to include the "InstanceInitiatedShutdownBehavior" parameter with a value of "stop" in your restore job metadata. This tells AWS Backup how to handle the instance after restoration.

Here's how you would structure your PowerShell command:

Start-BAKRestoreJob -RecoveryPointArn "arn:aws:backup:REGION:ACCOUNT_ID:recovery-point:RECOVERY_POINT_ID" `
-Metadata @{
"RestoreTo" = "EC2Instance";
"InstanceType" = "t2.medium";  # Or your preferred instance type
"InstanceInitiatedShutdownBehavior" = "stop";
# Other required parameters like VpcId, SubnetId, etc.
} `
-IamRoleArn "IAM_ROLE_ARN" `
-ResourceType "VirtualMachine" `
-CopySourceTagsToRestoredResource $false

By setting "InstanceInitiatedShutdownBehavior" to "stop", you're configuring the instance to remain in a stopped state after the restore process completes. This approach allows you to restore the EC2 instance without it automatically starting, giving you control over when to start the instance manually later if needed.
Sources
Customizing the Network Settings When Using AWS Backup to Restore VMware-Based Instances to Amazon EC2 | AWS re:Post
Restore a virtual machine using AWS Backup - AWS Backup

answered 15 days ago
EXPERT
reviewed 15 days ago
  • This does not work.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.