How to deploy an Angular APP to AWS using serverless framework
and @ng-toolkit/serverless
- AWS cli
- Angular cli
npm install -g @angular/cli
- Serverless framework
npm install serverless
- Create user credentials on AWS
- Configure serverless credentials (with custom profile)
serverless config credentials --provider aws --key {KEY} --secret {SECRET} --profile aws-on-aws
- Create Angular project from cli
ng new angular-on-aws
(npm install
run automatically after project creation)cd angular-on-aws
- Add serverless plugin
ng add @ng-toolkit/serverless
- [FIX] missing
serverless-api-compression
package in @ng-toolkit/serverlessnpm install serverless-api-compression
- Customize configuration
serverless.yml
(region
andprofile
):provider: region: eu-west-3 profile: angular-on-aws
- [FIX] problem on deploy
TypeError: express is not a function
- set to
false
the value ofesModuleInterop
intsconfig.json
:
{ "esModuleInterop": false }
- set to
- Deploy the project to AWS
npm run build:serverless:deploy
- Click on the endpoint to see the app online:
- e.g.
https://{XYZ}.execute-api.{REGION}.amazonaws.com/production
- e.g.