The project is built thanks to Babel
- Install yarn
- Install Docker
- Install Serverless Framework
Then run yarn
at the root of the project in oder to install the dependencies.
yarn
Beforehand create a sshKeyPair
via the AWS console -> confer config file.
This will be required in order for the EC2 to be accessible via SSH -> confer ContainerInstances
AWS_PROFILE=YOUR_AWS_PROFILE REGION=YOUR_REGION STAGE=YOUR_STAGE yarn run sls:build
Default:
- region:
ap-southeast-1
- stage:
dev
Will expect 1. to have been executed first.
docker build -t serverless-dev-serverless .
docker tag serverless-dev-serverless:latest YOUR_AWS_ACCOUNT_ID.dkr.ecr.ap-southeast-1.amazonaws.com/serverless-dev-serverless:latest
Connect to ECR
:
aws ecr get-login --region ap-southeast-1 --profile=YOUR_AWS_PROFILE
Push the image:
docker push YOUR_AWS_ACCOUNT_ID.dkr.ecr.ap-southeast-1.amazonaws.com/serverless-dev-serverless:latest
Test your deployment via the AWS console.
Access your EC2 via SSH: ssh -i serverlessSG.pem ec2-user@ec2-54-xxx-xxx-xxx.ap-southeast-1.compute.amazonaws.com
yarn run test
https://engineers.sg/video/building-hybrid-serverless-architecture-serverless-singapore--1872