LexV2 Rest api error Credential should be scoped

0

Hello I'm kinda new in AWS I read a lot and I can't figure out what's going on. when I try to use the lexv2

{
    "message": "Credential should be scoped to correct service: 'lex'. "
}

I did the following:

  1. Create a CLI aws account (test user)
  2. I added the permissions: AmazonLexReadOnly and AmazonLexRunBotsOnly I even added another that I read in another website ( I Created a new policy) with this json:
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "lex:GetSession",
                "lex:RecognizeText",
                "lex:PutSession",
                "lex:DeleteSession",
                "lex:StartConversation",
                "lex:RecognizeUtterance"
            ],
            "Resource": "*"
        }
    ]
}
  1. I created an access api key/secret key
  2. Added to postman as AWS identification and hitting this url https://runtime-v2-lex.us-east-1.amazonaws.com/bots/KVI5WI1AAA/botAliases/UZA1JMDAAA/botLocales/en_US/sessions/random/text (the last letters I replaced with AAA just to hide the complete url and check if is the name or the ID)

I got the botId from lex website, the alias I think is the correct (same from lex but I'm not sure if is the name or this ID), the (access key 1 is the one I'm using, and says Access key last usedNever

My user

I can't figure out what's wrong, I tried to read a lot of tutorials but I have no luck. How I can setup this correctly?

AutoZen
asked a year ago618 views
1 Answer
0

Can you make sure that the Credential scope in your request header has "lex" set as its service name? You can refer the document for more information. https://docs.aws.amazon.com/general/latest/gr/signing-elements.html

AWS
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions