Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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)

share|improve this question

3 Answers 3

up vote 2 down vote accepted

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).

share|improve this answer

As documentation says it is impossible to add instanse-store storage after EBS-backed AMI is started. It is possible to add a 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.
share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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