AWS Elastic Beanstalk - How To Upgrade Existing Environment from Ruby 2.1 to Ruby 2.2

梦想与她 提交于 2019-11-28 18:17:14

I found a solution for this, by using the aws cli (NOT the eb cli):

aws elasticbeanstalk update-environment --solution-stack-name "64bit Amazon Linux 2016.03 v2.1.0 running Ruby 2.3 (Puma)" --environment-name "dev-bg-123456" --region "us-east-1"

The aws cli can be installed with homebrew:

brew install awscli

My solution to this challenge was to:

  1. Launch a brand new environment.
  2. Create a Web Application or Worker.
  3. Choose the environment you want, likely the latest greatest. In my case Passenger with Ruby-2.2.
  4. I choose to deploy the Sample Application so that the new environment succeeds.
  5. Choose the remaining options for your new environment and let it launch.

Upon successful launch, I set up all my environment variable; e.g. all my database, smtp, RAILS_ENV/RACK_ENV, etc. Then I go to my previously deployed applications, and simply deploy my latest quality version to the brand new environment.

One would agree that this is a lot more work than a simple eb upgrade. Lame sauce.

I found a different approach to this problem.

The way I made it work is similar to the comment above but I managed to update the existing beanstalk environment and not deploy code to a completely new one.

Steps I did:

  1. Launched a completely new environment on beanstalk running the ruby version that I need, 2.3 (in my case I needed an update from Ruby 2.2 to Ruby 2.3)
  2. SSH-ed into the new instance and installed all dependencies that my application needs (packages, dev tools etc.) - you can also do these in the .ebextensions directory
  3. Created a custom AMI from the instance running ruby 2.3 with everything installed
  4. Used the same command that Ralph posted but with some tweeks:
aws elasticbeanstalk update-environment --region "REGION" --environment-name "ENV_NAME" --solution-stack-name "64bit Amazon Linux 2018.03 v2.8.1 running Ruby 2.3 (Puma)" --option-settings Namespace=aws:autoscaling:launchconfiguration,OptionName=ImageId,Value="ami- 
xxxxxxxx"

The AMI option-settings was key for me, as this helped me the AMI with ruby 2.3.7 installed to be used for launching the new instance on the existing environment. Previously just hitting Ralph's suggested command failed on every try.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!