AWS AppSync
AWS AppSync Developer Guide

Launch a Sample Schema

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

Launch a Sample Schema

The Event App sample schema enables users to create an application where events (for example, "Going to the movies" or "Dinner at Mom & Dad's") can be entered. Application users can also comment on the events (for example, "See you at 7!"). This app demonstrates how to use GraphQL operations where state is persisted in Amazon DynamoDB.

To get started, you need to create a sample schema and provision it.

To create the API

  1. Open the AWS AppSync console at https://console.aws.amazon.com/appsync/.

  2. In the Dashboard, choose Create API.

  3. In the bottom section list of samples, verify that Event App is selected. If it isn't, select it. and choose Start.

  4. Enter a friendly name for your API.

  5. Choose Create and then wait for the provisioning process to finish.

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 is prefilled with 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. We'll cover that next 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. Take a look at the schema more closely. Notice that 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 see that the different field options you choose appear 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 Elasticsearch Service.

Settings

On the Settings tab, you can configure things like 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.

Integration

The Integration page, which is at the root of the navigation bar on the left, recaps the steps for setting up your API and outlines the next steps for building a client application. 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 the page to run your app.