Node.js App Server Layer Reference
Important
AWS OpsWorks Stacks is no longer accepting new customers. Existing customers will be able to use the OpsWorks console, API, CLI, and CloudFormation resources as normal until May 26, 2024, at which time they will be discontinued. To prepare for this transition, we recommend you transition your stacks to AWS Systems Manager as soon as possible. For more information, see AWS OpsWorks Stacks End of Life FAQs and Migrating your AWS OpsWorks Stacks applications to AWS Systems Manager Application Manager.
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);