Book Image

Building Serverless Architectures

By : Cagatay Gurturk
Book Image

Building Serverless Architectures

By: Cagatay Gurturk

Overview of this book

Over the past years, all kind of companies from start-ups to giant enterprises started their move to public cloud providers in order to save their costs and reduce the operation effort needed to keep their shops open. Now it is even possible to craft a complex software system consisting of many independent micro-functions that will run only when they are needed without needing to maintain individual servers. The focus of this book is to design serverless architectures, and weigh the advantages and disadvantages of this approach, along with decision factors to consider. You will learn how to design a serverless application, get to know that key points of services that serverless applications are based on, and known issues and solutions. The book addresses key challenges such as how to slice out the core functionality of the software to be distributed in different cloud services and cloud functions. It covers basic and advanced usage of these services, testing and securing the serverless software, automating deployment, and more. By the end of the book, you will be equipped with knowledge of new tools and techniques to keep up with this evolution in the IT industry.
Table of Contents (10 chapters)

Creating the API endpoint for suggestions

You may think that to expose search results, we would need another Lambda function. On the other hand, in our API endpoint, we just need the document we saved to CloudSearch, and we can directly expose it to the client. Then, we can use the similar method we used for the S3 upload and use API Gateway as a proxy between CloudSearch's AWS API and our publicly facing API.

To create such an API, let's first create a resource in the /search path using the method we already know from the earlier steps. Let's add this block to the Resources block in our CloudFormation template:

"SearchResource": { 
  "Type": "AWS::ApiGateway::Resource", 
  "Properties": { 
    "PathPart": "search", 
    "RestApiId": { 
       "Ref": "RestApi" 
    }, 
   ...