user7314165
user7314165

Reputation:

How to use aws lambda without HTTP api?

Since there is aditional costs for using HTTP and REST apis on AWS lambda, i would like to know if i could make AWS Lambda receive gets and posts without the need of these HTTP API services.

In this example it seems to be possible:

https://github.com/serverless/examples/tree/master/aws-node-simple-http-endpoint

Upvotes: 0

Views: 1119

Answers (2)

smac2020
smac2020

Reputation: 10734

Lambda also exposes a client API in all languages. Therefore, you can invoke a Lambda function by using the client API (not use API Gateway if you prefer). For example, assume you want the ability to invoke a Lambda function from a Java web app. In this situation, you can use the LambdaClient object to do so. You can find an example here:

https://github.com/awsdocs/aws-doc-sdk-examples/blob/master/javav2/example_code/lambda/src/main/java/com/example/lambda/LambdaInvoke.java

Upvotes: 0

Gerardo Arroyo
Gerardo Arroyo

Reputation: 151

You will need to use the API Gateway to expose your lambda. Your example is actually using an API Gateway, because the endpoint is execute-api.us-east-1.amazonaws.com and that is the Amazon API Gateway Data Plane.

Just to be clear; if you need to expose the Lambda externally you need to use the API Gateway. If the Lambda needs to be invoked internally then you don't need the API GW.

Best regards

Upvotes: 1

Related Questions