Skip to content

pedraohenrique/aws-cdk-appsync

Repository files navigation

GraphQL API using AWS AppSync and CDK

You can read further here in this medium article.

Overview

This repo contains the code for a GraphQL API with all the CRUDs needed, keeping the developer in control of CI/CD, security, and other aspects using AWS CDK. The goal is to show how to code as little as possible and spend the energy on functions or features that MUST be customized.

Solution Diagram

We will use AWS AppSync to create a complete GraphQL CRUD backend. Under the hood, GraphQL queries and mutations, Resolvers functions, DynamoDB tables, and an API Endpoint will be created without intervention. However, you will be able to access all outputs and use them in other stacks of your project.

alt text for screen readers

Getting Started

Prerequisites

Instalation

  1. Clone the repo
    git clone https://github.com/pedraohenrique/aws-cdk-appsync.git
  2. Install NPM packages
    npm install
  3. Setup AWS CLI. The instructions are here.

Deploy

  1. Deploy this stack to your default AWS account/region
    npx cdk deploy

Usage

Check out the Output values in the terminal.

Outputs:
AwsCdkAppsyncStack.amplifyApiModelSchemaS3Uri =
AwsCdkAppsyncStack.awsAppsyncApiEndpoint =
AwsCdkAppsyncStack.awsAppsyncApiId =
AwsCdkAppsyncStack.awsAppsyncApiKey =
AwsCdkAppsyncStack.awsAppsyncAuthenticationType = API_KEY
AwsCdkAppsyncStack.awsAppsyncRegion = us-east-1
Stack ARN:

Set up your favourite GraphQL client to access the brand-new API. From the step above, you should get awsAppsyncApiEndpoint and awsAppsyncApiKey.

If you are using a post request, set the API Key correctly. Like this:

curl --location 'your-awsAppsyncApiEndpoint' \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: your-awsAppsyncApiKey' \

Releases

No releases published

Packages

No packages published