AWS Amplify in Vanilla Javascript

Arcoiris Labs
3 min readDec 10, 2020

Working in browsers with AWS Amplify SDK for Authentication

AWS Amplify with Vanilla Javascript

AWS Amplify SDK has been a gateway to access AWS services like Cognito, Lambda, Hosting which is trying to ease the access & configuration of these services through its CLI tool.

According to AWS Amplify docs for Javascript documented here you can do it for web through imports. But when you try with the example code for vanilla browser Javascript, it won’t work and you will end up getting errors like

 require not found

or

 Amplify not found

They have working examples for frameworks like React, Vue & Angular which are more ES6/Typescript oriented langauges that can work work with NPM modules easily.

Here is how you can access the APIs of AWS Amplify through vanilla Javascript from browsers.

Before starting the tutorial. Follow the steps in prerequisites for Amplify in Javascript

Step 1. Install AWS Amplify through NPM in your current project

npm install aws-amplify --save

Step 2. Find the library

Navigate to node_modules/aws-amplify/dist/ . Here you may find a file named “aws-amplify.min.js”…

--

--

Arcoiris Labs
Arcoiris Labs

Written by Arcoiris Labs

Specialized in developing Intelligent Smartphone Applications

Responses (1)