Deploying Your First Low-Code Lambda Based API
Building an API using AWS lambda with zero lines of coding, without writing heavy AWS CloudFormation scripts or using a Serverless template.
Join the DZone community and get the full member experience.
Join For FreeAs a backend developer, its quiet often to create APIs and integration services. Building these APIs and integration services using functions is the current trend. AWS lambda is already a popular player in the function as a service space and it's even getting more traction in the current IT world. Building a lambda function is easy.
Understanding of any one of the languages such as Node.js, Python, Java, or .Net is good enough to build your lambda but building an API out of lambda requires furthermore understanding with AWS API gateway in the picture. There are few frameworks out there that are focussed on building lambda-based APIs but they are not low code-based.
The above frameworks are template and configuration driven and still require a bit of understanding around IAM permission, policies, roles along the understanding of lambda triggers and API gateway. For an API or integration developer especially those who are coming from low code integration background like myself who use tools such as MuleSoft, DellBhoomi, TIBCO, Snaplogic, IIB, etc will have to go through a steep learning curve around the AWS lambda ecosystem, and its time-consuming.
In this article, I thought of building an API using AWS lambda with literally zero lines of coding, without writing heavy AWS CloudFormation scripts or using a Serverless template. I will be using Kumologica for building my API. I came across Kumologica on DZone on my hunt for an easy way to build an API in AWS.
Pre-Requisites
1. Install AWS CLI in your local machine and an AWS profile created. Refer here.
2. Install npm.
3. Download and install Kumologica Designer.
Steps
1. Click Create a new Kumologica Project.
2. Provide Project Name, Save to location, and click Create.
3. By default on the designer canvas you can see a default hello flow
Let's go through this flow in detail.
The first node in this flow is GET /hello. This is an EventListener node. An EventListener node is the starting node in Kumologica flow. It defines the event source for the flow to trigger. It supports multiple AWS based services as the event trigger source. In the above flow, the EventListener node is configured with Event Source as Amazon API gateway, Verb as GET and URL as /hello.
The second node in this flow is a logger node. This node prints the content on to AWS cloudwatch logs. The logger is set with the Message string as "Request received".
The third and the final node in this flow is the EventListener End node. This is the final node for any flow in Kumologica. This node completes the flow and respond in case of event source is an API Gateway. In the below shown Eventlistener End node we are providing the https status code as 200, content-type as application/JSON and payload as "{'hello':'world'}".
So now what we have seen is a very simple API that when invoked will respond with a hello world JSON payload.
Now let's try to deploy the flow.
Note: To deploy the flow ensure that you have an AWS profile created in your machine
4. Go to the Cloud tab and select the profile from the drop-down. The profile will be automatically showing up on the drop-down list if the AWS profile is configured in your machine.
5. Go to the Triggers section under the Cloud tab and select Amazon API gateway and click +Event. This section ensures that the lambda is configured with the API Gateway trigger. Leave the parameters under the API section as default. i.e API as Create new API and Deployment Stage as a test.
6. Now the final step. Click Deploy.
In the terminal section, you can see the progress of your deployment. When you click on deployment Kumologica designer is building the lambda and pushing it to your AWS account using the AWS profile you have selected in the earlier step. Once the deployment procedure is completed the following URL will be displayed on the terminal.
https://<<instanceid>>.execute-api.ap-southeast-2.amazonaws.com/test/
Note: The instance-id will be generated and visible in your terminal.
Testing
Use any rest client of your choice and paste the following URL with the method as GET.
https://<<instanceid>>.execute-api.ap-southeast-2.amazonaws.com/test/hello
Opinions expressed by DZone contributors are their own.
Trending
-
Google Becomes A Java Developer's Best Friend: Instantiations Developer Tools Relaunched For Free
-
Security Challenges for Microservice Applications in Multi-Cloud Environments
-
Clear Details on Java Collection ‘Clear()’ API
-
Testing Applications With JPA Buddy and Testcontainers
Comments