Deploying Node.js on AWS
As a developer you are probably already familiar with how to build and run an application on your local machine:
But the next step is packaging your application up and running it on a server, or even a whole fleet of servers, and managing this can be challenging:
This workshop will help you take the same sample app from localhost to deployed on AWS multiple times, using a variety of different deployment mechanisms:
- AWS Elastic Beanstalk
- AWS Lambda + Serverless
- Elastic Container Service
- AWS Fargate
- Kubernetes + kops + kubectl
For this workshop the sample application code is written in Node.js but the same deployment mechanisms can be applied to other runtime languages.
Sample Application The sample app is a simple REST API for an Adventure Time fan website. The API provides endpoints for consuming structured data about Adventure Time characters and locations.
You can view an example of the raw data here
The external HTTP interface of the API has a basic spec:
GET /api/
- A simple welcome messageGET /api/characters
- A list of all charactersGET /api/characters/:id
- Fetch a specific character by IDGET /api/locations
- A list of all locationsGET /api/locations/:id
- Fetch a specific location by IDGET /api/characters/by-location/:locationId
- Fetch all characters at a specific locationGET /api/characters/by-gender/:gender
- Fetch all characters of specified genderGET /api/characters/by-species/:species
- Fetch all characters of specified speciesGET /api/characters/by-occupation/:occupation
- Fetch all characters that have specified occupation
Β
Instructions
- Create a remote development machine to use for the rest of workshop
- Deploy API using Elastic Beanstalk
- Deploy API using AWS Lambda
- Deploy API using Elastic Container Service
- Deploy API using AWS Fargate
- Deploy API using Kubernetes with kops
If you are running at home or on your own personal dev machine you technically don't have to use the remote development machine from step #1 and could instead choose to setup the dev environment on your own machine. This workshop encourages the use of a remote dev machine to avoid variations in personal devices when giving the workshop to many attendees, and additionally to move the burden of package downloads and container uploads onto an AWS internet connection instead of the local wifi connection at the workshop venue.
You will notice throughout this workshop that the instructions tend to
focus on how to deploy architectures using infrastructure as code. So
you will see a lot of commands that files from a recipes
folder, for example.
You should definitely check out the contents of these "recipes" to
see more details about what is being deployed, and how it is configured.