Well, first let's understand what AWS lambda and the serverless framework are in a simple way;
AWS Lambda - a serverless application that can run up to 15 minutes of code and can run based on triggers (times or events for example) and helps reduce costs, as the user only pays for the code execution time . This may be relevant in contexts where the application is triggered infrequently.
serverless framework - a framework for IAC (infra as code) to manage quickly uploading applications to the cloud or decommissioning them, helping to simplify and standardize infrastructure configuration, facilitating development and maintenance.
Initial Project Setup
download the serverless framework and start a project with your preferred settings, I won't mention language because you can do whatever you want.
Write a Function
Write code to execute whatever you prefer:
An example below: the code is for sending emails.
Write serverless
create a serverless.yml file and below is an example with explanations.
to deploy, just write in your terminal:
serverless deployment
And your function will run the way you want, hugs guys.
The above is the detailed content of How to create automation with AWS lambda and serverless framework. For more information, please follow other related articles on the PHP Chinese website!