AWS CloudFormation
User Guide (Version )

AWS::AppSync::FunctionConfiguration

The AWS::AppSync::FunctionConfiguration resource defines the functions in GraphQL APIs to perform certain operations. You can use pipeline resolvers to attach functions. For more information, see Pipeline Resolvers in the AWS AppSync Developer Guide.

Syntax

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

JSON

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

YAML

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

Properties

ApiId

The AWS AppSync GraphQL API that you want to attach using this function.

Required: Yes

Type: String

Update requires: Replacement

DataSourceName

The name of data source this function will attach.

Required: Yes

Type: String

Update requires: No interruption

Description

The Function description.

Required: No

Type: String

Update requires: No interruption

FunctionVersion

The version of the request mapping template. Currently only the 2018-05-29 version of the template is supported.

Required: Yes

Type: String

Update requires: No interruption

Name

The name of the function.

Required: Yes

Type: String

Update requires: No interruption

RequestMappingTemplate

The Function request mapping template. Functions support only the 2018-05-29 version of the request mapping template.

Required: No

Type: String

Update requires: No interruption

RequestMappingTemplateS3Location

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

Required: No

Type: String

Update requires: No interruption

ResponseMappingTemplate

The Function response mapping template.

Required: No

Type: String

Update requires: No interruption

ResponseMappingTemplateS3Location

The location of a response mapping template in an Amazon S3 bucket. Use this if you want to provision with a template file in Amazon S3 rather than embedding it 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.

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

DataSourceName

The name of data source this function will attach.

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.

Name

The name of the function.

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

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

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" } } } } }

See Also