Menu
AWS CloudFormation
User Guide (API Version 2010-05-15)

AWS::AppSync::GraphQLSchema

The AWS::AppSync::GraphQLSchema resource is used for your AWS AppSync GraphQL schema which controls the data model for your API. Schema files are text written in Schema Definition Language (SDL) format. You can find information on schema authoring at Designing a GraphQL API.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::AppSync::GraphQLSchema", "Properties" : { "Definition" : String, "DefinitionS3Location" : String, "ApiId" : String } }

YAML

Type: "AWS::AppSync::GraphQLSchema" Properties: Definition: String DefinitionS3Location: String ApiId: String

Properties

Definition

The text representation of a GraphQL schema in SDL format.

Required: No

Type: String

Update requires: No interruption

DefinitionS3Location

A location of a GraphQL schema file on an S3 bucket if you wish to provision with the schema living in S3 rather than embedded in your CloudFormation template.

Required: No

Type: String

Update requires: No interruption

ApiId

The AWS AppSync GraphQL API identifier to which you will apply this schema.

Required: Yes

Type: String

Update requires: Replacement

Return Values

Ref

When you pass the logical ID of an AWS::AppSync::GraphQLSchema resource to the intrinsic Ref function, the function returns the GraphQL API id with the literal String GraphQLSchema attached to it.

For more information about using the Ref function, see Ref.

Examples

GraphQL Schema creation example

The following example creates a GraphQL Schema and associates it with an existing GraphQL API by passing the GraphQL API Id as a paramater.

JSON

{ "Parameters": { "graphQlApiId": { "Type": "String" }, "graphQlSchemaS3DescriptionLocation": { "Type": "String" } }, "Resources": { "Schema": { "Type": "AWS::AppSync::GraphQLSchema", "Properties": { "ApiId": { "Ref": "graphQlApiId" }, "DefinitionS3Location": { "Ref": "graphQlSchemaS3DescriptionLocation" } } } } }

YAML

Parameters: graphQlApiId: Type: String graphQlSchemaS3DescriptionLocation: Type: String Resources: Schema: Type: "AWS::AppSync::GraphQLSchema" Properties: ApiId: Ref: graphQlApiId DefinitionS3Location: Ref: graphQlSchemaS3DescriptionLocation

See Also