Launch your first GraphQL API - AWS AppSync

Launch your first GraphQL API

This section describes how to use the AWS AppSync console to configure and launch a GraphQL API.

Launch a schema

The AWS AppSync wizard allows you to create APIs with schemas that define models that are backed by Amazon DynamoDB tables.

We will create an Event App where users can create events (e.g., “Going to the movies” or “Dinner at Mom & Dad’s”). This app demonstrates how to use GraphQL operations where state is persisted in Amazon DynamoDB.

To get started, you need to define your schema and provision it.

To create the API
  1. Sign in to the AWS Management Console and open the AppSync console.

    1. In the Dashboard, choose Create API.

  2. Verify that Event App is selected. If it isn’t, select it. and choose Start.

  3. Enter in a name for your API.

  4. Choose Create.

Taking a Tour of the Console

After your schema is deployed and your resources are provisioned, you can use the GraphQL API in the AWS AppSync console. The first page you see is Queries, which contains basic queries and mutations.

The Queries page is a built-in designer included in the console for writing and running GraphQL queries and mutations, including introspection and documentation. That’s covered in Run Queries and Mutations.

Schema Designer

On the left side of the console, choose Schema to view the designer. The designer has your sample Events schema loaded. The code editor has linting and error checking capabilities that you can use when you write your own apps.

The right side of the console shows the GraphQL types that have been created and resolvers on different top-level types, such as queries. When adding new types to a schema (for example, type TODO {...}), you can have AWS AppSync provision DynamoDB resources for you. These include the proper primary key, sort key, and index design to best match your GraphQL data access pattern. If you choose Create Resources at the top and choose one of these user-defined types from the menu, you can choose different field options in the schema design. Don’t select anything now, but try this in the future when you design a schema.

Resolver Configuration

In the schema designer, choose one of the resolvers on the right, next to a field. A new page opens. This page shows the configured data source (the Data Sources tab of the console has a complete list) for a resolver, and the associated Request and Response Mapping Template designers. Sample mapping templates are provided for common use cases. This is also where you can configure custom logic for things such as parsing arguments from a GraphQL request, pagination token responses to clients, and custom query messages to Amazon OpenSearch Service.

Functions and Data Sources

On the main navigation, choose Functions. A list of functions and the data sources that they’re attached to are listed. Functions are single operations that you can run against a data source. Functions consist of a Request Mapping Template and a Response Mapping Template. The resolvers presented earlier in the sample schema are known as Unit resolvers. They’re attached directly to a data source. You can also create a pipeline resolver, which contains one or more functions that are run in sequence on your GraphQL fields. Pipeline resolvers enable you to run operations against one or more data sources in a single network request. You can reuse logic across different resolvers, and mix or match data sources in a single resolver for different use cases (for example, authorization or data aggregation). For more information, see Pipeline Resolvers.


On the Settings tab, you can configure the authorization method for your API. For more information about these options, see Security.

Note: The default authorization mode, API_KEY, uses an API key to test the application. However, for production GraphQL APIs, you should use one of the stronger authorization modes, such as AWS Identity and Access Management with Amazon Cognito identity pools or user pools. For more information, see Security.


The Integration page, summarizes the steps for setting up your API and outlines the next steps for building a client application. To locate this information, select the name of your AWS AppSync app in the navigation pane on the left side of the AWS AppSync console. In the Getting Started pane, find the section called Integrate with your app. This page provides details for using the AWS Amplify toolchain to automate the process of connecting your API with iOS, Android, and JavaScript applications through config and code generation. The Amplify toolchain provides full support for building projects from your local workstation, including GraphQL provisioning and workflows for CI/CD.

This page also lists sample client applications (for example, JavaScript, iOS, etc.) for testing an end-to-end experience. You can clone and download these samples, and the configuration file that has the necessary information (such as your endpoint URL) you need to get started. Follow the instructions on AWS Amplify toolchain to run your app.