Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k 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 (44.4k 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!

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer

Browse Categories

...