Functions and events

Functions are the properties that are defined within the service, and they are defined within the serverless.yml, so we name the function and provide the handler property to the function, and this property points to the function file, which could be Node.js or Python. We can add multiple functions within the property. The functions can inherit the properties from the provider or we can define the properties at function level. These function properties vary as per the cloud provider, as shown in the following code:

# serverless.ymlservice: myServiceprovider:  name: aws  runtime: nodejs6.10  memorySize: 512 # will be inherited by all functionsfunctions:  usersAdd:    handler: handler.userAdd description: optional description ...

Get DevOps for Serverless Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.