EC2 Autoscalling

0

Hello, I would like some help, I have to deploy 4 applications, 3 of these run in docker in different containers with their respective images and one in a binary form (moodle), some are already deployed in ECS but I want to move them to EC2, the volume that use for one of them is EFS, having said that I want to use autoscalling with ec2, I understand that the EFS have to be mounted by input commands in the launch template that you configure, but I have a question when you access the first instance and install everything What I need is to say docker and the repositories, every time my autoscalling group scales horizontally duplicating this instance the other new instance will also have the EFS available AND the applications that deploy in the first one? If there is a better way to do this, I would like advice too, thank you very much.

1 Answer
3

Hello.

If you set up an AMI to be used with AutoScaling in advance and create a launch template based on it, you will be able to use EFS on EC2 launched with AutoScaling.
It is also possible to set user data and mount it when EC2 starts, as in the example CloudFormation template below.
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-efs.html
https://medium.com/@sunilrm1998/elastic-file-system-on-auto-scaling-instances-with-custom-vpc-a796238e9fbf

Alternatively, you can create an EC2 instance, edit its "/etc/fstab" file to automatically mount the EFS at EC2 startup, then create an AMI from that EC2 instance and use it to create a launch template.

profile picture
EXPERT
answered a month ago
profile picture
EXPERT
reviewed a month 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