

# If you failed over before you scheduled EC2Launch v1

If you fail over a Windows instance before you schedule EC2Launch v1, the standby instance cannot reach the Instance Metadata Service (IMDS). The SSM Agent does not register with AWS Systems Manager, and replication does not continue.

This problem occurs because the standby instance uses the network routes of the source instance's subnet. This problem does not affect the volumes or their data.

You can fix the routes in either of the following ways:
+ If the source instance is still available, fail the volumes back to the source instance.
+ Recreate the routes on the standby instance.

After either fix, you must schedule EC2Launch v1 to run on every boot before the next failover. For instructions on scheduling EC2Launch v1, see [Scheduling EC2Launch v1 to run on every boot](ebs-multi-az-windows-ec2launch-schedule.md).

If the source instance is still available, use the following procedure to fix the routes by failing the volumes back to it.

**To fix the routes by failing back to the source instance**

1. Fail the volumes back to the source instance. The routes match the subnet of that instance again.

1. Connect to the source instance again, for example through Systems Manager. Before the next failover, schedule EC2Launch v1 to run on every boot on the source instance.

You cannot connect to the standby instance through Systems Manager, because Systems Manager needs IMDS. The other ways to connect have the following limits on these AMIs:
+ The Amazon EC2 serial console is not available by default, because Windows Emergency Management Services (EMS) is turned off.
+ SSH is not available, because no SSH server is installed.
+ Remote Desktop Protocol (RDP) and Windows Remote Management (WinRM) are available only with an inbound rule in the security group of the instance.

Use the following procedure to recreate the routes on the standby instance. You need administrator access to the standby instance to complete this procedure. If you do not have it, ask an administrator of the instance to complete the procedure.

**To recreate the routes on the standby instance**

1. Connect to the standby instance, for example over RDP.

1. Open Windows PowerShell as an administrator.

1. To recreate the routes for the subnet of the standby instance, run the following PowerShell commands:

   ```powershell
   Import-Module 'C:\ProgramData\Amazon\EC2-Windows\Launch\Module\Ec2Launch.psd1'
   Add-Routes
   ```

   The commands do the following:
   + `Import-Module` loads the EC2Launch v1 module.
   + `Add-Routes` recreates the routes for the subnet that the instance is in.

1. Restart the standby instance after IMDS is reachable.

1. Schedule EC2Launch v1 to run on every boot on the standby instance.

After you restart the standby instance, replication continues on it. You do not need to install the agent again. AWS Elastic Disaster Recovery might rescan the volumes first. For more information, see [What should I know about rescans?](Replication-Related-FAQ.md#How-Long-Rescan)

**Important**  
`Add-Routes` sets the routes only for the subnet that the instance is in, so the next failover or failback breaks them again. To recreate the routes on every boot, you must schedule EC2Launch v1 as described in the last step.