0

I found that even I use the same EC2 Ubuntu image (default), some machine type will has swap partition preconfigured, e.g. m1.small, but some are not, e.g. m1.medium.

Where can I found these information?

Ryan
  • 5,341
  • 21
  • 71
  • 87

3 Answers3

1

not sure bounty questions can be marked dups, but check this out:

==> Why don't EC2 ubuntu images have swap?

so the answer is either mount ebs, or use dd, to create file/partition available for mkswap/swapon, and then stick the entry in fstab to be reboot persistant

if your instance size comes with ephemeral space, as the larger ones do, that would be perfect for swap (even tho it is included for free, for ephemeral to be available, you have to specify it at instance launchtime with ec2-run-instance using "-b")

nandoP
  • 2,001
  • 14
  • 15
0

Not a direct answer, but you can create your own AWS image with swap configured exactly the way you want using Packer. You can provide your favorite EC2 image ID as the "source" image for packer.

The lack of swap space on many EC2 images has been discussed before.

Not Now
  • 3,532
  • 17
  • 18
0

The answer to your question is documented at: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html#InstanceStoreSwapVolumes

Here's a relevant excerpt:

Swap space in Linux can be used when a system requires more memory than it has been physically allocated. When swap space is enabled, Linux systems can swap infrequently used memory pages from physical memory to swap space (either a dedicated partition or a swap file in an existing file system) and free up that space for memory pages that require high speed access.

The c1.medium and m1.small instance types have a limited amount of physical memory to work with, and they are given a 900 MB swap volume at launch time to act as virtual memory for Linux AMIs. Although the Linux kernel sees this swap space as a partition on the root device, it is actually a separate instance store volume, regardless of your root device type.

Amazon Linux AMIs automatically enable and use this swap space, but your AMI may require some additional steps to recognize and use this swap space. To see if your instance is using swap space, you can use the swapon -s command.

user158845
  • 91
  • 1
  • 1
  • 4