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.
-
Create a new stack:
pulumi stack init dev
-
Set the AWS region to deploy into:
pulumi config set aws:region us-east-2 -
Install dependencies:
npm install
-
Deploy the stack:
pulumi up
Previewing update (dev): ... Updating (dev): ... Resources: + 10 created Duration: 20s -
Check the deployed GraphQL endpoint:
pulumi stack output endpoint pulumi stack output key 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)"
https://***.appsync-api.us-east-2.amazonaws.com/graphql ***sensitivekey*** { "data": { "addTenant": { "id": "123", "name": "FirstCorp" } } }
-
Run
pulumi destroyto tear down all resources. -
To delete the stack itself, run
pulumi stack rm. Note that this command deletes all deployment history from the Pulumi console.