Create a Cognito Test User
In this chapter, we are going to create a test user for our Cognito User Pool. We are going to need this user to test the authentication portion of our app later.
Create User
First, we will use AWS CLI to sign up a user with username, password and email. To keep things simple we are going to have people use their email as their username (as opposed to creating a username) while creating their account.
In your terminal, run.
$ aws cognito-idp sign-up \
--region us-east-1 \
--client-id YOUR_COGNITO_APP_CLIENT_ID \
--username admin@example.com \
--password Passw0rd! \
--user-attributes Name=email,Value=admin@example.com
Now, the user is created in Cognito User Pool. However, before the user can authenticate with the User Pool, the account needs to be verified. Let’s quickly verify the user using an administrator command.
In your terminal, run.
$ aws cognito-idp admin-confirm-sign-up \
--region us-east-1 \
--user-pool-id YOUR_USER_POOL_ID \
--username admin@example.com
Now our test user is ready. Next, let’s set up the Serverless Framework to create our backend APIs.
If you liked this post, please subscribe to our newsletter and give us a star on GitHub.
For help and discussion
Comments on this chapter