AWS::AppSync::GraphQLApi
The AWS::AppSync::GraphQLApi resource creates a new Amazon AppSync GraphQL API. This is
the top-level construct for your application. For more information, see Quick Start in the Amazon AppSync
Developer Guide.
Syntax
To declare this entity in your Amazon CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::AppSync::GraphQLApi", "Properties" : { "AdditionalAuthenticationProviders" :[ AdditionalAuthenticationProvider, ... ], "AuthenticationType" :String, "LambdaAuthorizerConfig" :LambdaAuthorizerConfig, "LogConfig" :LogConfig, "Name" :String, "OpenIDConnectConfig" :OpenIDConnectConfig, "Tags" :[ Tag, ... ], "UserPoolConfig" :UserPoolConfig, "Visibility" :String, "XrayEnabled" :Boolean} }
YAML
Type: AWS::AppSync::GraphQLApi Properties: AdditionalAuthenticationProviders:- AdditionalAuthenticationProviderAuthenticationType:StringLambdaAuthorizerConfig:LambdaAuthorizerConfigLogConfig:LogConfigName:StringOpenIDConnectConfig:OpenIDConnectConfigTags:- TagUserPoolConfig:UserPoolConfigVisibility:StringXrayEnabled:Boolean
Properties
AdditionalAuthenticationProviders-
A list of additional authentication providers for the
GraphqlApiAPI.Required: No
Type: List of AdditionalAuthenticationProvider
Update requires: No interruption
AuthenticationType-
Security configuration for your GraphQL API. For allowed values (such as
API_KEY,AWS_IAM,AMAZON_COGNITO_USER_POOLS,OPENID_CONNECT, orAWS_LAMBDA), see Security in the Amazon AppSync Developer Guide.Required: Yes
Type: String
Update requires: No interruption
LambdaAuthorizerConfig-
A
LambdaAuthorizerConfigholds configuration on how to authorize Amazon AppSync API access when using theAWS_LAMBDAauthorizer mode. Be aware that an Amazon AppSync API may have only one Lambda authorizer configured at a time.Required: No
Type: LambdaAuthorizerConfig
Update requires: No interruption
LogConfig-
The Amazon CloudWatch Logs configuration.
Required: No
Type: LogConfig
Update requires: No interruption
Name-
The API name.
Required: Yes
Type: String
Update requires: No interruption
OpenIDConnectConfig-
The OpenID Connect configuration.
Required: No
Type: OpenIDConnectConfig
Update requires: No interruption
Tags-
An arbitrary set of tags (key-value pairs) for this GraphQL API.
Required: No
Type: List of Tag
Update requires: No interruption
UserPoolConfig-
Optional authorization configuration for using Amazon Cognito user pools with your GraphQL endpoint.
Required: No
Type: UserPoolConfig
Update requires: No interruption
Visibility-
Sets the scope of the GraphQL API to public (
GLOBAL) or private (PRIVATE). By default, the scope is set toGlobalif no value is provided.Required: No
Type: String
Update requires: Replacement
XrayEnabled-
A flag indicating whether to use Amazon X-Ray tracing for this
GraphqlApi.Required: No
Type: Boolean
Update requires: No interruption
Return values
Ref
When you pass the logical ID of an AWS::AppSync::GraphQLApi resource to the intrinsic
Ref function, the function returns the ARN of the GraphQL API, such as
arn:aws:appsync:us-east-1:123456789012:apis/graphqlapiid.
For more information about using the Ref function, see Ref.
Fn::GetAtt
Fn::GetAtt returns a value for a specified attribute of this type. The following are the available
attributes and sample return values.
For more information about using Fn::GetAtt, see Fn::GetAtt.
ApiId-
Unique Amazon AppSync GraphQL API identifier.
Arn-
The Amazon Resource Name (ARN) of the API key, such as
arn:aws:appsync:us-east-1:123456789012:apis/graphqlapiid. GraphQLDns-
The fully qualified domain name (FQDN) of the endpoint URL of your GraphQL API.
GraphQLUrl-
The Endpoint URL of your GraphQL API.
RealtimeDns-
The fully qualified domain name (FQDN) of the real-time endpoint URL of your GraphQL API.
RealtimeUrl-
The GraphQL API real-time endpoint URL. For more information, see Discovering the real-time endpoint from the GraphQL endpoint.
Examples
GraphQL API Creation Example
The following example creates a GraphQL API.
YAML
Parameters: graphQlApiName: Type: String userPoolId: Type: String userPoolAwsRegion: Type: String defaultAction: Type: String Resources: GraphQLApi: Type: AWS::AppSync::GraphQLApi Properties: Name: Ref: graphQlApiName AuthenticationType: "AMAZON_COGNITO_USER_POOLS" UserPoolConfig: UserPoolId: Ref: userPoolId AwsRegion: Ref: userPoolAwsRegion DefaultAction: Ref: defaultAction
JSON
{ "Parameters": { "graphQlApiName": { "Type": "String" }, "userPoolId": { "Type": "String" }, "userPoolAwsRegion": { "Type": "String" }, "defaultAction": { "Type": "String" } }, "Resources": { "GraphQLApi": { "Type": "AWS::AppSync::GraphQLApi", "Properties": { "Name": { "Ref": "graphQlApiName" }, "AuthenticationType": "AMAZON_COGNITO_USER_POOLS", "UserPoolConfig": { "UserPoolId": { "Ref": "userPoolId" }, "AwsRegion": { "Ref": "userPoolAwsRegion" }, "DefaultAction": { "Ref": "defaultAction" } } } } } }
See also
-
CreateGraphqlApi operation in the Amazon AppSync API Reference.