AWS Lambda is a serverless computing service provided by Amazon web services (AWS). Lambda allows you to run code in response to events and pay only for the compute time consumed.
Sign in to your AWS console. Search for AWS Lambda and open it. Click on the "Create a function" button.
There you will have three options to choose from.
Create from scratch: This option allows you to start from the start and write your code directly in the lambda console or upload a deployment package.
Use a blueprint: This provides you with pre-built templates for common use cases. It includes sample codes which you can change accordingly.
Container image: This allows you to run functions using container images. You can package your entire application into a container image.
Let's choose the "Use a blueprint" option. Search hello world in the blueprint name tab. Select hello world with Python 3.7. Give your function a name. Choose the roles for your function.
Scroll down to view the default code written already. Click on create function.
Your function will be created successfully. Let's test the function. Click directly on the test or select actions and choose a test from the drop-down menu. You can also view the code of the function.
On clicking the test button, the following window opens. Give this event a name and click on test.
The test was successful. You can view the details of the test by selecting details.
You can view the logs on the CloudWatch console.
Let's try changing the code and testing it. Comment line 11 and uncomment line 12. When done with changes, click deploy to save the changes. Then test it.
The execution will be unsuccessful. You can view the details by selecting details.