[英]Send cross AWS account message from Lambda to SQS
I want to send a message to SQS queue on another account (Ohio) from lambda in North Virginia account.我想从北弗吉尼亚帐户的 lambda 向另一个帐户(俄亥俄州)的 SQS 队列发送消息。 How can I achieve this?我怎样才能做到这一点?
Things I tried so far:到目前为止我尝试过的事情:
Created a queue in Ohio and gave lambda role arn to the queue.在俄亥俄州创建了一个队列,并将 lambda 角色分配给队列。
Sent message from the lambda in North Virigina, got following error:从 North Virigina 的 lambda 发送消息,出现以下错误:
"errorMessage": "An error occurred (AWS.SimpleQueueService.NonExistentQueue) when calling the SendMessage operation: "errorMessage": "调用 SendMessage 操作时发生错误 (AWS.SimpleQueueService.NonExistentQueue):
If you are sending cross-account messages, you have to do the following things.如果您要发送跨帐户消息,则必须执行以下操作。
{
"Version": "2012-10-17",
"Id": "Queue1_Policy_UUID",
"Statement": [
{
"Sid": "Queue1_AllActions",
"Effect": "Allow",
"Principal": {
"AWS": [
"arn:aws:iam::111122223333:role/lambdaRole"
]
},
"Action": [
"sqs:SendMessage",
"sqs:ReceiveMessage"
],
"Resource": "arn:aws:sqs:us-east-2:123456789012:queue1"
}
]
}
The principal here is the Lambda role from the account where the Lambda is deployed.此处的主体是部署 Lambda 的帐户中的 Lambda 角色。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.