Tuesday, January 5, 2021

AWS - VM migration to AWS

 How to Migrate server to AWS
We will be using VMware VM to migrate to AWS

1. Create an IAM account with ec2 and s3 full access with programatic access to adminfull access
   Record the access and secret key. Do not share on public.

2. Import Virtual Machine to AWS
- Open your VMware and export your machine to OVF format

3. Install ec2-api-tools
# mkdir -m 777 /opt/Migration
# cd /opt.Migration
# wget http://launchpadlibrarian.net/111617788/ec2-api-tools_1.6.1.1-0ubuntu1_all.deb
# dpkg -i ec2-api-tools_1.6.1.1-0ubuntu1_all.deb
# ec2-version
 
4. Import the image
- Go to your bucket location where you have vmdk file
  # cd /opt/centosnet/centosnet7aa/centosnet02/

- Import *.vmdk file in s3 bucket
  # export AWS_ACCESS_KEY="Ky-access-Key"
  # export AWS_SECRET_KEY="my-sec-key"
  # ec2-import-instance CentOSnet4-bit-disk1.vmdk -f VMDK -t t2.micro -a x86_64 -b import-exportmas -p Linux -o $AWS_ACCESS_KEY -w $AWS_SECRET_KEY --region us-east-1

- Check the conversion status
  # ec2-describe-conversion-tasks  -O $AWS_ACCESS_KEY -W $AWS_SECRET_KEY --region us-east-1
 
  # ec2-describe-conversion-tasks import-i-fg7wgpui -O $AWS_ACCESS_KEY -W $AWS_SECRET_KEY --region us-east-1

- Check the instance list
  # ec2-describe-instances  -O $AWS_ACCESS_KEY -W $AWS_SECRET_KEY --region us-east-1

- Cancel conversion task
  # ec2-cancel-conversion-task  import-i-fh0pdfpb  -O $AWS_ACCESS_KEY -W $AWS_SECRET_KEY --region us-east-1

- Resume import
  # ec2-resume-import CentOSnet4-bit-disk1.vmdk -t import-i-fh0pdfpb -o $AWS_ACCESS_KEY -w $AWS_SECRET_KEY --region us-east-1

- Delete
  # ec2-delete-disk-image  -t import-i-fh0pdfpb -o $AWS_ACCESS_KEY -w $AWS_SECRET_KEY --region us-east-1

No comments:

Post a Comment

Git branch show detached HEAD

  Git branch show detached HEAD 1. List your branch $ git branch * (HEAD detached at f219e03)   00 2. Run re-set hard $ git reset --hard 3. ...