Upgrading AWS EB Platform version from 2.0.1 to 3.1.0 - node.js

My current platform version is: Node.js running on 64bit Amazon Linux/2.0.1
Which support following NodeJS versions: 0.12.6, 0.10.39, 0.10.38, 0.10.31, 0.8.28
I am looking a way to upgrade the NodeJS version: 4.x.x which seems to be available in platform version: Node.js running on 64bit Amazon Linux/3.1.0
but when I am upgrading it. it's says
How can I select the allowed version as it's not available.
Any Help,
Thanks,
P.S
1. Already tried via save / load configurations. Unable to find any option there.
2. Don't want to do setup it from the scratch for now.

First, ensure that you have tested the changes adequately before deploying to production. After that, you can:
Note the name of the Platform ARN/Solution Stack you want to upgrade to.
Perform eb init --region REGION_NAME and pick the application and environment you are working on
Perform eb config. This opens your environment's configuration in an editor. Change the value of the PlatformArn to the one you noted above in step 1.
Also in the editor, find the option setting aws:elasticbeanstalk:container:nodejs. Change the NodeVersion to 6.9.1 or one that the error message above suggests.
Save and quit.
After the configuration is complete:
Perform eb status to verify that your environment is using the upgraded Solution Stack.

You can clone the existing environment to a new one, using a different platform version.
In the Actions menu, select "Clone with the latest platform".
That opens a new page where you can select from available OS/nodejs versions.
Once you are satisfied with the new environment, you can swap URLs with the old one in order to replace it. After that, you can remove the older env.

This has happened a few times before when Amazon releases new Environments and they do not include versions in common between the environments. The solution is to set value for nodejs version to an empty string which means to use the latest version. It could break your app, but you can make a clone with latest platform and switch to desired version of nodejs later. So run this command to do that:
aws elasticbeanstalk update-environment --region "your region" --application-name "your app" --environment-name "your env" --option-settings "OptionName=NodeVersion,Namespace=aws:elasticbeanstalk:container:nodejs,Value=''"

Related

EB CLI "eb create" ERROR: InvalidParameterValueError - Platform ARN is invalid

I'm trying to create an Elastic Beanstalk node.js environment via the EB CLI. I've ran eb init in my code repo, and this doesn't give me any issues.
Next, when I run eb create to create the environment, I receive the error ERROR: InvalidParameterValueError - Platform ARN is invalid: Not an IAM ARN: 64bit Amazon Linux 2018.03 v4.15.2 running Node.js.
I've searched for this error, it seems like I need to update the platform version, but I can't figure out how to do that.
I also downgraded my node version from v12.18.4 to v12.18.3 because the EB docs didn't say that v12.18.4 was supported.
You can just run:
eb platform select
to select new default platform. Nevertheless, your platform seems fine as it is current one as listed here. Thus there maybe something else causing this error. But still maybe worth changing or re-selecting the platform version.
I ran into a very similar issue with a Python project containing a Dockerfile.
Inside the project I ran eb create --database (version EB CLI 3.19.3).
It prompted me to pick an environment name and DNS CNAME prefix, which was fine.
It then asked to Select a load balancer type.
I picked the default, which is 2 (application).
As soon as I hit enter, I got the following error:
ERROR: InvalidParameterValueError - Platform ARN is invalid: Not an IAM ARN: 64bit Amazon Linux 2 v3.2.4 running Docker.
Following Marcin's hint I ran eb platform select.
It prompted me about Docker:
It appears you are using Docker. Is this correct?
(Y/n): y
It then prompted me to select a platform:
Select a platform branch.
1) Docker running on 64bit Amazon Linux 2
2) Multi-container Docker running on 64bit Amazon Linux
3) Docker running on 64bit Amazon Linux
(default is 1): 1
This solved the problem.
Even though this is (seemingly) the same setup that was picked by default, eb create --database worked without the error afterwards, and even eb status show
Platform: arn:aws:elasticbeanstalk:eu-west-2::platform/Docker running on 64bit Amazon Linux 2/3.2.4
eb platform select - overrides the default platform. In cases, where you want to create an environment that uses a different platform than default one, we can simply provide -p or --provide then the platform.
I was able to successfully do it by running the following command using nodev16 platform
eb create --platform "Node.js 16 running on 64bit Amazon Linux 2"
I ended up creating the environment in the EB console instead of the CLI. The environment was created successfully from here.

How to configure latest nodejs in OpenShift?

Today OpenShift supports nodejs version 4, my application in on 6.9.4 LTS.
Is it possible to override default settings and install latest nodejs in OpenShift cartridge?
I am aware about this custom cartridge, my question is on how we could install latest nodejs?
As mentioned this docuentation about Marker" you can specify your NodeJS version by creating a file named NODEJS_VERSION and put your version you needed inside it.
Of course you have to clone it first via git on address specified on your Application setting (called "Source Code" on upper right corner).
git push it would trigger a build and deploy

Update the local debian packages using ansible

I am trying to come up with a deployment strategy in developer environments using Ansible.
I have a few builds (node.js) coming out every day usually in the form of debian packages.
Eg: my_product_1.0.0_33.deb is the corresponding debian for build#33.
I am trying to automate the deployment on existing as well as new environments using Ansible. So what is the preferred way of updating the build packages using Ansible?
Eg: my_product_1.0.0_44.deb is my new build with build id #44 which I want to install on top of the existing build.
I am going through the Ansible documentation and below mentioned is the way I think will work for now.
Check if any package of "my_product" is installed and if not installed, install the latest debian.
If yes, check if the right build id of my_product is installed
If yes, don't restart the service and leave as is
If no, uninstall the existing package, install the new build debian and restart the service.
Is this the preferred approach of updating the debian packages in an environment or is there a better way to do this in Ansible?
The debian packages I receive are not hosted in any repository and are local .deb files.
Is this the preferred approach of updating the debian packages in an
environment or is there a better way to do this in Ansible?
This is a reasonably common approach. It could be simplified a bit by hosting your debs on an internal repo, but that's not necessary.
In general, you don't need to do things like "check if a package is installed and if not, install the latest version". You just specify the package name to the apt module and it handles the conditional logic for you.
For restarting the service if a new version has been deployed, look into handlers.

Updating Elastic Beanstalk stack and NodeJS at the same time

The Problem:
Elastic Beanstalk versions only support specific versions of NodeJS.
EG:
2.0.7 supports Node 0.12.9
2.1.3 supports Node 0.12.15
There are no longer nice 'bridging' versions so you can update the Environment and wait for it to become stable before updating the NodeJS version.
Is there any way to update both at once?
I tried doing it via the CLI with:
aws elasticbeanstalk update-environment --environment-name environment-name --solution-stack-name "64bit Amazon Linux 2016.03 v2.1.3 running Node.js" --option-settings "OptionName=NodeVersion, Namespace=aws:elasticbeanstalk:container:nodejs, Value=0.12.15"
That only updated the NodeJS version to an invalid value, putting the Environment out of order with seemingly no way to recover it.
Alternatively, is there some other way to do this?

Update my AWS EB Node.js to version 6.0.0

Is there anyway to push my EB instance to run a later node.js version, the docs here say that the supported platform version is only 4.4.3 but I need to run 6.0.0
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/concepts.platforms.html#concepts.platforms.nodejs
According to the official documentation it seems that only some versions are supported on Elastic Beanstalk (mainly 4.4.3 / 0.12.6 but not 6.0.0). You can still choose between these versions in the interface but not outside this list.
The only solution I see for now is to deploy your own stack directly on an EC2 instance without using the Elastic Beanstalk service.

Resources