AWS::Greengrass::FunctionDefinitionVersion - Amazon CloudFormation
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

AWS::Greengrass::FunctionDefinitionVersion

The AWS::Greengrass::FunctionDefinitionVersion resource represents a function definition version for Amazon IoT Greengrass. A function definition version contains contain a list of functions.

Note

To create a function definition version, you must specify the ID of the function definition that you want to associate with the version. For information about creating a function definition, see AWS::Greengrass::FunctionDefinition.

After you create a 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::FunctionDefinitionVersion", "Properties" : { "DefaultConfig" : DefaultConfig, "FunctionDefinitionId" : String, "Functions" : [ Function, ... ] } }

YAML

Type: AWS::Greengrass::FunctionDefinitionVersion Properties: DefaultConfig: DefaultConfig FunctionDefinitionId: String Functions: - Function

Properties

DefaultConfig

The default configuration that applies to all Lambda functions in the group. Individual Lambda functions can override these settings.

Required: No

Type: DefaultConfig

Update requires: Replacement

FunctionDefinitionId

The ID of the function definition associated with this version. This value is a GUID.

Required: Yes

Type: String

Update requires: Replacement

Functions

The functions in this version.

Required: Yes

Type: Array of Function

Update requires: Replacement

Return values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the Amazon Resource Name (ARN) of the function definition version, such as arn:aws:greengrass:us-east-1:123456789012:/greengrass/definition/functions/1234a5b6-78cd-901e-2fgh-3i45j6k178l9/versions/9876ac30-4bdb-4f9d-95af-b5fdb66be1a2.

For more information about using the Ref function, see Ref.

Fn::GetAtt

Examples

Function Definition Version Snippet

The following snippet defines function definition and function definition version resources. The function definition version references the function definition and 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" } }, "TestFunctionDefinitionVersion": { "Type": "AWS::Greengrass::FunctionDefinitionVersion", "Properties": { "FunctionDefinitionId": { "Fn::GetAtt": [ "TestFunctionDefinition", "Id" ] }, "DefaultConfig": { "Execution": { "IsolationMode": "GreengrassContainer" } }, "Functions": [ { "Id": "TestLambda1", "FunctionArn": { "Fn::ImportValue": "TestCanaryLambdaVersionArn" }, "FunctionConfiguration": { "Pinned": "true", "Executable": "run.exe", "ExecArgs": "argument1", "MemorySize": "512", "Timeout": "2000", "EncodingType": "binary", "Environment": { "Variables": { "variable1": "value1" }, "ResourceAccessPolicies": [ { "ResourceId": "ResourceId1", "Permission": "ro" }, { "ResourceId": "ResourceId2", "Permission": "rw" } ], "AccessSysfs": "false", "Execution": { "RunAs": { "Uid": "1", "Gid": "10" } } } } } ] } }

YAML

TestFunctionDefinition: Type: 'AWS::Greengrass::FunctionDefinition' Properties: Name: DemoTestFunctionDefinition TestFunctionDefinitionVersion: Type: 'AWS::Greengrass::FunctionDefinitionVersion' Properties: FunctionDefinitionId: !GetAtt - TestFunctionDefinition - Id DefaultConfig: Execution: IsolationMode: GreengrassContainer Functions: - Id: TestLambda1 FunctionArn: !ImportValue TestCanaryLambdaVersionArn FunctionConfiguration: Pinned: 'true' Executable: run.exe ExecArgs: argument1 MemorySize: '512' Timeout: '2000' EncodingType: binary Environment: Variables: variable1: value1 ResourceAccessPolicies: - ResourceId: ResourceId1 Permission: ro - ResourceId: ResourceId2 Permission: rw AccessSysfs: 'false' Execution: RunAs: Uid: '1' Gid: '10'

See also