AWS::AppSync::GraphQLSchema - AWS CloudFormation


The AWS::AppSync::GraphQLSchema resource is used for your AWS AppSync GraphQL schema that controls the data model for your API. Schema files are text written in Schema Definition Language (SDL) format. For more information about schema authoring, see Designing a GraphQL API in the AWS AppSync Developer Guide.


When you submit an update, AWS CloudFormation updates resources based on differences between what you submit and the stack's current template. To cause this resource to be updated you must change a property value for this resource in the CloudFormation template. Changing the Amazon S3 file content without changing a property value will not result in an update operation.

See Update Behaviors of Stack Resources in the AWS CloudFormation User Guide.


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


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


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



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

Required: Yes

Type: String

Update requires: Replacement


The text representation of a GraphQL schema in SDL format.

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

Required: No

Type: String

Update requires: No interruption


The location of a GraphQL schema file in an Amazon S3 bucket. Use this if you want to provision with the schema living in Amazon S3 rather than embedding it in your CloudFormation template.

Required: No

Type: String

Update requires: No interruption

Return values


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.


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 parameter.


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


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

See also