Node.js App Server Layer Reference
Important
The AWS OpsWorks Stacks service reached end of life on May 26, 2024 and has been disabled for both new and existing customers.
We strongly recommend customers migrate their workloads to other solutions as soon as possible. If you have questions about migration, reach out to the AWS Support Team on AWS re:Post
Note
This layer is available only for Linux-based stacks.
A Node.js App Server layer supports a Node.js
Short name: nodejs-app
Compatibility: A Node.js App Server layer is compatible with the following layers: custom, db-master, memcached, and monitoring-master.
Open ports: A Node.js App Server layer allows public access to ports 22 (SSH), 80 (HTTP), 443 (HTTPS), and all ports from load balancers.
Autoassign Elastic IP addresses: Off by default
Default EBS volume: No
Default security group: AWS-OpsWorks-nodejs-App-Server
Setup recipes:
-
opsworks_initial_setup
-
ssh_host_keys
-
ssh_users
-
mysql::client
-
dependencies
-
ebs
-
opsworks_ganglia::client
-
opsworks_nodejs
-
opsworks_nodejs::npm
Configure recipes:
-
opsworks_ganglia::configure-client
-
ssh_users
-
agent_version
-
opsworks_nodejs::configure
Deploy recipes:
-
deploy::default
-
opsworks_nodejs
-
opsworks_nodejs::npm
-
deploy::nodejs
Undeploy recipes:
-
deploy::nodejs-undeploy
Shutdown recipes:
-
opsworks_shutdown::default
-
deploy::nodejs-stop
Installation:
-
Node.js installs to
/usr/local/bin/node
. -
For more information about how to produce log files, see How to log in node.js
on the Nodejitsu website.
Node.js application configuration:
-
The main file run by Node.js must be named
server.js
and reside in the root directory of the deployed application. -
The Node.js application must be set to listen on port 80 (or port 443, if applicable).
Note
Node.js apps that run Express commonly use the following code to set the
listening port, where process.env.PORT
represents the default port
and resolves to 80:
app.set('port', process.env.PORT || 3000);
With AWS OpsWorks Stacks, you must explicitly specify port 80, as follows:
app.set('port', 80);