I have two Lambda Functions Lambda1 and Lambda2. Lambda1 does some work and sends multiple results to Lambda2 via an SNS Topic called Topic1. Lambda2 then processes the results of Lambda1.
Lambda1 -> Topic1 -> Lambda2
This all works well until I try to build a CloudFormation Template that represents it. I can subscribe Lambda2 to Topic1, but how can I tell Lambda1 which SNS topic to push messages to? After all the topic ARN is not created until the CloudFormation Stack is created.
You can use single CloudFormation
stack to create this scenario. Outputs of your stack can be used to configure Lambda 1
created within the stack to access Topic 1
, you just need to give your Lambda
cloudformation:DescribeStacks
permission and then access your stack outputs from your Lambda
code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With