What is AWS Event source?
- Event source is an AWS service that products the events that the lambda function responds to by invoking it.
- Event sources can either be poll or push-based
- Poll-based services are Kinesis, SQS, DynamoDB. Lambda polls the service looking for particular events and invokes the associated function when a matching event is found. An example would be a lambda will poll the message queue for SQS and then lambda will synchronously invoke the associative function when a matching event is found.
- Push-based services are S3, SNS, and much more. A service using this push model publishes events, in addition, to actually invoking your lambda function.
- An event source mapping is a configuration that links your event source to your lambda function. It’s what links the events generated from your event source to invoke your function
- The mapping is maintained within the event source
- By using the appropriate API calls for the event source service, you are able to create and configure the relevant mappings
- This will require specific access to allow your event source to invoke the function
- The configuration of the mappings are held within your Lambda function
- With the CreateEventSourceMapping API, you can set up the relevant event source mapping for your poll-based service
- Permission is required in the execution role policy