0

I have a customized AMI, and when I launch instance from this AMI, if I choose m1.small, I will have a 895MB swap space; when I choose m1.medium, I will have 0 swap space, why is that?

If I want my m1.medium also use swap space from the instance store, what should I do? (without the need to terminate my instance)

(Both are ebs root instance)

3 Answers 3

2

AWS is funky that way. While I'm not completely familiar with AMIs to know how they function with instance stores, you can add a swap space like any other drive. Full instructions can be found here: http://www.cyberciti.biz/faq/linux-add-a-swap-file-howto/

Simply replace the path it references with the one for your instance store (use df -h and it's typically the much larger one).

0

The c1.medium and m1.small instance types has very limited memory, so limited that amazon provides them with an additional instance store for swap. The amazon ami's detect this block device automatically. If your ami was based on one of those then that is probably why.

However as your instance is using ebs for the root volume, you can add the normal instance store as a secondary drive, but you need to change its mapping to something other than /dev/sda* as this is used for the ebs volume. Unfortunately this mapping has to be defined when creating the ami or the instance. With the command lsblk you can list available block devices and to check if there is a secondary drive available for mounting.

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html#InstanceStoreSwapVolumes

0

As the documentation says it is impossible to add instance-store storage after an EBS-backed AMI is started. It is possible to add an EBS disk and use it as a swap device, but I doubt you'll be satisfied with its performance (or price if you use Provisioned IOPS EBS volume) The only way to get instance-store on a EBS-backed AMI is

  • either map it while creating an AMI image, or
  • map it while creating an instance.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .