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

AWS::AppSync::FunctionConfiguration

The AWS::AppSync::FunctionConfiguration resource defines the functions in GraphQL Apis to perform certain operations. Functions can be attached by PipelineResolver. More information on functions can be found in the FunctionConfiguration Reference.

Syntax

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

JSON

{ "Type" : "AWS::AppSync::FunctionConfiguration", "Properties" : { "ApiId" : String, "Name" : String, "Description" : String, "DataSourceName" : String, "FunctionVersion" : String, "RequestMappingTemplate" : String, "RequestMappingTemplateS3Location" : String, "ResponseMappingTemplate" : String, "ResponseMappingTemplateS3Location" : String } }

YAML

Type: "AWS::AppSync::FunctionConfiguration" Properties: ApiId: String Name: String Description: String DataSourceName: String FunctionVersion: String RequestMappingTemplate: String RequestMappingTemplateS3Location: String ResponseMappingTemplate: String ResponseMappingTemplateS3Location: String

Properties

ApiId

The AWS AppSync GraphQL API which you will attach with this function.

Required: Yes

Type: String

Update requires: Replacement

Name

The Name of the function.

Required: No

Type: String

Update requires: No interruption

Description

The Description of the function.

Required: No

Type: String

Update requires: No interruption

DataSourceName

The AWS AppSync data source that this function will run against in order to return data to the caller.

Required: No

Type: String

Update requires: No interruption

FunctionVersion

The version of the function.

Required: No

Type: String

Update requires: No interruption

RequestMappingTemplate

The function’s request mapping template, written in text within the CloudFormation template.

Required: No

Type: String

Update requires: No interruption

RequestMappingTemplateS3Location

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

Required: No

Type: String

Update requires: No interruption

ResponseMappingTemplate

The function’s response mapping template, written in text within the CloudFormation template.

Required: No

Type: String

Update requires: No interruption

ResponseMappingTemplateS3Location

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

Required: No

Type: String

Update requires: No interruption

Return Values

Ref

When you pass the logical ID of an AWS::AppSync::FunctionConfiguration resource to the intrinsic Ref function, the function returns the ARN of the FunctionConfiguration, such as arn:aws:appsync:us-east-1:123456789012:apis/graphqlapiid/functions/functionid.

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.

FunctionName

The name of this function.

FunctionArn

ARN of the Function, such as arn:aws:appsync:us-east-1:123456789012:apis/graphqlapiid/functions/functionId.

FunctionId

The unique Id of this function.

DataSourceName

The name of data source this function will attach.

For more information about using Fn::GetAtt, see Fn::GetAtt.

Examples

Function creation example

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

JSON

{ "Parameters": { "graphQlApiId": { "Type": "String" }, "name": { "Type": "String" }, "description": { "Type": "String" }, "dataSourceName": { "Type": "String" }, "functionVersion": { "Type": "String" }, "requestMappingTemplateS3LocationInput": { "Type": "String" }, "responseMappingTemplateS3LocationInput": { "Type": "String" } }, "Resources": { "FunctionConfiguration": { "Type": "AWS::AppSync::FunctionConfiguration", "Properties": { "ApiId": { "Ref": "graphQlApiId" }, "Name": { "Ref": "name" }, "Description": { "Ref": "description" }, "FunctionVersion": { "Ref": "functionVersion" }, "DataSourceName": { "Ref": "dataSourceName" }, "RequestMappingTemplateS3Location": { "Ref": "requestMappingTemplateS3LocationInput" }, "ResponseMappingTemplateS3Location": { "Ref": "responseMappingTemplateS3LocationInput" } } } } }

YAML

Parameters: graphQlApiId: Type: String dataSourceName: Type: String name: Type: String description: Type: String functionVersion: Type: String requestMappingTemplateS3LocationInput: Type: String responseMappingTemplateS3LocationInput: Type: String Resources: FunctionConfiguration: Type: AWS::AppSync::FunctionConfiguration Properties: ApiId: Ref: graphQlApiId Name: Ref: name Description: Ref: description DataSourceName: Ref: dataSourceName FunctionVersion: Ref: functionVersion RequestMappingTemplateS3Location: Ref: requestMappingTemplateS3LocationInput ResponseMappingTemplateS3Location: Ref: responseMappingTemplateS3LocationInput

See Also