AWS Lambda http, where do I find the URL? - amazon-web-services

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?

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).
3. select stages in left side panel and
see the invoke url.

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.

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.

Related

Binding API gateway to multiple lambdas with FastAPI

I have been following this article for deploying a FastAPI app on AWS lambda and integrating that with API Gateway, and I have done with that.
Now the issue I have two different app on two different lambda, now I want to connect the both lambda to same api gateway. Is it possible, how can I do that ??
Any suggestion is helpful.
I have tried to deploy an other method /service and that has an resource for ANY with lambda proxy integration enabled. When I git the api with key/service/ it says method not
{"detail":"Not Found"}
while I have an route for this enabled in APP which looks like below.
#router.get("/", status_code=status.HTTP_200_OK)
def get_version(request: Request):
return {'version': 'v1.0.0'}
Please help
You can very well create several endpoints in API Gateway, and link them to different lambda functions.
For instance, let's say your two apps only have the get endpoint you describe.
Then, you could very well define 2 resources (app1 and app2), each one of them with a GET method, linking to the different lambda functions.
If this is what you did, and it didn't work, then there is probably another problem, like are you lambdas in the same VPC, with right policies etc

Invoke Lambda function on button click in React

To start I just want to say that I'm really new to AWS overall (1-2 weeks). So I might not think correct from start.
I'm working on an app where I want to click a button in JSX and trigger a Lambda function that gets data from a dynamodb table and shows it in the UI.
I'm writing the infrastructure as code using aws cdk. How should I face this? Do you have any guides that I can follow?
Welcome! Please have a look on this guide.
With AWS, it's a best practice to create an AWS API Gateway, which acts as your HTTP/HTTPS/API web server.
Within this API gateway, you can integrate a Lambda function with a route (e.g. GET /users), where that Lambda function grabs the data from AWS DynamoDB process it as you wish and returns the output.
To integrate it with your code, you create an HTTP GET/POST request to the API gateway URL.

Issue with conflicting API Gateways pointing to Lambda in AWS

I am newbie to AWS and looking to resolve the API Gateway issue. We had a frontend web application where if users perform any activity by clicking a Personal Details link then request will hit the AWS API Gateway "A" and trigger lambda-A. We created AWS code pipeline and deployed application using Cloud Formation Stack which creates new API Gateway-B and Lambda-B. After the deployment it was intended that when ever user hits the Personal Details it should hit API Gateway-B and triggering the Lambda-B instead it was hitting old AWS API Gateway "A" and triggering lambda-A. Any help will be highly appreciated.
Regards,
Raghu
You need to update the base path mapping of your backend domain to API Gateway B.
Or you have to edit the backend url in frontend code to new api gateway url
Custom domains with API Gateway
You need to change Lambda function in API Gateway. Please check this article which have screenshots.
https://aws.amazon.com/blogs/compute/using-api-gateway-stage-variables-to-manage-lambda-functions/
https://docs.aws.amazon.com/lambda/latest/dg/services-apigateway.html
Also I want to recommend you to use Serverless for your project.
This was due to the User request from Website navigating to data power (third party vendor for security). In data power it was configured to old API Gateway, so we changed it to new API Gateway.

How to use ECS and Lambda microservices within the same API?

I am trying to setup a microservice architecture on AWS, each microservice is a REST API.
Some of the services are running on ECS using Fargate and some of the services are running as a set of lambdas.
I am trying to have each api route resolve to the correct service, whether it is a ECS or Lambda based service.
I can see how it would be possible using only ECS services (with Application Load Balancer and listeners) or using only Lambdas (with an API Gateway). But I just cant seem to figure out how to mix the two together.
I have been searching relentlessly all week and I cannot find any decent documentation or an example of how to implement something similar to this.
There appears to be a limit to the number of routes for ALB or API Gateway. If I have several lambda based services there will need to be a declared path for each Lambda function and they will use up the path limit very quickly.
Should there be an intermediary step between each service and the API Gateway? For instance, each Lambda service has its own API Gateway which 'groups' those functions together. Which would mean there will be a nested set of API Gateways that the parent API Gateway routes to. This doesn't feel correct though.
Any help in the right direction would be appreciated.
Thanks
Your AWS account's API Gateway REST and Websocket routes/resources limit can be increased with a request to AWS support.

API Gateway endpoint works on AWS Console but not in browser

I have an API Gateway endpoint that proxies a Lambda function. When I test the endpoint in the console (a GET request), it works fine and returns the correct JSON.
When I try the same endpoint in the browser or Postman, it doesn't work. The error is:
server IP address could not be found
I have logs set up in CloudWatch for the API and nothing comes up, so it looks like the API is not even getting called.
I'm using the serverless framework with NodeJS. I've tried deleting my whole CloudFormation stack and redeploying from scratch but it didn't make a difference. The API was working fine until today.
I'm having the exact same issue. Specificially, Starbucks wifi doesn't like AWS API Gateway endpoints but quite a few other public wifi too. The solution is to use custom domain for the API Gateway endpoints, I'm afraid