Chapter 17. Receiving events from other services
This chapter covers
- Having external sources as triggers for Lambda functions
- Using webhooks to receive callbacks from other services
- Monitoring application logs to trigger Lambda functions
- Introducing practical examples with tools such as Slack, GitHub, Twilio, and MongoDB
In the previous chapter, you learned how to call external services in Lambda functions, encrypting credentials before including them in your code or in your configuration repositories.
Now you’ll see the other side of that: how to have Lambda functions triggered by external services. I’ll share specific examples and best practices, and the architectural patterns that are introduced here can be used with many more services than those included in this chapter.
You can use other AWS services, such as the Amazon API Gateway and Amazon SNS, to receive events from sources outside of AWS. In that case, you can’t trust anyone and you should have a process in place to verify that the source of the event is who you expect. Usually, you can verify that by adding a shared secret (between you and the source) to all events, or even better, by adding a digital signature to the request, similar to how the AWS API works.