Awesome Open Source
Awesome Open Source

Cognito Quickstart

Creator: Vladimir Budilov

Note: This repo is deprecated. It was created before the Amplify SDK was available which performs a lot of the plumbing for you. Please use the Amplify SDK going forward. Here's an example of its use with ReactJS as well.

What does this app do?

QuickStart Angular2 Cognito App

Tech Stack

Required Tools


AWS Setup

Install the required tools (the installation script only runs on Linux and Mac)

Getting the code and running it locally

This uses the pre-configured AWS resources hosted by AWS

# Clone it from github
git clone --depth 1 [email protected]:awslabs/aws-cognito-angular2-quickstart.git
# Install the NPM packages
cd aws-cognito-angular2-quickstart
npm install
# Run the app in dev mode
npm start

Creating AWS Resources

This sample application can be deployed to either Elastic Beanstalk or S3. S3 will host this application as a static site while Elastic Beanstalk gives you the capability of adding backend operations to the application. requires your aws cli to be configured for JSON output.

# Install the AWS resources and deploy your application to either Elastic Beanstalk or S3
cd aws

Running the above command will create the necessary AWS resources and build & deploy your code to AWS. It will prompt you to choose your deployment target (S3 or Elastic Beanstalk). Choosing 'S3' makes your deployment completely serverless, while choosing Elastic Beanstalk will create an EC2 instance that will host this NodeJS app.

Caution: You might incur AWS charges after running the setup script

After initially running the script, use the below commands to rebuild and redeploy

S3: Update, Build and Deploy

# Build the project and sync the output with the S3 bucket
npm run build; cd dist; aws s3 sync . s3://[BUCKET_NAME]/
# Test your deployed application
curl –I http://[BUCKET_NAME].s3-website-[REGION]

NOTE: You might want to reshuffle some of the "package.json" dependencies and move the ones that belong to devDependencies for a leaner deployment bundle. At this point of time, AWS Beanstalk requires all of the dependencies, including the devDependencies to be under the dependencies section. But if you're not using Beanstalk then you can optimize as you wish.


Beanstalk: Update, Build and Deploy

# Commit your changes in order to deploy it to your environment
git add .
git commit
eb deploy
# View your deployed application in a browser
eb open

Local Testing

This section contains instructions on how to test the application locally (using mocked services instead of the real AWS services).


To test this application using LocalStack, you can use the awslocal CLI (

pip install awscli-local

Simply parameterize the ./ installation script with aws_cmd=awslocal:

cd aws; aws_cmd=awslocal ./

Once the code is deployed to the local S3 server, the application is accessible via http://localhost:4572/cognitosample-localapp/index.html (Assuming "localapp" has been chosen as resource name in the previous step)

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
typescript (10,392
angular (1,262
aws (1,032
serverless (624
angular2 (233
angular4 (155
aws-s3 (91
quickstart (32
cognito (20
amazon-cognito (16

Find Open Source By Browsing 7,000 Topics Across 59 Categories