aws-go-appsync

command module
v0.0.0-...-2f3ac94 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

README

Deploy Deploy

GraphQL Endpoint in AWS AppSync (in Go)

This example shows how to setup 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 the App

To deploy your infrastructure, follow the below steps.

Prerequisites
  1. Install Go
  2. Install Pulumi
  3. Configure AWS Credentials
Steps

After cloning this repo, from this working directory, run these commands:

  1. Create a new Pulumi stack, which is an isolated deployment target for this example:

    $ pulumi stack init dev
    
  2. Set the required configuration variables for this program (AWS Region):

    $ pulumi config set aws:region us-west-2
    
  3. Run pulumi up up to preview and deploy changes:

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

    $ pulumi stack output endpoint
    https://***.appsync-api.us-west-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.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL