AWS SNS应该触发我的lambda,但不会触发 [英] AWS SNS ought to trigger my lambda, but does not

查看:68
本文介绍了AWS SNS应该触发我的lambda,但不会触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个通过顶点创建的AWS lambda函数.我还创建了一个SNS主题,并通过terraform进行了订阅.

I have an AWS lambda function that I created via apex. I've also created a SNS topic and a subscription through terraform.

我的主题是: arn:aws:sns:ap-southeast-1:178284945954:fetch_realm_auctions

我有一个订阅: arn:aws:sns:ap-southeast-1:178284945954:fetch_realm_auctions:2da1d182-946d-4afd-91cb-1ed3453c5d86 lambda 类型和端点是: arn:aws:lambda:ap-southeast-1:178284945954:function:wowauctions_get_auction_data

I have a subscription: arn:aws:sns:ap-southeast-1:178284945954:fetch_realm_auctions:2da1d182-946d-4afd-91cb-1ed3453c5d86 with a lambda type and the endpoint is: arn:aws:lambda:ap-southeast-1:178284945954:function:wowauctions_get_auction_data

我已经确认这是正确的功能ARN.一切似乎都正确连接:

I've confirmed this is the correct function ARN. Everything seems wired up correctly:

我手动触发SNS:

aws sns publish 
  --topic-arn arn:aws:sns:ap-southeast-1:178284945954:fetch_realm_auctions 
  --message '{"endpoint": "https://us.api.battle.net", "realm": "spinebreaker"}'

它返回消息ID,但是没有调用发生.为什么?

It returns the message ID but no invocation happens. Why?

推荐答案

我添加了一个内联策略以允许调用lambda:

I added an inline policy to allow the lambda to be invoked:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "Stmt1474873816000",
            "Effect": "Allow",
            "Action": [
                "lambda:InvokeFunction"
            ],
            "Resource": [
                "arn:aws:lambda:ap-southeast-1:178284945954:function:wowauctions_get_auction_data"
            ]
        }
    ]
}

它现在正在工作.

这篇关于AWS SNS应该触发我的lambda,但不会触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆