This is the new Amazon CloudFormation Template Reference Guide. Please update your bookmarks and links. For help getting started with CloudFormation, see the Amazon CloudFormation User Guide.
AWS::Greengrass::FunctionDefinition
The AWS::Greengrass::FunctionDefinition resource represents a function
         definition for Amazon IoT Greengrass. Function definitions are used to organize your function
         definition versions.
Function definitions can reference multiple function definition versions. All function definition versions must be associated with a function definition. Each function definition version can contain one or more functions.
Note
When you create a function definition, you can optionally include an initial function
            definition version. To associate a function definition version later, create an AWS::Greengrass::FunctionDefinitionVersion resource and
            specify the ID of this function definition.
After you create the function definition version that contains the functions you want
            to deploy, you must add it to your group version. For more information, see AWS::Greengrass::Group.
Syntax
To declare this entity in your Amazon CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::Greengrass::FunctionDefinition", "Properties" : { "InitialVersion" :FunctionDefinitionVersion, "Name" :String, "Tags" :[} }Tag, ... ]
YAML
Type: AWS::Greengrass::FunctionDefinition Properties: InitialVersion:FunctionDefinitionVersionName:StringTags:-Tag
Properties
- InitialVersion
- 
                    The function definition version to include when the function definition is created. A function definition version contains a list of functionproperty types.NoteTo associate a function definition version after the function definition is created, create an AWS::Greengrass::FunctionDefinitionVersionresource and specify the ID of this function definition.Required: No Type: FunctionDefinitionVersion Update requires: Replacement 
- Name
- 
                    The name of the function definition. Required: Yes Type: String Update requires: No interruption 
- 
                    Application-specific metadata to attach to the function definition. You can use tags in IAM policies to control access to Amazon IoT Greengrass resources. You can also use tags to categorize your resources. For more information, see Tagging Your Amazon IoT Greengrass Resources in the Amazon IoT Greengrass Version 1 Developer Guide . This Jsonproperty type is processed as a map of key-value pairs. It uses the following format, which is different from mostTagsimplementations in Amazon CloudFormation templates."Tags": { "KeyName0": "value", "KeyName1": "value", "KeyName2": "value" }Required: No Type: Array of TagUpdate requires: No interruption 
Return values
Ref
When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the ID of the function definition, such as
            1234a5b6-78cd-901e-2fgh-3i45j6k178l9. 
For more information about using the Ref function, see Ref.
Fn::GetAtt
The Fn::GetAtt intrinsic function 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 the Fn::GetAtt intrinsic function, see Fn::GetAtt.
- Arn
- 
                            The Amazon Resource Name (ARN) of the FunctionDefinition, such asarn:aws:greengrass:us-east-1:123456789012:/greengrass/definition/functions/1234a5b6-78cd-901e-2fgh-3i45j6k178l9.
- Id
- 
                            The ID of the FunctionDefinition, such as1234a5b6-78cd-901e-2fgh-3i45j6k178l9.
- LatestVersionArn
- 
                            The ARN of the last FunctionDefinitionVersionthat was added to theFunctionDefinition, such asarn:aws:greengrass:us-east-1:123456789012:/greengrass/definition/functions/1234a5b6-78cd-901e-2fgh-3i45j6k178l9/versions/9876ac30-4bdb-4f9d-95af-b5fdb66be1a2.
- Name
- 
                            The name of the FunctionDefinition, such asMyFunctionDefinition.
Examples
Function Definition Snippet
The following snippet defines a function definition resource with an initial
               version that contains a function. In this example, the Lambda function
               is created in another stack and is referenced using the ImportValue
               function.
For an example of a complete template, see the AWS::Greengrass::Group resource.
JSON
"TestFunctionDefinition": { "Type": "AWS::Greengrass::FunctionDefinition", "Properties": { "Name": "DemoTestFunctionDefinition", "InitialVersion": { "DefaultConfig": { "Execution": { "IsolationMode": "GreengrassContainer" } }, "Functions": [ { "Id": "TestLambda1", "FunctionArn": { "Fn::ImportValue": "TestCanaryLambdaVersionArn" }, "FunctionConfiguration": { "Pinned": "false", "Executable": "run.exe", "ExecArgs": "argument1", "MemorySize": "256", "Timeout": "3000", "EncodingType": "binary", "Environment": { "Variables": { "variable1": "value1" }, "ResourceAccessPolicies": [ { "ResourceId": "ResourceId1", "Permission": "ro" }, { "ResourceId": "ResourceId2", "Permission": "rw" } ], "AccessSysfs": "true", "Execution": { "RunAs": { "Uid": "1", "Gid": "10" } } } } } ] } } }
YAML
TestFunctionDefinition: Type: 'AWS::Greengrass::FunctionDefinition' Properties: Name: DemoTestFunctionDefinition InitialVersion: DefaultConfig: Execution: IsolationMode: GreengrassContainer Functions: - Id: TestLambda1 FunctionArn: !ImportValue TestCanaryLambdaVersionArn FunctionConfiguration: Pinned: 'false' Executable: run.exe ExecArgs: argument1 MemorySize: '256' Timeout: '3000' EncodingType: binary Environment: Variables: variable1: value1 ResourceAccessPolicies: - ResourceId: ResourceId1 Permission: ro - ResourceId: ResourceId2 Permission: rw AccessSysfs: 'true' Execution: RunAs: Uid: '1' Gid: '10'
See also
- 
                    CreateFunctionDefinition in the Amazon IoT Greengrass Version 1 API Reference