Function
Configure functions in GraphQL APIs to perform certain operations.
Syntax
To declare this entity in your AWS Serverless Application Model (AWS SAM) template, use the following syntax.
YAML
LogicalId: CodeUri:StringDataSource:StringDescription:StringId:StringInlineCode:StringMaxBatchSize:IntegerName:StringRuntime:RuntimeSync: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, AWS CloudFormation requires that the file is first uploaded to Amazon S3 before deployment. You can use the AWS SAM CLI to facilitate this process. For more information, see How AWS SAM uploads local files at deployment.
Type: String
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
CodeS3Locationproperty of anAWS::AppSync::FunctionConfigurationresource. DataSource-
The name of the data source that this function will attach to.
-
To reference a data source within the
AWS::Serverless::GraphQLApiresource, specify its logical ID. -
To reference a data source outside of the
AWS::Serverless::GraphQLApiresource, provide itsNameattribute using theFn::GetAttintrinsic 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, AWS SAM will generate aNonevalue for theAWS::AppSync::DataSourceTypeobject.Type: String
Required: Yes
AWS CloudFormation compatibility: This property is passed directly to the
DataSourceNameproperty of anAWS::AppSync::FunctionConfigurationresource. -
Description-
The description of your function.
Type: String
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
Descriptionproperty of anAWS::AppSync::FunctionConfigurationresource. Id-
The Function ID for a function located outside of the
AWS::Serverless::GraphQLApiresource.-
To reference a function within the same AWS SAM template, use the
Fn::GetAttintrinsic 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. AWS SAM will automatically pass the Function ID of your referenced function.Type: String
Required: No
AWS CloudFormation compatibility: This property is unique to AWS SAM and doesn’t have an AWS CloudFormation equivalent.
-
InlineCode-
The function code that contains the request and response functions.
Type: String
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
Codeproperty of anAWS::AppSync::FunctionConfigurationresource. LogicalId-
The unique name of your function.
Type: String
Required: Yes
AWS CloudFormation compatibility: This property is passed directly to the
Nameproperty of anAWS::AppSync::FunctionConfigurationresource. MaxBatchSize-
The maximum number of resolver request inputs that will be sent to a single AWS Lambda function in a
BatchInvokeoperation.Type: Integer
Required: No
AWS CloudFormation compatibility: This property is passed directly to the MaxBatchSize property of an
AWS::AppSync::FunctionConfigurationresource. Name-
The name of the function. Specify to override the
LogicalIdvalue.Type: String
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
Nameproperty of anAWS::AppSync::FunctionConfigurationresource. Runtime-
Describes a runtime used by an AWS AppSync pipeline resolver or AWS AppSync function. Specifies the name and version of the runtime to use.
Type: Runtime
Required: Yes
AWS CloudFormation compatibility: This property is unique to AWS SAM and doesn't have an AWS CloudFormation equivalent. It is similar to the
Runtimeproperty of anAWS::AppSync::FunctionConfigurationresource. 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
AWS CloudFormation compatibility: This property is passed directly to the
SyncConfigproperty of anAWS::AppSync::FunctionConfigurationresource.