Create your first AWS AppSync GraphQL API

nader dabit
Instructornader dabit

Share this video with your friends

Send Tweet
Published 5 years ago
Updated 4 years ago

In this lesson, we’ll use the AWS AppSync console to create a new AWS AppSync API. We’ll then implement our first GraphQL Schema & data source in the new API.

We'll see that when using GraphQL with AWS AppSync, many of our Queries, Mutations, and Subscriptions are autogenerated for us.

Instructor: [00:01] To create a new API, click on the orange create API button in the AWS app sync dashboard. Next, we'll be given the options either create an API from scratch or use a preconfigured example application. We'll choose author from scratch, because we'd like to start with the brand new blank schema.

[00:21] Next, we'll give the API name and click the orange create button. Once the API is being created, we'll be given some information about the API including the API URL, the API ID, and the API key. In a left hand menu, click on schema, so we can go ahead and create our GraphQL schema.

[00:47] In the schema view, we can either create or schema from scratch, or we can use the create resources flow, which will automatically generate our schema, our resolvers, as well as our data sources based on a single type.

[01:01] For this example, let's go ahead and click on the create resources button. Here, we can either define a new type or use an existing type that's been defined in our schema. For our example, we'll go ahead and create a new type of Todo.

[01:15] The Todo type will have an ID of ID, a title of string, and a completed of Boolean. If we scroll down, we'll see that some additional schema is going to be created for us. We can see that will have three mutations, three subscriptions, and two queries that are automatically created for us.

[01:46] Next, go ahead and scroll to the bottom of the page and click create. Once the resource creation is complete, we'll see that the automatically generated schema has been added to our schema view. Next, let's go ahead and click on data sources in the left hand menu to view the data source that was created for us.

[02:12] Here, we see that a DynamoDB table or Todo table has been created. To view the table, we can click on the resource name. Here, we can view the table information as well as any items that have been added to the table.

Brendan Whiting
Brendan Whiting
~ 4 years ago

Can AWS AppSync work with relational databases? I'm not sure if I want to use DynamoDB.

nader dabit
nader dabitinstructor
~ 4 years ago

Yep! You can either use Serverless Aurora (as a first class relational data source) or a Lambda function to interact with your own data source.

Brendan Whiting
Brendan Whiting
~ 4 years ago

Awesome, thx