Solve the AWS EC2 Centos 6 image limited to large type of instance

Update: Centos 6 instance failed to start in the Hong Kong region, stuck in status checks. (maybe network-scripts problem, will check it in future)

Centos 6 only can launch through AMI marketplace, and it’s restricted in certain regions, Hong Kong region can not launch it on a small type of instance, only works on i3.large or bigger, $0.206/hr.

We can launch a centos 6 instance in another region like Singapore, and delete the marketplace code in the default disk /dev/sda1, replace it with a new ebs disk.

  1. Launch a new centos 6  instance in Singapore or another region. (do not launch it in Hong Kong, too big and have problems)
  2. Create a new same size of EBS volume, 8G, and then attach it on the centos 6 instance, name it as “/dev/xvdj”
  3. SSH into your centos instance, formate the xvdj volume.
  4. $ mkfs -t ext4 /dev/xvdj
  5. Copy root volume to xvdj
  6. $ dd bs=128k if=/dev/xvda of=/dev/xvdj
  7. Shutdown the instance after complete
  8. Detach the two volumes together, and attach the xvdj as the root volume “dev/sda1”.
  9. Start the centos instance and check its success.
  10. Create an AMI for centos 6 instance, and then copy the ami to Hong Kong region.
  11. Launch a new centos 6 instance with copied AMI.