DEV Community

Success Enin
Success Enin

Posted on

Configuring Lambda for the Serverless Application

As a continuation to the series, this post covers everything you need to know about configuring Lambda and Lambda Functions

Read this post to learn how to configure Lambda:Post

Note: The Lambda function is written in Python

See repo for code: Repo

Replace only the DynamoDB table name, and partition key name in the Phyton code with your own.How to get a table name?.

Navigate to the Lambda console, select the function you created, click on code then paste your edited code and then deploy.

On that same function screen, click on Add Trigger, select API Gateway for trigger source, mark "Use Existing API" and then select the API created preciously. Finally click Add.

Triggers

Triggers are what invokes a Lambda Function to run. An invocation can happen in many scenarios e.g when you upload a file on Amazon S3, or When a request is made through your API endpoint.

What To Watch Out For

Make sure:

  • Your API Endpoint is included in the HTML code
  • Your Trigger is set to the correct API
  • The DynamoDb name and Partition key are spelt correctly

Conclusion

Right now you should have a frontend that invokes your Lambda Function through an API Gateway endpoint, and a Lambda Function then stores reservation details on the backend in DynamoDB.

Top comments (0)