2
votes

I'm developing an web application using Django and Elastic Beanstalk(AWS). Currently, I'm only using a free tier ec2 for the server tier.

What I am worry about is, custom setting on EC2 when autoscaling up.

python library "Pillow" needs an external library such as "libjpeg-turbo-devel" and "zlib-devel". This should be installed before all python library installed. There was no way to do this automatically using aws config file, so I installed the files manually by connecting to EC2 thorough ssh

When EC2 scaling up, this kind of manual settings would affect on the other EC2 instances?

If the scaling up acts like "copying the original EC2 instance", then there would be no problem. However, the process is just "deploying the application" to another ec2 instance, it wouldn't work because the manual setting has not beed applied.

Can someone explain how EC2 autoscaling works regarding this? Thanks!!

2

2 Answers

1
votes

First off, I would suggest reading the AutoScaling documentation.

http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/GettingStartedTutorial.html

AutoScaling will launch and terminate EC2 instances based on CloudWatch alerts and other rules. When AutoScaling launches a new EC2 instance, it is based on a particular AMI image. That AMI image can be one of Amazon's base AMI images, or it can be an AMI image that you have customized.

If you SSH into an EC2 instance that was part of an AutoScaling group, any changes done to it will not affect any other EC2 instance.

There are 2 main ways to customize the EC2 instances that are launched by AutoScaling:

  1. Launch from a fairly basic AMI image, and use some method of configuration management to customize the instance when it's created. You can use tools such as Chef, Ansible, etc.

  2. Launch an already-customized AMI image that you created. When you do this, the EC2 instance is pretty much ready-to-go.

If you have already customized an EC2 instance to your liking (by installing "libjpeg-turbo-devel" and "zlib-devel"), you can now create an AMI image from your EC2 instance and create and/or update your Launch Configuration configuring it to use your custom AMI.

This way, when AutoScaling creates a new EC2 instance, it will be based on your custom AMI that has already had your preferred libraries already installed.

1
votes

Beanstalk supports installing external packages (yum, pip, etc) through configuration. This would be recommended.

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#customize-containers-format-packages