Search code examples
aws-cliaws-appsync

How to provide blob of graphql schema to aws appsync api?


I am trying to use aws appsync api (StartSchemaCreation) to create schema of a new graphql api with the schema of an existing graphql api, that I dumped with GetIntrospectionSchema api of aws appsync. But the --definition param of StartSchemaCreation requires me to provide a blob of graphql schema to create in the new api. I have my graphql schema in .json and .graphql files, but I cannot use them directly, as it gives error "Failed to parse schema document - ensure it's a valid SDL-formatted document."

I need help understanding how can I pass my graphql schema through --definition param of start-schema-creation.

I am using aws-cli StartSchemaCreation.


Solution

  • You can use

    aws appsync start-schema-creation \
    --api-id <your-api-id> \
    --definition file://<file-path>