Chapter 2. Getting Started with AWS Amplify

At the core of most applications is the data/API layer. This layer could look like many things. In the serverless world, this usually will be composed of a combination of API endpoints and serverless functions. These serverless functions could be doing some logic and returning data, interacting with a database of some kind, or even interacting with another API endpoint.

There are two main ways of creating APIs with Amplify:

  • A combination of Amazon API Gateway and a Lambda function

  • A GraphQL API connected to some type of data source (database, Lambda function, or HTTP endpoint)

API Gateway is an AWS service that allows you to create API endpoints and route them to different services, often via a Lambda function. When you make an API call, it will route the request through API Gateway, invoke the function, and return the response. Using the Amplify CLI, you can create both the API Gateway endpoint as well as the Lambda function; the CLI will automatically configure the API to be able to invoke the Lambda function via an HTTP request.

Once your API is created, you then need a way to interact with it. Using the Amplify client you will be able to send requests to the endpoint using the Amplify API class. The API class allows you to interact with both GraphQL APIs as well as API Gateway endpoints, as shown in Figure 2-1.

In this chapter, you’ll create your first full stack serverless app that will interact with a serverless function ...

Get Full Stack Serverless now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.