Create a Cognito Test User

Just wanted to share for those using PowerShell

Admin Confirm Sign-up

PowerShell Syntax

aws cognito-idp admin-confirm-sign-up --region, --user-pool-id, --username

Keep in mind this doesn’t return anything and had to verify through the AWS online console.

1 Like

Did you get a solution on creating cognito user through running the commands on
windows powershell?

yes and works great. I have recently switched to using Visual Studio Code as my editor and it has both powershell and CMD

2 Likes

Thanks for helping out!

I was able to find the solution. Instead of \ (slash) at the end of every argument use , (comma) @3DG3 its giving

{
    "UserConfirmed": false,
    "CodeDeliveryDetails": {
        "Destination": "t***@g***.com",
        "DeliveryMedium": "EMAIL",
        "AttributeName": "email"
    },
    "UserSub": "3cd74855-0c98-4556-84ee-1474e640038a"
} 

and was able to confirm through

aws cognito-idp admin-confirm-sign-up ,
  --region YOUR_COGNITO_REGION ,
  --user-pool-id YOUR_COGNITO_USER_POOL_ID ,
  --username admin@example.com

and didn’t get about your mention of “had to verify through the AWS online console”?

Im following the document from https://serverless-stack.com/chapters/create-a-cognito-test-user.html and
trying to enter the following commands by copy pasting on windows command prompt.

 aws cognito-idp sign-up \
  --region YOUR_COGNITO_REGION \
  --client-id YOUR_COGNITO_APP_CLIENT_ID \
  --username admin@example.com \
  --password Passw0rd!

The moment I paste the command aws cognito-idp sign-up \ 
i get errors as the following

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help
aws: error: the following arguments are required: --client-id, --username, --password

C:\>  --region YOUR_COGNITO_REGION \
'--region' is not recognized as an internal or external command,
operable program or batch file.

C:\>  --client-id YOUR_COGNITO_APP_CLIENT_ID \
'--client-id' is not recognized as an internal or external command,
operable program or batch file.

C:\>  --username admin@example.com \
'--username' is not recognized as an internal or external command,
operable program or batch file.

Could someone assist me please?
1 Like

Im having still issue with creating a cognito test user on windows cli.

aws cognito-idp sign-up \

this is not working. Its producing error .
aws: error: the following arguments are required: --client-id, --username, --password

Could someone test it and assist me please?

1 Like

did you get a solution for the above? Im getting the same above error on windows cmd

@1tejagowtham “Keep in mind this doesn’t return anything and had to verify through the AWS online console.” > > > I was talking about having to login to https://aws.amazon.com/ … Cognito… to see that the user was created.

Unfortunately I don’t know enough about the Windows CLI. It seems like the format you need to use for it is different from the one in the chapter. Perhaps Google for how to use bash commands in Windows?

In windows, dont use the “” after each line. It just needs to be one long string…

example:

aws cognito-idp sign-up --region YOUR_COGNITO_REGION --client-id YOUR_COGNITO_APP_CLIENT_ID --username admin@example.com --password Passw0rd!

For those of you using windows, don’t use \ after every line, just make it one long line, like the following:

aws cognito-idp sign-up --region YOUR_COGNITO_REGION --client-id YOUR_COGNITO_APP_CLIENT_ID --username admin@example.com --password Passw0rd!

Thanks for posting this!

Okay, so now i am stuck at this step. I am on mac. Here is the command that i am using

$ aws cognito-idp sign-up --region us-west-2 --client-id xxxxxxxxxxxxxxxxxxxxxxxxx --username admin@example.com --password Passw0rd!

An error occurred (NotAuthorizedException) when calling the SignUp operation: Unable to verify secret hash for client xxxxxxxxxxxxxxxxxxxxxxxxx

I have double checked my aws cognito regions … deleted old pool and created a new one but i am still stuck at this issue :s

Just created a new account and retried the whole process, still getting same error :frowning:

This error usually happens when the AWS credentials on your local computer are set incorrectly. Can you double check those?

So this is what i did to verify that everything is setup correctly.

  1. Created a new VM (Ubuntu)
  2. Installed python/pip/awscli from scratch
  3. Created a new account in us-east-1
  4. Configured S3 as per tutorial and created a bucket.
  5. Used awscli to ran aws s3 ls command to get list of s3 buckets (to make sure that awscli is configured properly). It returned expected bucket
  6. Created the Cognito Pool, app client, domain and then ran the command to create admin@example.com user.
  7. Got same error :frowning:

Here is my aws cli version details

aws --version
aws-cli/1.18.0 Python/3.7.5 Linux/5.3.0-23-generic botocore/1.15.0

Is the issue on aws side? What should i do?

Here is full command and respective error

aws cognito-idp sign-up --region us-east-1 --client-id 18rivqdj3osxxxxxxxxxxxcl9r --username admin@example.com --password Passw0rd!

An error occurred (NotAuthorizedException) when calling the SignUp operation: Unable to verify secret hash for client 18rivqdj3osxxxxxxxxxxxcl9r

That’s super weird. You might have to post over on the AWS CLI issues page to get some help. I’m not sure what’s going on here.

I have actually posted there but haven’t received any reply

https://forums.aws.amazon.com/thread.jspa?messageID=934367&#934367

1 Like

I was getting the error in Wondows
for windows write it like this

aws cognito-idp sign-up --region YOUR_COGNITO_REGION --client-id YOUR_COGNITO_APP_CLIENT_ID
  --username admin@example.com
  --password Passw0rd!

Now in Congnito it is showing one unconfirmd user

1 Like