concept event in category aws

This is an excerpt from Manning's book AI as a Service: Serverless machine learning with AWS.

This is an excerpt from Manning's book AWS Lambda in Action: Event-driven serverless applications.
When you call a function with AWS Lambda, you provide an event and a context in the input:
The event is the way to send input parameters for your function and is expressed using JSON syntax.
Listing 2.1. Function greetingsOnDemand (Node.js)
console.log('Loading function'); #1 exports.handler = (event, context, callback) => { #2 console.log('Received event:', JSON.stringify(event, null, 2)); console.log('name =', event.name); var name = ''; if ('name' in event) { name = event['name']; } else { name = 'World'; } var greetings = 'Hello ' + name + '!'; console.log(greetings); #3 callback(null, greetings); #4 };
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.
You can then set up the Amazon API Gateway to receive the event and pass it to a Lambda function. To protect access to the Lambda function, you can add a random string to the payload URL used by GitHub. That random string will be the resource you configure in the API and acts as a shared secret, because it’s always transmitted encrypted (over HTTPS) between GitHub and the Amazon API Gateway.