我正在尝试创建要应用于 SQS 队列的 IAM 策略。该策略应将对队列的访问限制为单个 Cognito 联合身份。
我从亚马逊找到了这个关于如何实现这一点的参考,但是在将策略应用到 SQS 队列时遇到了问题。
这是我要申请的政策。
{
"Version": "2012-10-17",
"Id": "arn:aws:sqs:us-west-2:604080725100:Test2.fifo/SQSDefaultPolicy",
"Statement": [
{
"Sid": "Sid1528133390193",
"Effect": "Allow",
"Principal": {
"Federated": "cognito-identity.amazonaws.com"
},
"Action": "SQS:*",
"Condition": {
"StringEquals": {
"cognito-identity.amazonaws.com:aud": "us-east-1:ff1b33f4-7f66-47a5-b7ff-9696b0e1fb52",
"cognito-identity.amazonaws.com:sub": ["us-east-1:4a6d7e43-4522-41fb-9248-b5b79933b8e9"]
}
}
}
]
}
用于编辑策略的在线 UI 显示在审核屏幕中:
Allow None
All SQS Actions (SQS:*)
StringEquals
cognito-identity.amazonaws.com:aud: "us-east-1:ff1b33f4-7f66-47a5-b7ff-9696b0e1fb52"
cognito-identity.amazonaws.com:sub: "us-east-1:4a6d7e43-4522-41fb-9248-b5b79933b8e9"
一旦我按下应用,就会出现以下错误:
Failed to save changes to the policy document. Reason: com.amazonaws.services.sqs.model.AmazonSQSException: We encountered an internal error. Please try again.
我不确定政策出了什么问题。我正在寻找任何帮助来修复策略或实现将 SQS 队列限制为单个 Cognito 身份的不同策略。