Modify Lambda Function Policy

I’m trying to work out how to add permissions to a Lambda’s function policy, to allow it to be invoked by arn:aws:sns:us-east-1:278350005181:daily-aggregated-price-list-api

I tried letting serverless subscribe to this SNS topic directly, but ran in to a permission error (presumably because I don’t own that topic)

I’ve now added a subscription using a resource, but it doesn’t fire, and I assume it’s because the existing function policy doesn’t allow it to be executed by this topic.

Hey @aussiegeek, can you tell me what errors you’re getting? I was able to subscribe to this topic without any issues.

For reference, here’s my serverless.yml:

service: pricelist-sns

  name: aws
  runtime: python3.6

    handler: handler.hello
      - sns: arn:aws:sns:us-east-1:278350005181:daily-aggregated-price-list-api

Turns out I’d typo’d the arn of the SNS topic, and was hitting invalid name errors, because cloudformation was trying to create a new topic

Nice, good to hear.

I will say I had some issues removing the stack when I was done. I couldn’t call ListSubscriptions on the SNS topic since I don’t own it, which caused some other problems with the removal process. You might need to manually remove some items.