This shell script will migrate EC2 instance from 1 region to another. Basic steps are as follows:
- Generate JSON of
<SOURCE EC2 INSTANCE>
. - Create image of
<SOURCE EC2 INSTANCE>
. - Copy image to
<TARGET REGION>
. - Launch instance in
<TARGET REGION>
with the values from JSON created in Step 1. - Assign EIP
- Add tags
- Same CIDR VPC/Subnet present in
<TARGET REGION>
. Without this, the<PRIV_IP>
variable in the script has to be removed/commented. - Before migration, copy Security Groups to
<TARGET REGION>
using python script mentioned here.
- You can manually copy security groups first and comment Step 4 in script.
- Make sure to follow Step 4 carefully.
- I am not responsible for any damages done.