Score:0

AWS EC2 | increase/decrease RAM dynamically

cn flag

Is there a way to choose a VM or other service in AWS to dynamically add memory in case of extra load?

I am going to deploy a small EC2 in AWS. And I don't need too much memory because it will be loaded only while downloading reports from DB. So basically I am looking for the cheapest possible solution, as the machine will be idle 90 % of the time.

Score:1
cn flag

To expand on @AlexD's answer, Lambda is a good tool if you can have it perform the task you need to. Other options include using a Docker container running in ECS Fargate (which is also 'serverless'), or using a small EC2 instance with the CloudWatch Agent installed (to report memory usage) and setting up AutoScaling.

Score:1
jp flag

It is not possible to dynamically adjust EC2 instance memory without changing instance type and stopping and starting the instance. To avoid running an instance idle you can start and stop it on a schedule using AWS Instance Schedule. Alternatively, you can run AWS Lambda on a schedule or on an event.

user16894409 avatar
cn flag
Dear Alex, thanks for your answer.
Score:0
br flag

If you're worried that the instance may run out of memory and have processes crashing, instead of adjusting the instance size you could also add a swap partition to it so that the operating system can offload process memory to disk in case it runs out of physical memory. This will come at a performance hit though as EBS storage is attached via the network and not all instance types allow you to use instance storage that is located on the physical server where your instance is being hosted. But in some cases it would be a better scenario than having your processes crash.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.