Sometime, you may required to create an EC2 instance on a subnet of a VPC using a Custom AMI of another EC2 instace, which is running on different subnet. And once you create the new EC2 instance, you might see that, Windows is not getting activated and the metadata is not populating on the wallpaper.
When you create an AMI, it’s getting saved with the current routes of the EC2 instance. This AMI will work fine until you use it to create new EC2 instances on the same subnet. But, the moment you use it to create an EC2 instance on a different subnet, your newly created Windows instance will not get activated. Reason behind this is, in order to activate the Windows, EC2 instance needs to have AWS persistent routes with the correct “Default Gateway” of the subnet. And these gateways differes from subnet to subnet and if you decide to create the new EC2 instance on a diffrent subnet, you need to update the routes with proper gateway.
Follow the given steps to resolve it easily and activate your Windows Server.
Login to the server using admin credentials. Open command prompt as an Administrator then run
ipconfig to see IP of the default gateway.
route print and you will be able to see that all the persistent routes are still using the AMI’s instance default gateway.
Now delete all these routes using following commands.
route delete <Network Address> mask <Mask>
Add the sames routes replacing the correct gateway IP which you got from Step 1.
route -p add <Network Address> mask <Mask> <Default Gateway IP> METRIC <Metric Value>
If you run
route print again, you will see the persistent routes with correct default gateway.
Finally reboot the server and once it is booted up, you will see that the Windows has been activated.