📋
SaveYourTime
  • SaveYourTime - Coding Notes
  • Front-End
    • Next.js - Set up with TypeScript
  • Backend
    • Install MySQL on Ubuntu
    • Setup Certbot with route53 on Ubuntu 20.04
    • Configure a Nginx HTTPS Reverse Proxy
    • TypeORM - How to seed data with typeorm-seeding 🔥
  • React Native
    • React Native - Facebook Login
    • React Native - Adding a new Swift file and a Bridge header
  • Tools
    • ESLint
    • Prettier
  • Amazon Web Services
    • AWS - Deploy Next.js Application to AWS S3
    • AWS - Deploy Nest.js Server to Elastic Beanstalk
    • AWS - Setup AWS CloudFront
    • AWS - Configure HTTPS for CloudFront with GoDaddy Domain
    • AWS - Configure HTTPS for Elastic Beanstalk Environments with GoDaddy Domain
    • AWS - Fix Next.js static site hosted on S3 CloudFront routing fails on page reload
    • AWS - Running Puppeteer on AWS EC2
    • AWS - Running Metabase on AWS Elastic Beanstalk
  • GitHub Actions
    • Github - Deploying a React Next.js App to AWS S3 with Github Actions
    • Github - Deploying a Nest.js App to AWS Elastic Beanstalk (Docker Platform) with Github Actions
    • Github - Deploying a Nest.js App to AWS Elastic Beanstalk (Node.js Platform) with Github Actions
  • Others
    • Using Fastlane to automate beta deployments and releases for your iOS and Android apps
    • NodeBB
Powered by GitBook
On this page
  • Update package.json
  • Dockerfile
  • Use eb-cli to init application and create an environment
  • Add environment variables
  • Setup RDS

Was this helpful?

  1. Amazon Web Services

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

# Build
FROM node:12

WORKDIR /usr/src/app

COPY package.json .
COPY yarn.lock .
RUN yarn

COPY . .
RUN yarn build

# Run
FROM node:12-alpine

WORKDIR /usr/src/app

COPY --from=0 /usr/src/app .

EXPOSE 80

CMD ["yarn", "start:prod"]

Use eb-cli to init application and create an environment

eb init
eb create
eb deploy

Add environment variables

Setup RDS

PreviousAWS - Deploy Next.js Application to AWS S3NextAWS - Setup AWS CloudFront

Last updated 4 years ago

Was this helpful?