Member-only story
Getting Started With Serverless Angular Universal on AWS Lambda
Create an SEO friendly Angular application and deploy it on Serverless framework

You can build search-engine optimized (SEO) friendly single page applications (SPA’s) with Angular Universal, a technology that runs your Angular application on the server. Additionally, you can reduce the cost of running those applications with AWS Lambda, an event-driven, serverless computing platform provided as a part of Amazon Web Services (AWS). This piece will show you how to build and deploy Angular Universal projects on AWS Lambda using Serverless Framework, an open-source command line interface for building and deploying serverless applications.
In this piece we will:
- Create an Angular application that contains two routes and makes calls to an external API
- Add server-side rendering for SEO purposes
- Set up a Serverless Framework framework configuration
- Deploy the app on AWS Lambda
To accomplish these tasks, you will need to create an AWS account and install the following:
- Node.js and npm (The Node.js installation will also install npm.)
- Angular CLI
- AWS CLI
To configure the AWS CLI you’ll need the following from your AWS account:
- Access Key ID
- Secret Key
- Default region
Your root user will have all the rights necessary to deploy and run the Angular app as a Lambda function. You can get an Access Key ID and a Secret Key for your root user by generating a new pair in the Identity and Access Management (IAM) console.
If you do not want to use your root user ID for this project you can set up an IAM role and policy for an API to invoke Lambda functions. This process has a number of steps and is not recommended if you are new to AWS.
Be sure you have completed all these tasks successfully before proceeding.