Beanstalk: Node.js deployment – node-gyp fails due to permission denied

Solution The solution is to add the file .npmrc to the application with the content: # Force npm to run node-gyp also as root, preventing permission denied errors in AWS with npm@5 unsafe-perm=true (Or configuring npm so in any other way. (Though setting npm_config_unsafe_perm=true in /opt/elasticbeanstalk/env.vars did not work for me.) Explanation npm install is … Read more

How do you pass custom environment variable on Amazon Elastic Beanstalk (AWS EBS)?

As a heads up to anyone who uses the .ebextensions/*.config way: nowadays you can add, edit and remove environment variables in the Elastic Beanstalk web interface. The variables are under Configuration → Software Configuration: Creating the vars in .ebextensions like in Onema’s answer still works. It can even be preferable, e.g. if you will deploy … Read more

AWS Elastic Beanstalk, running a cronjob

This is how I added a cron job to Elastic Beanstalk: Create a folder at the root of your application called .ebextensions if it doesn’t exist already. Then create a config file inside the .ebextensions folder. I’ll use example.config for illustration purposes. Then add this to example.config container_commands: 01_some_cron_job: command: “cat .ebextensions/some_cron_job.txt > /etc/cron.d/some_cron_job && … Read more

Increasing client_max_body_size in Nginx conf on AWS Elastic Beanstalk

There are two methods you can take for this. Unfortunately some work for some EB application types and some work for others. Supported/recommended in AWS documentation For some application types, like Java SE, Go, Node.js, and maybe Ruby (it’s not documented for Ruby, but all the other Nginx platforms seem to support this), Elasticbeanstalk has … Read more