74

I am fairly new to AWS Lambda but sure can see the benefits of it and stumbled upon the superb framework Serverless to help me built solutions on Lambda.

I started out building solutions using AWS API Gateway but really need "internal" VPC API's and not public Internet facing API's like API GW creates.

I found that Servless indeed can expose a HTTP endpoint but I can't figure out how this is done and how the URL is created. When I deploy the Lambda from Serverless it gives me the URL, e.g.:

https://uxezd6ry8z.execute-api.eu-west-1.amazonaws.com/dev/ping

I would like to be able to find (or create) this same http listener for already existing Lambdas so my question is how is the URL created and where is teh actual HTTP listener deployed?

Anders
  • 3,198
  • 1
  • 20
  • 43
  • You don't create the url yourself. You create the HTTP methods, aws gives you the urls for those methods. You just bind the methods with a lambda_handler function. – Mohammad Yusuf Dec 02 '16 at 13:37
  • http://docs.aws.amazon.com/lambda/latest/dg/get-started-invoke-manually.html – Mohammad Yusuf Dec 02 '16 at 13:38
  • API Gateway endpoints are always public Internet facing. The API Gateway service does not provide private VPC endpoints. – Mark B Dec 02 '16 at 14:24
  • I know API GW creates public endpoints, that's what I want to avoid having! – Anders Dec 02 '16 at 16:10
  • @Mohammad Yusuf Ghazi, you write "aws gives you the urls for those methods". That is exactly my question, where do I find that URL in the Lambda console? – Anders Dec 02 '16 at 16:11
  • The URL you mentioned, in the format `{identifier}.execute-api.{aws-region}.amazonaws.com` is, in fact, an API gateway URL. So, this is clearly not what you are looking for. – Michael - sqlbot Dec 02 '16 at 20:31
  • You can execute your lambdas (send events) using AWS SDK. May I ask what type of work do you want the lambda to do? – Bela Vizy Dec 03 '16 at 00:21
  • If you don't want to use an API Gateway, as the question specifies, you can assign a "Function URL" in the AWS Console. Go to the Lambda dashboard and select your Lambda function. Select the **Configuration** tab. Select **Function URL** in the left nav. Here you can create an authenticated or unauthenticated (public) URL that will receive POSTs from `curl` and pass them on to your Lambda function. – NeilG Aug 16 '23 at 00:12

3 Answers3

49

You might be looking for the invoke url,

1. go to https://console.aws.amazon.com/apigateway

2. select api link (which you have deployed on aws lambda).
enter image description here

3. select stages in left side panel and see the invoke url.

bhargav patel
  • 919
  • 10
  • 16
  • Yes, thanks, this was what I was looking for but as I was in the wrong AWS account the one from Serverless and in the Console didn't match having me confused and I thought Serverless somehow created their own URL... hence my confusion... :) – Anders May 05 '19 at 07:48
  • 1
    Thank u this is what i need – Faris Rayhan Apr 10 '21 at 06:24
29

Adding a http listener can be done by going to your lambda function, selecting the 'triggers' tab and 'add trigger', finally selecting API Gateway - but as others mentioned this does create a public facing url.

adding api gateway as a trigger will give you a url to an existing lambda

Alex
  • 4,744
  • 2
  • 17
  • 21
  • On the Configuration tab a "Function URL" can be created that works without an API Gateway. These can be authenticated or unauthenticated but I believe they are still public. – NeilG Aug 16 '23 at 00:13
-4

Duh, I was in the wrong AWS logon previously so the API GW was not showing any matching Serverless API and that was why I couldn't understand how they did it...

Once I logged into the AWS account that hosts the Serverless structure I can see the API GW GET API's for the Serverless HTTP listener.

Anders
  • 3,198
  • 1
  • 20
  • 43