Installing Node.js NES on cloud providers
How to install Node.js NES on AWS and Google Cloud platforms
This guide shows how to run Node.js NES on cloud platforms that need a custom runtime or custom container image. For local, RHEL, and package-manager installation options, see the Node.js NES installation guide.
AWS Lambda installation
You can run Node.js NES in AWS Lambda by building a custom container image based on the Lambda provided.al2023 base.
Note that older NES version may not work on the Amazon Linux 2023 base image and might require the Amazon Linux 2 base instead.
Prerequisites
- An NES registry token with download access
- AWS CLI configured for the target account
FROM public.ecr.aws/amazonlinux/amazonlinux:2023
# Pin the Node.js NES version you want inside Lambda
ARG NODE_VERSION=v20.19.14-nes
# Provide your NES token at build time: --build-arg NES_TOKEN=...
ARG NES_TOKEN
ARG REGISTRY_BASE=https://registry.nes.herodevs.com/nodejs/nes
ENV NODE_DIR=/opt/node
RUN dnf install -y --allowerasing \
ca-certificates \
tar \
gzip \
shadow-utils \
curl \
cmake \
make \
gcc \
gcc-c++ \
python3 \
autoconf \
automake \
libtool \
&& dnf clean all
# Install Node.js NES
RUN curl -fSL -H "Authorization: Bearer ${NES_TOKEN}" "${REGISTRY_BASE}/${NODE_VERSION}/node-${NODE_VERSION}-linux-x64.tar.gz" -o /tmp/node.tgz \
&& mkdir -p ${NODE_DIR} \
&& tar -xzf /tmp/node.tgz -C ${NODE_DIR} --strip-components=1 \
&& rm /tmp/node.tgz
ENV PATH="${NODE_DIR}/bin:${PATH}" \
npm_config_nodedir=${NODE_DIR} \
npm_config_prefix=${NODE_DIR}
RUN node --version
RUN npm install -g aws-lambda-ric@3
COPY index.js ./
# Change the version to match the Node.js runtime you are using (eg nodejs18.x)
ENV AWS_EXECUTION_ENV=AWS_Lambda_nodejs20.x
ENTRYPOINT ["/opt/node/bin/node", "/opt/node/lib/node_modules/aws-lambda-ric/bin/index.mjs"]
CMD ["index.handler"]
For more background on Lambda container images and pushing to ECR, see the AWS guides for container images and ECR authentication.
AWS Fargate installation
You can run Node.js NES on AWS Fargate by building a custom container image that installs the Node.js NES binary, pushing the image to Amazon ECR, and running it as an Amazon ECS service with the Fargate launch type.
Prerequisites
- An NES registry token with download access
- AWS CLI configured for the target account
- Docker installed locally, or an equivalent container build system
- An ECS task execution role, such as
ecsTaskExecutionRole - Subnets and a security group that can run the Fargate service
FROM public.ecr.aws/amazonlinux/amazonlinux:2023
# Pin the Node.js NES version you want inside Fargate
ARG NODE_VERSION=v20.19.14-nes
# Provide your NES token at build time: --build-arg NES_TOKEN=...
ARG NES_TOKEN
ARG REGISTRY_BASE=https://registry.nes.herodevs.com/nodejs/nes
ENV NODE_DIR=/opt/node
WORKDIR /workspace
RUN dnf install -y \
ca-certificates \
curl \
gzip \
tar \
&& dnf clean all
# Install the custom Node.js NES build
RUN curl -fSL -H "Authorization: Bearer ${NES_TOKEN}" "${REGISTRY_BASE}/${NODE_VERSION}/node-${NODE_VERSION}-linux-x64.tar.gz" -o /tmp/node.tgz \
&& mkdir -p ${NODE_DIR} \
&& tar -xzf /tmp/node.tgz -C ${NODE_DIR} --strip-components=1 \
&& rm /tmp/node.tgz
ENV PATH="${NODE_DIR}/bin:${PATH}"
RUN node --version
COPY server.js ./
EXPOSE 3000
CMD ["node", "server.js"]
The local verification command should return JSON that includes the Node.js NES version from process.version.
For the deployed ECS service, route traffic to the task through your load balancer or use your preferred ECS service discovery pattern.
For more background on Fargate task definitions and service creation, see the AWS guides for creating an ECS Linux task for Fargate and Fargate task definition parameters.
AWS App Runner installation
You can run Node.js NES on AWS App Runner by building a custom container image that installs the Node.js NES binary, pushing the image to Amazon ECR, and creating an App Runner service from that image. App Runner starts the container image you provide, so the Node.js runtime comes from the binary installed in the Dockerfile instead of from an AWS-managed Node.js runtime.
AWS App Runner availability
AWS states that App Runner is no longer open to new customers as of April 30, 2026. Existing App Runner customers can continue to use the service.
Prerequisites
- An NES registry token with download access
- AWS CLI configured for the target account
- Docker installed locally, or an equivalent container build system
- An App Runner ECR access role that allows App Runner to pull the image
FROM public.ecr.aws/amazonlinux/amazonlinux:2023
# Pin the Node.js NES version you want inside App Runner
ARG NODE_VERSION=v20.19.14-nes
# Provide your NES token at build time: --build-arg NES_TOKEN=...
ARG NES_TOKEN
ARG REGISTRY_BASE=https://registry.nes.herodevs.com/nodejs/nes
ENV NODE_DIR=/opt/node
WORKDIR /workspace
RUN dnf install -y \
ca-certificates \
curl \
gzip \
tar \
&& dnf clean all
# Install the custom Node.js NES build
RUN curl -fSL -H "Authorization: Bearer ${NES_TOKEN}" "${REGISTRY_BASE}/${NODE_VERSION}/node-${NODE_VERSION}-linux-x64.tar.gz" -o /tmp/node.tgz \
&& mkdir -p ${NODE_DIR} \
&& tar -xzf /tmp/node.tgz -C ${NODE_DIR} --strip-components=1 \
&& rm /tmp/node.tgz
ENV PATH="${NODE_DIR}/bin:${PATH}"
RUN node --version
COPY server.js ./
EXPOSE 3000
CMD ["node", "server.js"]
The local verification command should return JSON that includes the Node.js NES version from process.version.
After the App Runner service reaches RUNNING, open the service URL returned by aws apprunner create-service to verify the deployed service.
For more background on image-based App Runner services, see the AWS guides for creating an App Runner service, App Runner services based on source images, and the create-service CLI reference.
Amazon EC2 applications installation
You can run Node.js NES on Amazon EC2 by downloading the Node.js NES binary onto a Linux instance and running your application with that runtime.
This example uses Amazon Linux 2023, installs Node.js NES in /opt/node, and starts a small HTTP application with systemd.
Prerequisites
- An NES registry token with download access
- An Amazon Linux 2023 EC2 instance, or a launch workflow that can provide EC2 user data
- A security group that allows inbound traffic to the port your application listens on
#!/bin/bash
set -euo pipefail
NODE_VERSION=v20.19.14-nes
NES_TOKEN=<your-nes-token>
REGISTRY_BASE=https://registry.nes.herodevs.com/nodejs/nes
NODE_DIR=/opt/node
APP_DIR=/opt/node-nes-app
dnf install -y \
ca-certificates \
curl \
gzip \
tar
curl -fSL -H "Authorization: Bearer ${NES_TOKEN}" \
"${REGISTRY_BASE}/${NODE_VERSION}/node-${NODE_VERSION}-linux-x64.tar.gz" \
-o /tmp/node.tgz
mkdir -p "${NODE_DIR}" "${APP_DIR}"
tar -xzf /tmp/node.tgz -C "${NODE_DIR}" --strip-components=1
rm /tmp/node.tgz
cat > "${APP_DIR}/server.js" <<'EOF'
import http from 'node:http';
const port = Number.parseInt(process.env.PORT || '3000', 10);
const server = http.createServer((req, res) => {
res.writeHead(200, { 'content-type': 'application/json' });
res.end(JSON.stringify({
nodeVersion: process.version,
path: req.url
}));
});
server.listen(port, '0.0.0.0');
EOF
cat > /etc/systemd/system/node-nes-app.service <<EOF
[Unit]
Description=Node.js NES application
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
WorkingDirectory=${APP_DIR}
Environment=PATH=${NODE_DIR}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
Environment=PORT=3000
ExecStart=${NODE_DIR}/bin/node ${APP_DIR}/server.js
Restart=always
RestartSec=5
User=ec2-user
[Install]
WantedBy=multi-user.target
EOF
chown -R ec2-user:ec2-user "${APP_DIR}"
systemctl daemon-reload
systemctl enable --now node-nes-app
The verification command should return JSON that includes the Node.js NES version from process.version.
For production applications, replace the example server.js with your deployed application and update WorkingDirectory, Environment, and ExecStart in the systemd unit.
EC2 user data can be viewed by users who can access the instance metadata or describe the instance, so avoid placing long-lived NES tokens directly in reusable launch templates. For more background on launch-time scripts, see the AWS guide for running commands with EC2 user data.
Google Cloud Run installation
You can run Node.js NES on Google Cloud Run by building a custom container image that downloads the Node.js NES binary during the image build. Cloud Run runs the container image you provide, so the Node.js runtime comes from the binary installed in the Dockerfile instead of from a Google-managed Node.js runtime image.
Prerequisites
- An NES registry token with download access
- Google Cloud CLI configured for the target project
- Docker installed locally, or an equivalent container build system
- Artifact Registry enabled in the target project
FROM debian:bookworm-slim
# Pin the Node.js NES version you want inside Cloud Run
ARG NODE_VERSION=v20.19.14-nes
# Provide your NES token at build time: --build-arg NES_TOKEN=...
ARG NES_TOKEN
ARG REGISTRY_BASE=https://registry.nes.herodevs.com/nodejs/nes
ENV NODE_DIR=/opt/node
WORKDIR /workspace
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
gzip \
tar \
&& rm -rf /var/lib/apt/lists/*
# Install the custom Node.js NES build
RUN curl -fSL -H "Authorization: Bearer ${NES_TOKEN}" "${REGISTRY_BASE}/${NODE_VERSION}/node-${NODE_VERSION}-linux-x64.tar.gz" -o /tmp/node.tgz \
&& mkdir -p ${NODE_DIR} \
&& tar -xzf /tmp/node.tgz -C ${NODE_DIR} --strip-components=1 \
&& rm /tmp/node.tgz
ENV PATH="${NODE_DIR}/bin:${PATH}"
RUN node --version
COPY server.js ./
CMD ["node", "server.js"]
The local and deployed verification commands should return JSON that includes the Node.js NES version from process.version. Cloud Run requires the container to listen on the port provided by the PORT environment variable and bind to 0.0.0.0.
For more background on Cloud Run container images and runtime requirements, see the Google Cloud guides for deploying container images to Cloud Run and the Cloud Run container runtime contract.
Google App Engine installation
You can run Node.js NES on Google App Engine by using the App Engine flexible environment with a custom runtime.
Build the container image yourself, push it to Artifact Registry, and deploy that prebuilt image with gcloud app deploy --image-url.
Do not deploy this with runtime: nodejs, because that uses Google's managed Node.js runtime instead of the Node.js NES binary.
Prerequisites
- An NES registry token with download access
- Google Cloud CLI configured for the target project
- Docker installed locally, or an equivalent container build system
- Artifact Registry enabled in the target project
- An App Engine application created in the target project
runtime: custom
env: flex
manual_scaling:
instances: 1
resources:
cpu: 1
memory_gb: 0.5
disk_size_gb: 10
The local and deployed verification commands should return JSON that includes the Node.js NES version from process.version. App Engine flexible custom runtimes must listen for HTTP requests on port 8080.
For more background on App Engine flexible custom runtimes, prebuilt image deployment, and app.yaml, see the Google Cloud guides for building custom runtimes, configuring custom runtimes with app.yaml, and gcloud app deploy.
Google Cloud Functions installation
You can run Node.js NES for Google Cloud Functions by packaging your function as a custom container image and deploying it to Cloud Run. This uses the Google Functions Framework to receive function invocations, but the Node.js runtime itself comes from the Node.js NES binary that you download into the container.
Do not deploy this with gcloud functions deploy --runtime nodejs... or gcloud run deploy --source . --function ... --base-image nodejs..., because those paths use Google's managed Node.js runtime image instead of the Node.js NES binary.
Prerequisites
- An NES registry token with download access
- Google Cloud CLI configured for the target project
- Docker installed locally, or an equivalent container build system
- Artifact Registry enabled in the target project
FROM debian:bookworm-slim
# Pin the Node.js NES version you want inside Google Cloud Functions
ARG NODE_VERSION=v20.19.14-nes
# Provide your NES token at build time: --build-arg NES_TOKEN=...
ARG NES_TOKEN
ARG REGISTRY_BASE=https://registry.nes.herodevs.com/nodejs/nes
ENV NODE_DIR=/opt/node
WORKDIR /workspace
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
gzip \
tar \
&& rm -rf /var/lib/apt/lists/*
# Install the custom Node.js NES build
RUN curl -fSL -H "Authorization: Bearer ${NES_TOKEN}" "${REGISTRY_BASE}/${NODE_VERSION}/node-${NODE_VERSION}-linux-x64.tar.gz" -o /tmp/node.tgz \
&& mkdir -p ${NODE_DIR} \
&& tar -xzf /tmp/node.tgz -C ${NODE_DIR} --strip-components=1 \
&& rm /tmp/node.tgz
ENV PATH="${NODE_DIR}/bin:${PATH}" \
npm_config_nodedir=${NODE_DIR} \
npm_config_prefix=${NODE_DIR}
RUN node --version
COPY package*.json ./
RUN npm install --omit=dev
COPY index.js ./
CMD ["./node_modules/.bin/functions-framework", "--target=helloNodeNes"]
The deployed service runs as a Cloud Run function-compatible container. If you need event-driven behavior, attach the appropriate Eventarc trigger to the Cloud Run service after deployment.
For more background on Cloud Run functions, Functions Framework, and container image deployment, see the Google Cloud guides for writing Cloud Run functions, the Functions Framework, and deploying container images to Cloud Run.