0 votes
1 view
in AWS by (18.2k points)

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

My topic is: arn:aws:sns:ap-southeast-1:178284945954:fetch_realm_auctions

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

 

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

I trigger SNS manually:

aws sns publish 

  --topic-arn arn:aws:sns:ap-southeast-1:178284945954:fetch_realm_auctions 

  --message '{"endpoint": "https://us.api.battle.net", "realm": "spinebreaker"}'

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

 

1 Answer

0 votes
by (42.5k points)

Add this inline policy to your SNS topic to allow the lambda function 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"

            ]

        }

    ]

}

And it should work!

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...