Function
Configure functions in GraphQL APIs to perform certain operations.
Syntax
To declare this entity in your Amazon Serverless Application Model (Amazon SAM) template, use the following syntax.
YAML
LogicalId
: CodeUri:String
DataSource:String
Description:String
Id:String
InlineCode:String
MaxBatchSize:Integer
Name:String
Runtime:Runtime
Sync:SyncConfig
Properties
CodeUri
-
The function code’s Amazon Simple Storage Service (Amazon S3) URI or path to local folder.
If you specify a path to a local folder, Amazon CloudFormation requires that the file is first uploaded to Amazon S3 before deployment. You can use the Amazon SAM CLI to facilitate this process. For more information, see How to upload local files at deployment with Amazon SAM CLI.
Type: String
Required: No
Amazon CloudFormation compatibility: This property is passed directly to the
CodeS3Location
property of anAWS::AppSync::FunctionConfiguration
resource. DataSource
-
The name of the data source that this function will attach to.
-
To reference a data source within the
AWS::Serverless::GraphQLApi
resource, specify its logical ID. -
To reference a data source outside of the
AWS::Serverless::GraphQLApi
resource, provide itsName
attribute using theFn::GetAtt
intrinsic function. For example,!GetAtt MyLambdaDataSource.Name
. -
To reference a data source from a different stack, use
Fn::ImportValue
.
If a variation of
[NONE | None | none]
is specified, Amazon SAM will generate aNone
value for theAWS::AppSync::DataSource
Type
object.Type: String
Required: Yes
Amazon CloudFormation compatibility: This property is passed directly to the
DataSourceName
property of anAWS::AppSync::FunctionConfiguration
resource. -
Description
-
The description of your function.
Type: String
Required: No
Amazon CloudFormation compatibility: This property is passed directly to the
Description
property of anAWS::AppSync::FunctionConfiguration
resource. Id
-
The Function ID for a function located outside of the
AWS::Serverless::GraphQLApi
resource.-
To reference a function within the same Amazon SAM template, use the
Fn::GetAtt
intrinsic function. For exampleId: !GetAtt createPostItemFunc.FunctionId
. -
To reference a function from a different stack, use
Fn::ImportValue
.
When using
Id
, all other properties are not allowed. Amazon SAM will automatically pass the Function ID of your referenced function.Type: String
Required: No
Amazon CloudFormation compatibility: This property is unique to Amazon SAM and doesn’t have an Amazon CloudFormation equivalent.
-
InlineCode
-
The function code that contains the request and response functions.
Type: String
Required: No
Amazon CloudFormation compatibility: This property is passed directly to the
Code
property of anAWS::AppSync::FunctionConfiguration
resource. LogicalId
-
The unique name of your function.
Type: String
Required: Yes
Amazon CloudFormation compatibility: This property is passed directly to the
Name
property of anAWS::AppSync::FunctionConfiguration
resource. MaxBatchSize
-
The maximum number of resolver request inputs that will be sent to a single Amazon Lambda function in a
BatchInvoke
operation.Type: Integer
Required: No
Amazon CloudFormation compatibility: This property is passed directly to the MaxBatchSize property of an
AWS::AppSync::FunctionConfiguration
resource. Name
-
The name of the function. Specify to override the
LogicalId
value.Type: String
Required: No
Amazon CloudFormation compatibility: This property is passed directly to the
Name
property of anAWS::AppSync::FunctionConfiguration
resource. Runtime
-
Describes a runtime used by an Amazon AppSync pipeline resolver or Amazon AppSync function. Specifies the name and version of the runtime to use.
Type: Runtime
Required: Yes
Amazon CloudFormation compatibility: This property is unique to Amazon SAM and doesn't have an Amazon CloudFormation equivalent. It is similar to the
Runtime
property of anAWS::AppSync::FunctionConfiguration
resource. Sync
-
Describes a Sync configuration for a function.
Specifies which Conflict Detection strategy and Resolution strategy to use when the function is invoked.
Type: SyncConfig
Required: No
Amazon CloudFormation compatibility: This property is passed directly to the
SyncConfig
property of anAWS::AppSync::FunctionConfiguration
resource.