Pronounced "Easy to see" EC2C stands for EC2 Copy : Copy/migrate EC2 instances from one AWS account to another AWS account from the comfort of a commnad line.
Migrating EC2 instances from one AWS account to another is a disjointed process that involves creating an AMI , waiting for it to be available and then changing permissions on it so that AMIs are available in the target account. This becomes tedious when there are multiple EC2 instances that needs to be migrated. Automation of this task involves wrapping AWS CLI commands with right flags into a bash or powershell script. Terraform can perform these tasks in a semi disjointed way but it involves state managemnent of entire infrastructure and the blast radius is quiet high for any misconfigurations. EC2C is laser focused zero dependency CLI tool to migrate EC2 instances in a fool proof way.
- Shows you a list of EC2 instances from the AWS account and chosen Region as per AWS credentials
- Creates Amaxzon Machine Images for chosen EC2 instances.
- Waits untill the images are in "available" status. Time taken depends on time taken for a snapshot to be created. Depends on the size of disk. For timeliness timeout occurs after 40 minutes.
- Asks for target AWS account number. Thsi is the AWS account where you would want the EC2 instances to be migrated.
- Changes permissions on newly created images. Adds the target account as a shared account for the image.
- AWS credentials from source account with appropriate persmissions to create an AMI
- Target AWS account number
Chose the right artifact for your CPU architecture and OS type from https://github.com/bit-cloner/ec2c/releases
wget https://github.com/bit-cloner/ec2c/releases/download/0.9.1/ec2c-0.9.1-linux-amd64.tar.gz
tar -xvzf ec2c-0.9.1-linux-amd64.tar.gz
chmod +x ./ec2c
./ec2c
- Have an import mode so that the same CLI can be used to launch EC2s from shared AMI images
- Handle KMS keys and permissions propogation to target account
- Another Other features/ bugs , please file an issue
- Code optimization to take advantage of go routines and functions