1. Packages
  2. AWS Classic
  3. How-to Guides
  4. GraphQL Endpoint in AWS AppSync

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

GraphQL Endpoint in AWS AppSync

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

    View Code Deploy this example with Pulumi

    This example shows how to set up a basic GraphQL endpoint in AWS AppSync. The endpoint contains one query and one mutation that get and put items to a Dynamo DB table.

    Deploying and running the Pulumi App

    1. Create a new stack:

      $ pulumi stack init dev
      
    2. Set the AWS region:

      $ pulumi config set aws:region us-east-2
      
    3. Restore NPM modules via npm install or yarn install.

    4. Run pulumi up to preview and deploy changes:

      $ pulumi up
      Previewing update (dev):
      ...
      
      Updating (dev):
      ...
      Resources:
          + 10 created
      Duration: 20s
      
    5. Check the deployed GraphQL endpoint:

      $ pulumi stack output endpoint
      https://***.appsync-api.us-east-2.amazonaws.com/graphql
      $ pulumi stack output key
      ***sensitivekey***
      $ curl -XPOST -H "Content-Type:application/graphql" -H "x-api-key:$(pulumi stack output key)" -d '{ "query": "mutation AddTenant { addTenant(id: \"123\", name: \"FirstCorp\") { id name } }" }' "$(pulumi stack output endpoint)"
      {
          "data": {
              "addTenant": {
                  "id": "123",
                  "name": "FirstCorp"
              }
          }
      }
      

    Clean up

    1. Run pulumi destroy to tear down all resources.

    2. To delete the stack itself, run pulumi stack rm. Note that this command deletes all deployment history from the Pulumi console.

    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi