How to define the version of nodejs for my beanstalk in cloudformation

Viewed 383

I am trying to create a beanstalk with a specific version of nodejs:

Here is my setting option of my beanstalk in cloudformation:

    "configurationTemplate": {
  "Type": "AWS::ElasticBeanstalk::ConfigurationTemplate",
  "Properties": {
    "ApplicationName": {
      "Ref": "xxxxx"
    },
    "Description": "AWS ElasticBeanstalk Sample Configuration Template",
    "OptionSettings": [
      {
        "Namespace": "aws:autoscaling:asg",
        "OptionName": "MinSize",
        "Value": {
          "Ref": "MinEc2s"
        }
      },
      {
        "Namespace": "aws:autoscaling:asg",
        "OptionName": "MaxSize",
        "Value": {
          "Ref": "MaxEc2s"
        }
      },
      {
        "Namespace": "aws:elasticbeanstalk:environment",
        "OptionName": "EnvironmentType",
        "Value": "LoadBalanced"
      },
      {
        "Namespace": "aws:autoscaling:launchconfiguration",
        "OptionName": "InstanceType",
        "Value": {
          "Ref": "InstanceType"
        }
      },
      {
        "Namespace": "aws:ec2:vpc",
        "OptionName": "VPCId",
        "Value": {
          "Ref": "VpcIdBn"
        }
      },
      {
        "Namespace": "aws:ec2:vpc",
        "OptionName": "Subnets",
        "Value": {
          "Ref": "SubnetIds"
        }
      }
     ],
     "SolutionStackName": "64bit Amazon Linux 2017.03 v4.2.0 running 
      Node.js"
  }
}

as you see I define the stacksolution I need as follows:

"SolutionStackName": "64bit Amazon Linux 2017.03 v4.2.0 running 
      Node.js"

When I run this everything works fine and my beanstalk gets created but with the node version 6.x.x however I need the newer version of nodejs. I checked the benastalk I created manually and I noticed that beanstalk can accept version 7.10.1 which is the version I need. So I changed the stacksolution as follows:

"SolutionStackName": "64bit Amazon Linux 2017.03 v4.2.0 running 
      Node.js 7.10.1"

When I run the cloudformation it fails to run. So is there anything I am missing? How can I define the version of node I wannat install? Any idea?

1 Answers

Have you tried adding the code below?

  OptionSettings:
  - Namespace: aws:elasticbeanstalk:container:nodejs
    OptionName: NodeVersion
    Value: "8.11.3"
Related