Create a Cognito Test User

I have the same problem here


I use 2 hyphens instead of one but still get the error
Also when I use “where aws” in cli I don’t get any result back, but “aws --version” do works.

Can anyone who is farmiliar with Windows give a hand?

Sadly I’m not too familiar with Windows :pensive:

Hello there!

I’ve tried this first:

aws cognito-idp sign-up \
> --region eu-central-1 \
> --client-id eu-central-1_SomeThing\
> --username myEmail@yandex.com \
> --password myPASS

And I got this:

An error occurred (InvalidParameterException) when calling the SignUp operation: 1 validation error detected: Value at 'clientId' failed to satisfy constraint: Member must satisfy regular expression pattern: [\w+]+

After that, I’ve found this answer on StackOverflow. Tried like this:

aws cognito-idp sign-up \
> --region eu-central-1 \
> --client-id eu-central-1:AAAA1234-AA12-A123-1234-AAAAAA123456 \
> --username myEmail@yandex.com \
> --password myPASS

And I got this:

An error occurred (InvalidParameterException) when calling the SignUp operation: 1 validation error detected: Value at 'clientId' failed to satisfy constraint: Member must satisfy regular expression pattern: [\w+]+

What could be an issue here? Of course, I’m using Ubuntu 18.04

Cheers! :beers:

For all crazy as I am, the --client-id that should be used is the Client ID recevied from previous step.
** Create App Client

Select App clients from the left panel.

**

:beers::beers:

Yeah glad you figured it out!

I am getting following error while creating the test user:

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

Can someone please help me?

Can you make sure you are setting the config properly in this chapter?

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?

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!