gpt4 book ai didi

amazon-web-services - 使用 Cloudformation 在 `amplify push` 上拒绝 SQS API : sqs:CreateQueue Access to the resource https://sqs. us-east-1.amazonaws.com/

转载 作者:行者123 更新时间:2023-12-03 07:40:37 27 4
gpt4 key购买 nike

我正在实现 SQS fifo 队列。我必须使用 cloudformation 模板来实现。

当我放大推送时,我得到

错误API:sqs:CreateQueue 对资源 https://sqs.us-east-1.amazonaws.com/的访问被拒绝

我已经添加了 aws docs 遵循的 SQS 政策。除了 accountID 之外,我在“Principal”中使用的服务为“sqs.amazonaws.com”。

我的cloudformation看起来像:

{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "SQS fifo queue",
"Parameters": {
"env": {
"Type": "String"
}
},
"Resources": {
"QueueExecutionRole": {
"Type": "AWS::IAM::Role",
"Properties": {
"RoleName": {
"Fn::Join": [
"",
[
"queue-exec-role-",
{
"Ref": "env"
}
]
]
},
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "sqs.amazonaws.com"
},
"Action": ["sts:AssumeRole"]
}
]
}
}
},
"SQSPolicy": {
"Type": "AWS::SQS::QueuePolicy",
"Properties": {
"Queues": [{ "Ref": "groupingQueue" }],
"PolicyDocument": {
"Statement": [
{
"Action": ["SQS:SendMessage", "SQS:ReceiveMessage"],
"Effect": "Allow",
"Resource": {
"Fn::GetAtt": ["groupingQueue", "Arn"]
},
"Principal": {
"Service": "sqs.amazonaws.com"
}
}
]
}
}
},
"groupingQueue": {
"Type": "AWS::SQS::Queue",
"Properties": {
"FifoQueue": "true",
"QueueName": {
"Fn::Join": [
"",
[
"grouping-queue-",
{
"Ref": "env"
},
".fifo"
]
]
}
}
}
},
"Outputs": {
"QueueURL": {
"Description": "URL of new Amazon SQS Queue",
"Value": { "Ref": "groupingQueue" }
},
"QueueARN": {
"Description": "ARN of new Amazon SQS Queue",
"Value": { "Fn::GetAtt": ["groupingQueue", "Arn"] }
},
"QueueName": {
"Description": "Name new Amazon SQS Queue",
"Value": { "Fn::GetAtt": ["groupingQueue", "QueueName"] }
}
}
}

我不想在“Principal”中提供AccountID,这就是为什么使用sqs服务。

使用这个确切的模板,我在 amplify push -y 上被拒绝访问。

最佳答案

我正在从服务器进行放大推送。当我从本地计算机推送它时,它起作用了。

事实证明,我在服务器中设置的 aws 配置文件没有 sqs:CreateQueue 权限,而我的本地具有管理员访问权限。

因此,我从控制台添加了对服务器用户的管理员完全访问权限,再次进行了放大推送,并且工作顺利。

PS:不需要给管理员权限,只给sqs:CreateQueue权限即可。我这样做是因为我正在测试。

关于amazon-web-services - 使用 Cloudformation 在 `amplify push` 上拒绝 SQS API : sqs:CreateQueue Access to the resource https://sqs. us-east-1.amazonaws.com/,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69299830/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com