0

We are configuring an auto-scaling-group. We need that for each spawned instance a swap memory should get allocated and it should be deleted once the instance auto-terminates due to scale in property of ASG. Please help to achieve that

Nitin G
  • 714
  • 7
  • 31
  • Are you running Linux or Windows? If Linux, do you know how to configure swap? Are you looking to have swap on a separate EBS volume, or is the root volume sufficient? And most important, why do you want to configure swap, and how do you expect it to be used? – Parsifal Sep 08 '20 at 13:18
  • Hey @Parsifal Thanks for your response. We are using Linux. Yes we know how to configure swap. Yes we are using swap on a separate EBS volume, we want to configure swap because our EC2 instances are underutilized on the CPU front but overutilized on the Memory front so we dont want to spawn a larger instance infact using swap volume to add more virtual memory. – Nitin G Sep 09 '20 at 02:29

1 Answers1

0

Later, we realized that using a prebaked AMI along with added swap volume would be easier to manage and it will be added like the other EBS volume in the instance.

Nitin G
  • 714
  • 7
  • 31
  • To add this extra space to your instance you type: sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024 sudo /sbin/mkswap /var/swap.1 sudo chmod 600 /var/swap.1 sudo /sbin/swapon /var/swap.1 do you need more than 1024? – Jatin Mehrotra Sep 09 '20 at 05:50
  • 1
    As a warning, you're going to be in for a world of pain if you actively swap to an EBS volume. I recommend instead using one of the instance types with attached SSD, and put your swap there at startup. (this was one of the reasons that I asked those questions) – Parsifal Sep 10 '20 at 18:17