如何添加基于身份的策略以授权Cognito-Scentity访问Amazon Lex Bot?我还试图将基于资源的策略添加到Lex Bot
我正在React应用程序中进行聊天机器人。我已经使用了react-lex-plus
npm软件包。 在Lexchat组件中,我输入了机器人别名。我创建了一个新的身份池ID。 但是在本地运行它之后,我得到了
AccessDeniedException: User: arn:aws:sts::myAccountId:assumed-role/Cognito_LiveAssistanceBotIdUnauth_Role/CognitoIdentityCredentials is not authorized to perform: lex:PostText on resource: arn:aws:lex:us-east-1:myAccountIdbot:LiveAssistanceBot:$LATEST because no identity-based policy allows the lex:PostText action
我不知道在哪里更新基于身份的策略。我还试图为Lex Bot设置基于资源的策略。
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "LiveAssitanceBotId",
"Effect": "Allow",
"Principal": {
"Service": [
"cognito-identity.amazonaws.com"
]
},
"Action": [
"lex:RecognizeText",
"lex:StartConversation"
],
"Resource": [
"arn:aws:lex:us-east-1:myAccountID_:bot-alias/1AUEAAP4MW/9F7RMYLBSU"
],
"Condition": {
"StringEquals": {
"AWS:SourceAccount": "myAccountId_"
},
"ArnEquals": {
"AWS:SourceArn": "arn:aws:cognito-identity:us-east-1:myAccountId_:identitypool/us-east-1:d4a81595-0381-4fbb-ab20-9b76e4143ca1"
}
}
}
]
}
之后,我在创建策略时会获得内部错误
。
I am making a chatbot in react application. I have used react-lex-plus
npm package.
In the LexChat component, I have entered my bot alias. I have created a new identity pool id.
But after running it locally, I am getting
AccessDeniedException: User: arn:aws:sts::myAccountId:assumed-role/Cognito_LiveAssistanceBotIdUnauth_Role/CognitoIdentityCredentials is not authorized to perform: lex:PostText on resource: arn:aws:lex:us-east-1:myAccountIdbot:LiveAssistanceBot:$LATEST because no identity-based policy allows the lex:PostText action
I don't know where to update identity-based policy. I am also trying to setup resource-based policy for Lex Bot.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "LiveAssitanceBotId",
"Effect": "Allow",
"Principal": {
"Service": [
"cognito-identity.amazonaws.com"
]
},
"Action": [
"lex:RecognizeText",
"lex:StartConversation"
],
"Resource": [
"arn:aws:lex:us-east-1:myAccountID_:bot-alias/1AUEAAP4MW/9F7RMYLBSU"
],
"Condition": {
"StringEquals": {
"AWS:SourceAccount": "myAccountId_"
},
"ArnEquals": {
"AWS:SourceArn": "arn:aws:cognito-identity:us-east-1:myAccountId_:identitypool/us-east-1:d4a81595-0381-4fbb-ab20-9b76e4143ca1"
}
}
}
]
}
after which I am getting Internal Error
while creating the policy.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要将
lex:PostText
功能添加到策略的Action
部分。以下是我现有的许可政策之一的摘录:
You need to add the
lex:PostText
capability to theAction
section of your policy.Below is an extract from one of my existing permission policies: