AWS - Deploy Nest.js Server to Elastic Beanstalk

Update package.json

  1. Update build, prestart, start

  2. Move @nestjs/cli and @types/node from devDependencies to dependencies

{
  "scripts": {
    "prebuild": "rimraf dist",
    "build": "nest build",
    "prestart": "npm run build",
    "start": "node dist/main",
    "start:dev": "nest start --watch",
    "start:debug": "nest start --debug --watch",
    "start:prod": "node dist/main",
  },
  "dependencies": {
    "@nestjs/cli": "^7.0.0",
    "@types/node": "^13.9.1",
  }
}

Dockerfile

Use eb-cli to init application and create an environment

Add environment variables

Setup RDS

Last updated

Was this helpful?