EC2 Autoscaling

0

I have a question. I'm running my entire infrastructure in EC2. If I autoscale it 1st step is to create an AMI. But after taking creating an image. How should I capture and save my live data from user. Autoscaling is working fine but how should I save the data. I'm new to it. Please, If anyone have an idea please help.

2 Answers
0

Hi Devashish Rokshit

My understanding is you want to capture and save the live data.

What you want to know is how to save the data. I am quite not sure about the quesiton. But let me assume there are two scenario;

  1. Scale-out event, new instance will have empty data. You need to fill the instance with the data.
  2. Scale-in event, existing instance will be removed. You need to save the data before the instance terminated.

Either scenario, the best approach is using EFS. EFS is storage living on network (VPC). you can mount EFS drive on multiple instance under Autoscaling group. This way, you don't have to worry about scaling event. Enter image description here

Check this page to learn more https://docs.aws.amazon.com/efs/latest/ug/how-it-works.html

profile pictureAWS
EXPERT
Resa
answered 2 years ago
0

EFS as described above would definitely work but it may be costly compared to EBS volumes. You can also take advantage of lifecycle hooks. You can define a specific procedure before scaling-out ( copy data to another storage solution or S3 bucket ). You can have this lifecycle hooks for scale - in or out meaning that you can even copy data or run a script before scale-in and before your instance comes in-service.

Summary of how it works: An Amazon EC2 instance transitions through different states from the time it launches until it is terminated. You can create lifecycle hooks to act when an instance transitions into a wait state. The lifecycle hook puts the instance into a wait state (Pending:Wait) and then performs a custom action. https://docs.aws.amazon.com/autoscaling/ec2/userguide/lifecycle-hooks-overview.html

AWS
mojtoth
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions