简体   繁体   中英

Is an EC2 Instance's server code copied to other instances that are part of the Auto-Scaling Groups once they launch?

Question in title. Just wondering how this works: if you have an EC2 instance which serves some code (let's call it a simple web server), how is this code copied to the other EC2 instances if they are launched as part of the Auto-Scaling Group? I believe you can copy the AMI which has the operating system and perhaps some installations, but does it also have the files that are served?

Kind regards

If the files being served are part of the AMI yes. Otherwise now.

Basically an AMI is something in a form of a snapshot. Whatever was there when you created it will be on the new instance.

But if that's not the case you have several options to duplicate files across instances in auto scaling group:

  1. Execute your own code upon instance start as part of something called "user data". There you could download the files you want to serve. Obviously they may run out of sync between instances.

  2. Mount an additional EBS or EFS volume that will contain the files you want to serve.

  3. Serve file loaded from S3

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM