I run eb init and deploy, I get the node.js version 6, how can I specify that I want node.js version 8 when executing eb init command?
This is an interesting question and I would love to know if there's an easier way, but here's how I got it working:
Determine the latest SolutionStack name as listed here. Presently, this is "64bit Amazon Linux 2017.09 v4.4.4 running Node.js".
Perform eb init -p "64bit Amazon Linux 2017.09 v4.4.4 running Node.js"
create a .ebextensions directory.
create a file .ebextensions/nodejs_version.config
add the following snippet to it:
option_settings:
aws:elasticbeanstalk:container:nodejs:
NodeVersion: 8.9.3
eb create
Once the environment has begun building, you can execute:
aws elasticbeanstalk describe-configuration-settings \
--environment-name <environment-name> \
--application-name <application-name>
Look for option settings in the aws:elasticbeanstalk:container:nodejs namespace and you should see the NodeVersion assigned to 8.9.3.
Ideally, "64bit Amazon Linux 2017.09 v4.4.4 running Node.js" itself should identify the latest version; you shouldn't need to add an option setting for this, unfortunately that is not so.
Please check below link for supported version of node.js:
Elastic Beanstalk supported platforms
Then you can use below command with your specified version:
eb init myapp --platform node.js-16
open the config file in the elasticbeanstalk directory and put the version you
Use the -p parameter
eb init -p "node.js 8.9.3"
Or any other version that is supported
Related
I have Elastic Beanstalk environment for NodeJS application
Platform Node.js 16 running on 64bit Amazon Linux 2/5.6.1
I need to run phpmyadmin by docker on this environment
I try to run phpmyadmin by docker, but can't install it , for this I use the code below:
Is it possible to install and run docker on nodejs platform using hooks or other ways?
System specification -
node version - v10.15.0
npm version - 6.4.1
aws-cli version - aws-cli/1.16.81 Python/3.6.0 Windows/10 botocore/1.12.71
sam-cli version - SAM CLI, version 0.41.0
Running on a windows machine.
So I have a node project, which would be deployed to aws-sam. I have scripts for sam-validate, prepare, package. But when I run this script via npm run <package-name>, commands don't run. For example If I run npm run package, I get the following -
aws --region <region-name> s3api head-bucket --bucket <bucket-name>
Command not run
Command executed in 0 msec
aws --region <<region-name>> cloudformation package --template-file template.yaml --s3-bucket <bucket-name> --output-template-file template-deploy.yaml
Command not run
Command executed in 0 msec
But surprisingly If I run those commands from powershell individually, then it works fine. Which made me come to the realization that scripts are okay, as the generated commands do work when I run them individually.
I checked my environment variables. All the things(node path, aws cli path etc.) are there.
What am I missing here? Simply put the problem is - Do I need to do anything else to run aws-cli or sam-cli commands through node scripts?
There might be an issue with your scripts i think,
Consider writing the script in python like
import subprocesses
commandToBeExecutedOnShell='any command'
subprocess.check_call(commandToBeExecutedOnShell, shell=True)
You can then either run the scripts from python itself or
create a separate node app which calls python functions
Reference This
and then run that node app using npm run
I have node 5.1 installed but in order to build some projects I need node 4 installed in order to do that. When I donwloaded the node 4 installer it is says that I have newer version already installed:
I would use Docker and run different Node versions inside separate containers, start and stop when needed.
Look at the official Node repo https://hub.docker.com/_/node/. There are all versions from 0.10 to 5.1.1 available.
Inside the project folder where you need a specific Node version, create a Dockerfile file and put this in:
FROM node:5.1.1
EXPOSE 8000 // The port on which your Node app runs
Then build the image from this config file by running:
$ docker build -t yourappname .
Finally run it:
$ docker run -it --rm --name yourappinstance yourappname
For another project you do the same except specifying a different Node version.
If you want to keep your Windows environment, use a Node version manager- for instance Nodist: https://github.com/marcelklehr/nodist
It will allow you to choose the version you require for your different projects.
NPM Private Modules look great, but I'm not sure how to install them on an AWS Beanstalk instance.
Is there any literature published on this?
Also, on the default Node.js configuration Beanstalk uses npm version 2.7.4. Will this be a problem?
Well, then add your repository (keys etc.) into the config in startup commands of elastic-beanstalk .ebextensions/00-my-tasks.config:
container_commands:
00-my-task:
command: echo "some config" >> /etc/config_of_npm
Idk, how exactly this works for npm, but it's possible to do that with private docker repositories. You can basically "hack" there anything, including update of some utilities if needed. I hope it helps you.
I created an elastic beanstalk node.js app on AWS, which created the EC2 and RDS server for me. I am using putty to connect to my Linux EC2 instance, which is successfully logged in.
But the following command doesn't work:
node -v
npm install express -g
node
it gives me an error:
bash: node: command not found
Node is automatically installed on your instance for elastic beanstalk. It's not in the path.
Look for node installation under /opt/elasticbeanstalk/node-install/ folder.
You shouldn't be installing modules from command line. The preferred way to install node modules on elastic beanstalk is thru package.json. Dependent modules are automatically installed on the instance by aws.
you should find out which node version is being used right now. Then you can use that in your PATH and use npm/node binary..
grep node /var/log/nodejs/nodejs.log
export PATH=$PATH:/opt/elasticbeanstalk/node-install/node-v6.11.5-linux-x64/bin/
Assuming you're using Amazon Linux 3.4:
> rpm -Uvh http://download-i2.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
> sudo yum install nodejs npm --enablerepo=epel
That should do it.
You can find out where node is installed, and npm, by running ps aux | grep node. This will show you the directory it is being run out of. This is how they give you the ability to pick your version of node, by installing multiple versions. But as palanik says, no need to try to do this manually, unless you are trouble shooting. Which is the PITA on AWS, but that's another discussion.