Web applications, microservices, and backends

A Lambda service can essentially be only invoked from within AWS. But, we have an option to use another AWS service as a frontend to our Lambda service. For example, we can use the API gateway or an S3 bucket to provide our trigger for our Lambda function.

A typical web application will have some kind of input that will be collected from the user and then processed by the backend in the web server. But what can we do when we host our website on a static content service such as S3? There is no server-side processing in S3, so how do we implement this functionality? We can use a Lambda function (or multiple Lambdas) to provide the same functionality a feature-rich dynamic website would. Two typical approaches for triggering a Lambda from a static website would be as follows:

  • Using client-side scripts, we can generate and upload documents with the content entered by the user to a trigger S3 bucket. Each document that is uploaded invokes a Lambda function that reads the information and records it into a downstream resource.
  • Using a link in the static website to an API gateway, which invokes the lambda function and forwards the request to be processed by Lambda.

The API gateway approach can also be used to front Lambdas that can act as microservices. Each Lambda function can represent a microservice that runs only upon invocation from the API gateway. The API Gateway can also be used to invoke different Lambda functions, according to different input methods or different data paths being accessed in the incoming request.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.189.178.237