Node-RED for AWS Elastic Beanstalk w/ or w/o reverse proxy.
If you have not created EB yet I strongly recommend to do the followings tutorials first. AWS will create some roles include aws-elasticbeanstalk-ec2-role for EB automatically.
Getting Started Using Elastic Beanstalk - AWS Elastic Beanstalk
Login to the AWS Console on your browser, select Identity and Access Management (IAM) and add the AmazonS3FullAccess policy to the aws-elasticbeanstalk-ec2-role.
First of all, you get eb-node-red project from github in your working directory.
$ git clone https://github.com/toconuts/eb-node-red.git
$ cd eb-node-red
$ git init
Defines the options if you required copy ./settings.js.dist, paste it name as ./settings.js then configure your settings for Node-RED.
$ cp settings.js.dist settings.js
- awsRegion: region name to create eb-node-red.
- awsS3Appname: application name usually used the same name as value of "name" key in ./package.json.
- awsS3Bucket: bucket name to use. node-red-contrib-storage-s3 modules will create application name directory under this bucket.
You can also choose a reverse proxy at ./.ebextensions/proxy.config
option_settings:
aws:elasticbeanstalk:container:nodejs:
ProxyServer: <nginx> | <apache> | <none>
$ eb init
$ eb create
You can create a single instance, with option --single
$ eb create --single
You can create a instance in your vpc
$ eb create --vpc.id vpc-xxxxxx --vpc.ec2subnets subnet-xxxxx,subnet-xxxxx --vpc.publicip --vpc.elbpublic
- --vpc.publicip: EC2 will be attached to public IP
- --vpc.elbpublic: without this option, EC2 will be created internally
$ sudo iptables -t nat -S PREROUTING -v
If you choose nginx as proxy
$ cat /etc/nginx/conf.d/00_elastic_beanstalk_proxy.conf
You can see listening ports of node and reverse proxy if you choose.
$ sudo netstat -anp
PORT variable will show you listening port.
$ sudo od -S1 -An /proc/$(ps aux | grep ^nodejs | perl -anlE 'say $F[1]' | tail -1)/environ