The serverless application that we have built so far works like a charm, and is open to the public. Anyone can invoke Lambda functions if he/she has the API Gateway invocation URL. Luckily, AWS offers a managed service called Cognito.
Amazon Cognito is an authentication provider and management service at scale that allows you to add user sign up and sign in easily to your applications. The users are stored in a scalable directory called the user pool. In the upcoming section, Amazon Cognito will be used to authenticate users before allowing them to request the RESTful API.
To get started, create a new user pool in Amazon Cognito and give it a name:
Click on the Review defaults option to create a pool with the default settings:
Click on Attributes from the navigation pane and tick the Allow email addresses option under Email address or...