0

I am looking to create completely serverless AWS solution using an AWS API Gateway which will have endpoints that will integrate with a Lambda function that will interact with a simple third party Web API w/ http requests and additionally a serverless db of some sort to persist data.

Below is an example of the things I am looking to do:

GET: my-api-gateway-endpoint/products/1 Lambda function will know that it is a GET for products and the param is 1 so it will run the appropriate function to query my database and return the Product with Id 1

POST: my-api-gateway-endpoint/products Lambda function will know that it is a POST for products so will run the appropriate function to call a third party Web API through http and insert it there but additionally insert the product into my db

DELETE: my-api-gateway-endpoint/products/1 Lambda function will know that it is a DELETE request for products with Id 1 so it will run the appropriate function to call the third party Web API through http and delete it there but additionally query my database and delete the Product with Id 1

I am trying to figure out the appropriate stack to get the job done, below is what I came up with so far: -API Gateway

-Single Lambda function written in C# and uploaded, handles all types of requests. Talks to a third party Web API and additionally a serverless db

-Aurora Db serverless w/ Data API enabled. The idea would be to talk to this via the C# lambda function to persist and query data.

I start getting a bit confused when I see people hosting entire Asp.net core web API projects in Lambda. Maybe this is the path I go instead. I can't find a single example on how I would access Aurora Db Serverless Data API with C#.

Can anyone give me some insight on whether this stack will put me on the right track to get the job done or give any ideas of another way I can lay it out.

I am looking for completely serverless and as simple as possible. I also don't care what language the Lambda is in but I prefer C#.

Blake Rivell
  • 13,105
  • 31
  • 115
  • 231

1 Answers1

2

If you only ever need to access products by productId, this is a great use case for DynamoDB (which is basically a key-value store with some extra features) instead of Aurora Serverless.

The AWS blog has a walkthrough of how to create a .NET Lambda function, including integration with API Gateway. The DynamoDB documentation has pretty comprehensive examples of how to use the DynamoDB SDK for .NET. Finally, here is a sample project that uses API Gateway/Lambda/DynamoDB infrastructure with .NET.

Matthew Pope
  • 7,212
  • 1
  • 28
  • 49
  • thank you for the excellent response, I had a feeling I was on the right track but wasn't thinking to use Dynamo DB. I am definitely going to have a few tables with foreign keys, Customer, Product. That won't be a problem right? I might need to query records based on a few foreign keys. I guess I am having trouble understanding when to use DynamoDB vs RDB. – Blake Rivell Sep 28 '19 at 23:18
  • It’s possible to create indexes in DynamoDB to support queries on other fields. There are lots of resources discussing RDS vs DynamoDB on S.O. and on the AWS website. Here is one example: https://stackoverflow.com/questions/13966368/aws-mysql-rds-vs-aws-dynamodb – Matthew Pope Sep 28 '19 at 23:36