1

I am trying to customize an existing Debian Jessie HVM AMI(ami-116d857a) and store it as my private AMI. Though the AMI creation process succeeds, I am unable to boot from it. The instance shows started but I am not able to connect via ssh and monitoring also shows ssh connectivity is not available. I see the same issue with any other HVM AMIs. The same procedure works perfectly if it is a PVM AMI.

Here's the procedure I follow

  • Boot from an available AMI.
  • Install additional packages from package manager.
  • Install npm modules.(nodejs and npm have been installed in the previous step)
  • Install all available system upgrades.
  • Download and unarchive ec2-ami-tools in /opt.
  • SCP private key and certificate to the instance.
  • Create image of the instance using the following command

    /opt/ec2-ami-tools-1.5.7/bin/ec2-bundle-vol -c /home/admin/cert.pem -k /home/admin/pk.pem -u $aws_account_id -p $image_prefix -B ami=sda,root=/dev/sda1 --batch --debug

  • Then upload it to an existing S3 Bucket

    /opt/ec2-ami-tools-1.5.7/bin/ec2-upload-bundle -b my-ami-images -m /mnt/$image_prefix.manifest.xml -a $access_key -s $access_secret --retry --de bug

  • And then finally register the AMI

    aws ec2 register-image --name $image_prefix --image-location my-ami-images/$image_prefix.manifest.xml --region us-east-1 --virtualization-type hvm --root-device-name /dev/xvda1

All of these steps go fine without any error and I can see the AMI listed in my account with root device as instance store and virtualization type as HVM.

  • Are you intentionally creating an S3-backed AMI? Is your source AMI image an S3-backed AMI or an EBS-backed AMI? – Matt Houser Sep 24 '15 at 3:16
  • Consider using packer – jordanm Sep 24 '15 at 3:17
  • @MattHouser the source is an EBS backed AMI. Would it be more advisable to create an S3 backed AMI after customisation as well? – mehulved Sep 24 '15 at 7:09
  • test doing fewer of those steps – Skaperen Sep 25 '15 at 13:16
1

Your current AMI-creation process is creating an S3-backed (instance store) AMI image. But your source AMI is an EBS-backed AMI. You need to use a different method to create your AMI which will create an EBS-backed AMI.

Instead of bundling your instance and registering the AMI, do the following:

  1. Stop your EC2 instance.
  2. Using the AWS Management Console, select your EC2 instance and from the Actions menu select "Create Image". This will create an EBS-backed AMI image.

More information about creating EBS-backed AMI images can be found here:

Creating an Amazon EBS-Backed Linux AMI | Amazon Elastic Compute Cloud

  • Thank you @matt. That did work. Though it does solve my issue here, I'd love to understand why the same process worked for PVM but not for HVM AMIs. I guess, I'll have to read up more and understand the concepts better. – mehulved Sep 28 '15 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.