简体   繁体   中英

Amazon EC2, Auto-Scaling, AMIs, is there an easier way?

I have a production Rails app on my Amazon EC2 instance, and set up a load balancer and auto-scaling (I did this all manually, not using Elastic Beanstalk. I also used Dokku to make deployment easier.). I'm confused though. When new instances are needed and built with Auto-scaling, it appears as though I need to build an AMI, and then set the new instances (built via auto-scaling) to use this AMI.

But there must be an easier way. Am I missing something? With Heroku, you just add a dyno and BAM, you're done. Do I really need to copy my AMI and set it is as my auto-scaling image every time I deploy to production? Is there a command, workflow, or post-deployment script I should be using?

You need to specify a AMI which contains the basic set up of the your production node. The usually best practice is to config the auto scale with a user data script. So when the new AMI boots up during the auto scaling it reads the user data (cloud init/upstart). The user data script can pull the code from the git or what ever source control and run the necessary pre-deployment commands. You can't be copying new AMI config to your auto scaling config every time you deploy the code.

I hope it makes sense to have a master AMI and so some kind of automation like user data script which run specific commands as soon as it boots the production node and then attaches to ELB.

There is a blog post covering dokku-based deployments using Opsworks here . One of the other Dokku maintainers (Michael Hobbs) uses this setup in production.

Note: I am one of the Dokku Maintainers, josegonzalez .

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