HomeTutorsContact
AWS - Amazon Web Services
How to Test Lambda Container Images?
Anton Putra
February 28, 2021
1 min

In the previous lesson, we created an AWS Lambda function with an API Gateway trigger using a docker image. Today, I’ll show you how to run and test that docker container locally and how to test the Lambda function using the AWS console.

  • First of all, we need to run our docker container locally with the following command:
  • Since we added API Gateway at front of our lambda function, we need to provide JSON object encoded in base64.
  • Now, we can use this payload and hit our function locally
  • We can also, create unit tests for our function. Let’s install a jest testing framework to run our tests.
  • We need to update the test command in the package.json file
  • Create a file called event.json to simulate JSON payload
  • Finally, we can create an app.test.js file where we will define our unit tests.
  • Run all unit tests
  • We can also test our lambda function via AWS console. Click on Test button and paste JSON payload.

Tags

#AWS#NodeJS#Lambda

Anton Putra

DevOps Engineer

Big Data | DevOps engineer with hands-on experience in building large, scalable batch and real-time applications with Apache Spark, Hive, Flink on top of Kubernetes; designing and developing CI/CD pipelines.

Expertise

Kubernetes
Terraform
AWS
GCP

Social Media

youtubefacebooklinkedinwebsite

Related Posts

Create Lambda Container Images
How to Create Lambda Container Images?
February 24, 2021
1 min
© 2021, All Rights Reserved.

Quick Links

About UsContact Us

Social Media