Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updating Nodejs version in Elastic Beanstalk

We are having some problems with the node version in production, so we changed the version required in the package.json from 0.10.0 to 6.2.2..

  "engines": {
    "node": ">= 6.2.2"
  }

However in Elastic Beanstalk, when new instances are created they appear with node version of 0.10.0. How can we update the version in Elastic Beanstalk so the new instances created have the required version placed in package.json?

Thank you very much.

like image 778
Guillermo Avatar asked Aug 16 '16 13:08

Guillermo


1 Answers

Verifying the version is supported

Most newer Beanstalk platforms have up to 6.2.2 for Node.js so if your platform version is up to date you should have it (current platform version for Node.js is v2.1.3).

If you do not want to update your current platform you can verify which versions are valid using the AWS CLI:

aws elasticbeanstalk describe-configuration-options --solution-stack-name "64bit Amazon Linux 2016.03 v2.1.3 running Node.js" --options "OptionName=NodeVersion, Namespace=aws:elasticbeanstalk:container:nodejs"

Which should return something like:

{
    "Options": [
        {
            "Name": "NodeVersion",
            "UserDefined": false,
            "DefaultValue": "4.4.6",
            "ChangeSeverity": "RestartApplicationServer",
            "Namespace": "aws:elasticbeanstalk:container:nodejs",
            "ValueType": "Scalar",
            "ValueOptions": [
                "0.8.28",
                "0.10.46",
                "0.12.15",
                "4.4.6",
                "5.12.0",
                "6.2.2"
            ]
        }
    ],
    "SolutionStackName": "64bit Amazon Linux 2016.03 v2.1.3 running Node.js"
}

Making it work

In order for your application to start up with correct Node version you will have to set the option setting for the specific version. This can be done multiple ways.

Web UI

Navigate to the Configuration tab for your environment and then into the Software Configuration panel to change the Node version setting. Click apply when you are finished to deploy the changes to your environment.

AWS CLI

You can update your environment with the correct option setting via the command line interface.

aws elasticbeanstalk update-environment --environment-name yourEnvName --option-settings "OptionName=NodeVersion, Namespace=aws:elasticbeanstalk:container:nodejs, Value=6.2.2"

Here are some additional option settings specific to the Node.js platform.

like image 129
nbalas Avatar answered Sep 21 '22 20:09

nbalas