

This is the new *CloudFormation Template Reference Guide*. Please update your bookmarks and links. For help getting started with CloudFormation, see the [AWS CloudFormation User Guide](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html).

# AWS::Greengrass::FunctionDefinition
<a name="aws-resource-greengrass-functiondefinition"></a>

The `AWS::Greengrass::FunctionDefinition` resource represents a function definition for AWS 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 [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-greengrass-functiondefinitionversion.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-greengrass-functiondefinitionversion.html) 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 [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-greengrass-group.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-greengrass-group.html).

## Syntax
<a name="aws-resource-greengrass-functiondefinition-syntax"></a>

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

### JSON
<a name="aws-resource-greengrass-functiondefinition-syntax.json"></a>

```
{
  "Type" : "AWS::Greengrass::FunctionDefinition",
  "Properties" : {
      "[InitialVersion](#cfn-greengrass-functiondefinition-initialversion)" : FunctionDefinitionVersion,
      "[Name](#cfn-greengrass-functiondefinition-name)" : String,
      "[Tags](#cfn-greengrass-functiondefinition-tags)" : [ [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-resource-tags.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-resource-tags.html), ... ]
    }
}
```

### YAML
<a name="aws-resource-greengrass-functiondefinition-syntax.yaml"></a>

```
Type: AWS::Greengrass::FunctionDefinition
Properties:
  [InitialVersion](#cfn-greengrass-functiondefinition-initialversion): 
    FunctionDefinitionVersion
  [Name](#cfn-greengrass-functiondefinition-name): String
  [Tags](#cfn-greengrass-functiondefinition-tags): 
    - [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-resource-tags.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-resource-tags.html)
```

## Properties
<a name="aws-resource-greengrass-functiondefinition-properties"></a>

`InitialVersion`  <a name="cfn-greengrass-functiondefinition-initialversion"></a>
The function definition version to include when the function definition is created. A function definition version contains a list of [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinition-function.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinition-function.html) property types.  
To associate a function definition version after the function definition is created, create an [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-greengrass-functiondefinitionversion.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-greengrass-functiondefinitionversion.html) resource and specify the ID of this function definition.
*Required*: No  
*Type*: [FunctionDefinitionVersion](aws-properties-greengrass-functiondefinition-functiondefinitionversion.md)  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Name`  <a name="cfn-greengrass-functiondefinition-name"></a>
The name of the function definition.  
*Required*: Yes  
*Type*: String  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Tags`  <a name="cfn-greengrass-functiondefinition-tags"></a>
Application-specific metadata to attach to the function definition. You can use tags in IAM policies to control access to AWS IoT Greengrass resources. You can also use tags to categorize your resources. For more information, see [Tagging Your AWS IoT Greengrass Resources](https://docs.aws.amazon.com/greengrass/v1/developerguide/tagging.html) in the * AWS IoT Greengrass Version 1 Developer Guide *.  
This `Json` property type is processed as a map of key-value pairs. It uses the following format, which is different from most `Tags` implementations in CloudFormation templates.  

```
"Tags": {
    "KeyName0": "value",
    "KeyName1": "value",
    "KeyName2": "value"
}
```
*Required*: No  
*Type*: Array of [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-resource-tags.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-properties-resource-tags.html)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

## Return values
<a name="aws-resource-greengrass-functiondefinition-return-values"></a>

### Ref
<a name="aws-resource-greengrass-functiondefinition-return-values-ref"></a>

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 [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html).

### Fn::GetAtt
<a name="aws-resource-greengrass-functiondefinition-return-values-fn--getatt"></a>

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 [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-getatt.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-getatt.html).

#### 
<a name="aws-resource-greengrass-functiondefinition-return-values-fn--getatt-fn--getatt"></a>

`Arn`  <a name="Arn-fn::getatt"></a>
The Amazon Resource Name (ARN) of the `FunctionDefinition`, such as `arn:aws:greengrass:us-east-1:123456789012:/greengrass/definition/functions/1234a5b6-78cd-901e-2fgh-3i45j6k178l9`. 

`Id`  <a name="Id-fn::getatt"></a>
The ID of the `FunctionDefinition`, such as `1234a5b6-78cd-901e-2fgh-3i45j6k178l9`. 

`LatestVersionArn`  <a name="LatestVersionArn-fn::getatt"></a>
The ARN of the last `FunctionDefinitionVersion` that was added to the `FunctionDefinition`, such as `arn:aws:greengrass:us-east-1:123456789012:/greengrass/definition/functions/1234a5b6-78cd-901e-2fgh-3i45j6k178l9/versions/9876ac30-4bdb-4f9d-95af-b5fdb66be1a2`. 

`Name`  <a name="Name-fn::getatt"></a>
The name of the `FunctionDefinition`, such as `MyFunctionDefinition`. 

## Examples
<a name="aws-resource-greengrass-functiondefinition--examples"></a>



### Function Definition Snippet
<a name="aws-resource-greengrass-functiondefinition--examples--Function_Definition_Snippet"></a>

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 [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-greengrass-group.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-greengrass-group.html) resource.

#### JSON
<a name="aws-resource-greengrass-functiondefinition--examples--Function_Definition_Snippet--json"></a>

```
"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
<a name="aws-resource-greengrass-functiondefinition--examples--Function_Definition_Snippet--yaml"></a>

```
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
<a name="aws-resource-greengrass-functiondefinition--seealso"></a>
+ [CreateFunctionDefinition](https://docs.aws.amazon.com/greengrass/v1/apireference/createfunctiondefinition-post.html) in the * AWS IoT Greengrass Version 1 API Reference *
+  [AWS IoT Greengrass Version 1 Developer Guide](https://docs.aws.amazon.com/greengrass/v1/developerguide/) 

# AWS::Greengrass::FunctionDefinition DefaultConfig
<a name="aws-properties-greengrass-functiondefinition-defaultconfig"></a>

<a name="aws-properties-greengrass-functiondefinition-defaultconfig-description"></a>The default configuration that applies to all Lambda functions in the function definition version. Individual Lambda functions can override these settings.

<a name="aws-properties-greengrass-functiondefinition-defaultconfig-inheritance"></a> In an CloudFormation template, `DefaultConfig` is a property of the [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinition-functiondefinitionversion.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinition-functiondefinitionversion.html) property type.

## Syntax
<a name="aws-properties-greengrass-functiondefinition-defaultconfig-syntax"></a>

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

### JSON
<a name="aws-properties-greengrass-functiondefinition-defaultconfig-syntax.json"></a>

```
{
  "[Execution](#cfn-greengrass-functiondefinition-defaultconfig-execution)" : Execution
}
```

### YAML
<a name="aws-properties-greengrass-functiondefinition-defaultconfig-syntax.yaml"></a>

```
  [Execution](#cfn-greengrass-functiondefinition-defaultconfig-execution): 
    Execution
```

## Properties
<a name="aws-properties-greengrass-functiondefinition-defaultconfig-properties"></a>

`Execution`  <a name="cfn-greengrass-functiondefinition-defaultconfig-execution"></a>
Configuration settings for the Lambda execution environment on the AWS IoT Greengrass core.  
*Required*: Yes  
*Type*: [Execution](aws-properties-greengrass-functiondefinition-execution.md)  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

## See also
<a name="aws-properties-greengrass-functiondefinition-defaultconfig--seealso"></a>
+ [FunctionDefaultConfig](https://docs.aws.amazon.com/greengrass/v1/apireference/definitions-functiondefaultconfig.html) in the * AWS IoT Greengrass Version 1 API Reference *
+  [AWS IoT Greengrass Version 1 Developer Guide](https://docs.aws.amazon.com/greengrass/v1/developerguide/) 

# AWS::Greengrass::FunctionDefinition Environment
<a name="aws-properties-greengrass-functiondefinition-environment"></a>

<a name="aws-properties-greengrass-functiondefinition-environment-description"></a>The environment configuration for a Lambda function on the AWS IoT Greengrass core.

<a name="aws-properties-greengrass-functiondefinition-environment-inheritance"></a> In an CloudFormation template, `Environment` is a property of the [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinition-functionconfiguration.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinition-functionconfiguration.html) property type.

## Syntax
<a name="aws-properties-greengrass-functiondefinition-environment-syntax"></a>

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

### JSON
<a name="aws-properties-greengrass-functiondefinition-environment-syntax.json"></a>

```
{
  "[AccessSysfs](#cfn-greengrass-functiondefinition-environment-accesssysfs)" : Boolean,
  "[Execution](#cfn-greengrass-functiondefinition-environment-execution)" : Execution,
  "[ResourceAccessPolicies](#cfn-greengrass-functiondefinition-environment-resourceaccesspolicies)" : [ ResourceAccessPolicy, ... ],
  "[Variables](#cfn-greengrass-functiondefinition-environment-variables)" : Json
}
```

### YAML
<a name="aws-properties-greengrass-functiondefinition-environment-syntax.yaml"></a>

```
  [AccessSysfs](#cfn-greengrass-functiondefinition-environment-accesssysfs): Boolean
  [Execution](#cfn-greengrass-functiondefinition-environment-execution): 
    Execution
  [ResourceAccessPolicies](#cfn-greengrass-functiondefinition-environment-resourceaccesspolicies): 
    - ResourceAccessPolicy
  [Variables](#cfn-greengrass-functiondefinition-environment-variables): Json
```

## Properties
<a name="aws-properties-greengrass-functiondefinition-environment-properties"></a>

`AccessSysfs`  <a name="cfn-greengrass-functiondefinition-environment-accesssysfs"></a>
Indicates whether the function is allowed to access the `/sys` directory on the core device, which allows the read device information from `/sys`.  
This property applies only to Lambda functions that run in a Greengrass container.
*Required*: No  
*Type*: Boolean  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Execution`  <a name="cfn-greengrass-functiondefinition-environment-execution"></a>
Settings for the Lambda execution environment in AWS IoT Greengrass.  
*Required*: No  
*Type*: [Execution](aws-properties-greengrass-functiondefinition-execution.md)  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`ResourceAccessPolicies`  <a name="cfn-greengrass-functiondefinition-environment-resourceaccesspolicies"></a>
A list of the [resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-resourcedefinitionversion-resourceinstance.html) in the group that the function can access, with the corresponding read-only or read-write permissions. The maximum is 10 resources.  
This property applies only for Lambda functions that run in a Greengrass container.
*Required*: No  
*Type*: Array of [ResourceAccessPolicy](aws-properties-greengrass-functiondefinition-resourceaccesspolicy.md)  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Variables`  <a name="cfn-greengrass-functiondefinition-environment-variables"></a>
Environment variables for the Lambda function.  
*Required*: No  
*Type*: Json  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

## See also
<a name="aws-properties-greengrass-functiondefinition-environment--seealso"></a>
+ [FunctionConfigurationEnvironment](https://docs.aws.amazon.com/greengrass/v1/apireference/definitions-functionconfigurationenvironment.html) in the * AWS IoT Greengrass Version 1 API Reference *
+  [AWS IoT Greengrass Version 1 Developer Guide](https://docs.aws.amazon.com/greengrass/v1/developerguide/) 

# AWS::Greengrass::FunctionDefinition Execution
<a name="aws-properties-greengrass-functiondefinition-execution"></a>

<a name="aws-properties-greengrass-functiondefinition-execution-description"></a>Configuration settings for the Lambda execution environment on the AWS IoT Greengrass core.

<a name="aws-properties-greengrass-functiondefinition-execution-inheritance"></a> In an CloudFormation template, `Execution` is a property of the [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinition-defaultconfig.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinition-defaultconfig.html) property type for a function definition version and the [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinition-environment.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinition-environment.html) property type for a function.

## Syntax
<a name="aws-properties-greengrass-functiondefinition-execution-syntax"></a>

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

### JSON
<a name="aws-properties-greengrass-functiondefinition-execution-syntax.json"></a>

```
{
  "[IsolationMode](#cfn-greengrass-functiondefinition-execution-isolationmode)" : String,
  "[RunAs](#cfn-greengrass-functiondefinition-execution-runas)" : RunAs
}
```

### YAML
<a name="aws-properties-greengrass-functiondefinition-execution-syntax.yaml"></a>

```
  [IsolationMode](#cfn-greengrass-functiondefinition-execution-isolationmode): String
  [RunAs](#cfn-greengrass-functiondefinition-execution-runas): 
    RunAs
```

## Properties
<a name="aws-properties-greengrass-functiondefinition-execution-properties"></a>

`IsolationMode`  <a name="cfn-greengrass-functiondefinition-execution-isolationmode"></a>
The containerization that the Lambda function runs in. Valid values are `GreengrassContainer` or `NoContainer`. Typically, this is `GreengrassContainer`. For more information, see [Containerization](https://docs.aws.amazon.com/greengrass/v1/developerguide/lambda-group-config.html#lambda-function-containerization) in the * AWS IoT Greengrass Version 1 Developer Guide *.  
+ When set on the [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinitionversion-defaultconfig.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinitionversion-defaultconfig.html) property of a function definition version, this setting is used as the default containerization for all Lambda functions in the function definition version.
+ When set on the [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinitionversion-environment.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinitionversion-environment.html) property of a function, this setting applies to the individual function and overrides the default. Omit this value to run the function with the default containerization.
We recommend that you run in a Greengrass container unless your business case requires that you run without containerization.
*Required*: No  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`RunAs`  <a name="cfn-greengrass-functiondefinition-execution-runas"></a>
The user and group permissions used to run the Lambda function. Typically, this is the ggc\$1user and ggc\$1group. For more information, see [Run as](https://docs.aws.amazon.com/greengrass/v1/developerguide/lambda-group-config.html#lambda-access-identity.html) in the * AWS IoT Greengrass Version 1 Developer Guide *.  
+ When set on the [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinitionversion-defaultconfig.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinitionversion-defaultconfig.html) property of a function definition version, this setting is used as the default access identity for all Lambda functions in the function definition version.
+ When set on the [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinitionversion-environment.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinitionversion-environment.html) property of a function, this setting applies to the individual function and overrides the default. You can override the user, group, or both. Omit this value to run the function with the default permissions.
Running as the root user increases risks to your data and device. Do not run as root (UID/GID=0) unless your business case requires it. For more information and requirements, see [Running a Lambda Function as Root](https://docs.aws.amazon.com/greengrass/v1/developerguide/lambda-group-config.html#lambda-running-as-root). 
*Required*: No  
*Type*: [RunAs](aws-properties-greengrass-functiondefinition-runas.md)  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

## See also
<a name="aws-properties-greengrass-functiondefinition-execution--seealso"></a>
+ [FunctionExecutionConfig](https://docs.aws.amazon.com/greengrass/v1/apireference/definitions-functionexecutionconfig.html) in the * AWS IoT Greengrass Version 1 API Reference *
+  [AWS IoT Greengrass Version 1 Developer Guide](https://docs.aws.amazon.com/greengrass/v1/developerguide/) 

# AWS::Greengrass::FunctionDefinition Function
<a name="aws-properties-greengrass-functiondefinition-function"></a>

<a name="aws-properties-greengrass-functiondefinition-function-description"></a>A function is a Lambda function that's referenced from an AWS IoT Greengrass group. The function is deployed to a Greengrass core where it runs locally. For more information, see [Run Lambda Functions on the AWS IoT Greengrass Core](https://docs.aws.amazon.com/greengrass/v1/developerguide/lambda-functions.html) in the * AWS IoT Greengrass Version 1 Developer Guide *.

<a name="aws-properties-greengrass-functiondefinition-function-inheritance"></a> In an CloudFormation template, the `Functions` property of the [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinition-functiondefinitionversion.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinition-functiondefinitionversion.html) property type contains a list of `Function` property types.

## Syntax
<a name="aws-properties-greengrass-functiondefinition-function-syntax"></a>

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

### JSON
<a name="aws-properties-greengrass-functiondefinition-function-syntax.json"></a>

```
{
  "[FunctionArn](#cfn-greengrass-functiondefinition-function-functionarn)" : String,
  "[FunctionConfiguration](#cfn-greengrass-functiondefinition-function-functionconfiguration)" : FunctionConfiguration,
  "[Id](#cfn-greengrass-functiondefinition-function-id)" : String
}
```

### YAML
<a name="aws-properties-greengrass-functiondefinition-function-syntax.yaml"></a>

```
  [FunctionArn](#cfn-greengrass-functiondefinition-function-functionarn): String
  [FunctionConfiguration](#cfn-greengrass-functiondefinition-function-functionconfiguration): 
    FunctionConfiguration
  [Id](#cfn-greengrass-functiondefinition-function-id): String
```

## Properties
<a name="aws-properties-greengrass-functiondefinition-function-properties"></a>

`FunctionArn`  <a name="cfn-greengrass-functiondefinition-function-functionarn"></a>
The Amazon Resource Name (ARN) of the alias (recommended) or version of the referenced Lambda function.  
*Required*: Yes  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`FunctionConfiguration`  <a name="cfn-greengrass-functiondefinition-function-functionconfiguration"></a>
The group-specific settings of the Lambda function. These settings configure the function's behavior in the Greengrass group.  
*Required*: Yes  
*Type*: [FunctionConfiguration](aws-properties-greengrass-functiondefinition-functionconfiguration.md)  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Id`  <a name="cfn-greengrass-functiondefinition-function-id"></a>
A descriptive or arbitrary ID for the function. This value must be unique within the function definition version. Maximum length is 128 characters with pattern `[a-zA-Z0-9:_-]+`.  
*Required*: Yes  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

## See also
<a name="aws-properties-greengrass-functiondefinition-function--seealso"></a>
+ [Function](https://docs.aws.amazon.com/greengrass/v1/apireference/definitions-function.html) in the * AWS IoT Greengrass Version 1 API Reference *
+  [AWS IoT Greengrass Version 1 Developer Guide](https://docs.aws.amazon.com/greengrass/v1/developerguide/) 

# AWS::Greengrass::FunctionDefinition FunctionConfiguration
<a name="aws-properties-greengrass-functiondefinition-functionconfiguration"></a>

<a name="aws-properties-greengrass-functiondefinition-functionconfiguration-description"></a>The group-specific configuration settings for a Lambda function. These settings configure the function's behavior in the Greengrass group. For more information, see [Controlling Execution of Greengrass Lambda Functions by Using Group-Specific Configuration](https://docs.aws.amazon.com/greengrass/v1/developerguide/lambda-group-config.html) in the * AWS IoT Greengrass Version 1 Developer Guide *.

<a name="aws-properties-greengrass-functiondefinition-functionconfiguration-inheritance"></a> In an CloudFormation template, `FunctionConfiguration` is a property of the [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinition-function.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinition-function.html) property type.

## Syntax
<a name="aws-properties-greengrass-functiondefinition-functionconfiguration-syntax"></a>

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

### JSON
<a name="aws-properties-greengrass-functiondefinition-functionconfiguration-syntax.json"></a>

```
{
  "[EncodingType](#cfn-greengrass-functiondefinition-functionconfiguration-encodingtype)" : String,
  "[Environment](#cfn-greengrass-functiondefinition-functionconfiguration-environment)" : Environment,
  "[ExecArgs](#cfn-greengrass-functiondefinition-functionconfiguration-execargs)" : String,
  "[Executable](#cfn-greengrass-functiondefinition-functionconfiguration-executable)" : String,
  "[MemorySize](#cfn-greengrass-functiondefinition-functionconfiguration-memorysize)" : Integer,
  "[Pinned](#cfn-greengrass-functiondefinition-functionconfiguration-pinned)" : Boolean,
  "[Timeout](#cfn-greengrass-functiondefinition-functionconfiguration-timeout)" : Integer
}
```

### YAML
<a name="aws-properties-greengrass-functiondefinition-functionconfiguration-syntax.yaml"></a>

```
  [EncodingType](#cfn-greengrass-functiondefinition-functionconfiguration-encodingtype): String
  [Environment](#cfn-greengrass-functiondefinition-functionconfiguration-environment): 
    Environment
  [ExecArgs](#cfn-greengrass-functiondefinition-functionconfiguration-execargs): String
  [Executable](#cfn-greengrass-functiondefinition-functionconfiguration-executable): String
  [MemorySize](#cfn-greengrass-functiondefinition-functionconfiguration-memorysize): Integer
  [Pinned](#cfn-greengrass-functiondefinition-functionconfiguration-pinned): Boolean
  [Timeout](#cfn-greengrass-functiondefinition-functionconfiguration-timeout): Integer
```

## Properties
<a name="aws-properties-greengrass-functiondefinition-functionconfiguration-properties"></a>

`EncodingType`  <a name="cfn-greengrass-functiondefinition-functionconfiguration-encodingtype"></a>
The expected encoding type of the input payload for the function. Valid values are `json` (default) and `binary`.  
*Required*: No  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Environment`  <a name="cfn-greengrass-functiondefinition-functionconfiguration-environment"></a>
The environment configuration of the function.  
*Required*: No  
*Type*: [Environment](aws-properties-greengrass-functiondefinition-environment.md)  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`ExecArgs`  <a name="cfn-greengrass-functiondefinition-functionconfiguration-execargs"></a>
The execution arguments.  
*Required*: No  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Executable`  <a name="cfn-greengrass-functiondefinition-functionconfiguration-executable"></a>
The name of the function executable.  
*Required*: No  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`MemorySize`  <a name="cfn-greengrass-functiondefinition-functionconfiguration-memorysize"></a>
The memory size (in KB) required by the function.  
This property applies only to Lambda functions that run in a Greengrass container.
*Required*: No  
*Type*: Integer  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Pinned`  <a name="cfn-greengrass-functiondefinition-functionconfiguration-pinned"></a>
Indicates whether the function is pinned (or *long-lived*). Pinned functions start when the core starts and process all requests in the same container. The default value is false.  
*Required*: No  
*Type*: Boolean  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Timeout`  <a name="cfn-greengrass-functiondefinition-functionconfiguration-timeout"></a>
The allowed execution time (in seconds) after which the function should terminate. For pinned functions, this timeout applies for each request.  
*Required*: No  
*Type*: Integer  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

## See also
<a name="aws-properties-greengrass-functiondefinition-functionconfiguration--seealso"></a>
+ [FunctionConfiguration](https://docs.aws.amazon.com/greengrass/v1/apireference/definitions-functionconfiguration.html) in the * AWS IoT Greengrass Version 1 API Reference *
+  [AWS IoT Greengrass Version 1 Developer Guide](https://docs.aws.amazon.com/greengrass/v1/developerguide/) 

# AWS::Greengrass::FunctionDefinition FunctionDefinitionVersion
<a name="aws-properties-greengrass-functiondefinition-functiondefinitionversion"></a>

<a name="aws-properties-greengrass-functiondefinition-functiondefinitionversion-description"></a>A function definition version contains a list of functions.

**Note**  
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 [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-greengrass-group.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-greengrass-group.html).

<a name="aws-properties-greengrass-functiondefinition-functiondefinitionversion-inheritance"></a> In an CloudFormation template, `FunctionDefinitionVersion` is the property type of the `InitialVersion` property in the [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-greengrass-functiondefinition.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-greengrass-functiondefinition.html) resource.

## Syntax
<a name="aws-properties-greengrass-functiondefinition-functiondefinitionversion-syntax"></a>

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

### JSON
<a name="aws-properties-greengrass-functiondefinition-functiondefinitionversion-syntax.json"></a>

```
{
  "[DefaultConfig](#cfn-greengrass-functiondefinition-functiondefinitionversion-defaultconfig)" : DefaultConfig,
  "[Functions](#cfn-greengrass-functiondefinition-functiondefinitionversion-functions)" : [ Function, ... ]
}
```

### YAML
<a name="aws-properties-greengrass-functiondefinition-functiondefinitionversion-syntax.yaml"></a>

```
  [DefaultConfig](#cfn-greengrass-functiondefinition-functiondefinitionversion-defaultconfig): 
    DefaultConfig
  [Functions](#cfn-greengrass-functiondefinition-functiondefinitionversion-functions): 
    - Function
```

## Properties
<a name="aws-properties-greengrass-functiondefinition-functiondefinitionversion-properties"></a>

`DefaultConfig`  <a name="cfn-greengrass-functiondefinition-functiondefinitionversion-defaultconfig"></a>
The default configuration that applies to all Lambda functions in the group. Individual Lambda functions can override these settings.  
*Required*: No  
*Type*: [DefaultConfig](aws-properties-greengrass-functiondefinition-defaultconfig.md)  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Functions`  <a name="cfn-greengrass-functiondefinition-functiondefinitionversion-functions"></a>
The functions in this version.  
*Required*: Yes  
*Type*: Array of [Function](aws-properties-greengrass-functiondefinition-function.md)  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

## See also
<a name="aws-properties-greengrass-functiondefinition-functiondefinitionversion--seealso"></a>
+ [FunctionDefinitionVersion](https://docs.aws.amazon.com/greengrass/v1/apireference/definitions-functiondefinitionversion.html) in the * AWS IoT Greengrass Version 1 API Reference *
+  [AWS IoT Greengrass Version 1 Developer Guide](https://docs.aws.amazon.com/greengrass/v1/developerguide/) 

# AWS::Greengrass::FunctionDefinition ResourceAccessPolicy
<a name="aws-properties-greengrass-functiondefinition-resourceaccesspolicy"></a>

<a name="aws-properties-greengrass-functiondefinition-resourceaccesspolicy-description"></a>A list of the [resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-resourcedefinitionversion-resourceinstance.html) in the group that the function can access, with the corresponding read-only or read-write permissions. The maximum is 10 resources.

**Note**  
This property applies only to Lambda functions that run in a Greengrass container.

<a name="aws-properties-greengrass-functiondefinition-resourceaccesspolicy-inheritance"></a> In an CloudFormation template, `ResourceAccessPolicy` is a property of the [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinition-environment.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinition-environment.html) property type.

## Syntax
<a name="aws-properties-greengrass-functiondefinition-resourceaccesspolicy-syntax"></a>

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

### JSON
<a name="aws-properties-greengrass-functiondefinition-resourceaccesspolicy-syntax.json"></a>

```
{
  "[Permission](#cfn-greengrass-functiondefinition-resourceaccesspolicy-permission)" : String,
  "[ResourceId](#cfn-greengrass-functiondefinition-resourceaccesspolicy-resourceid)" : String
}
```

### YAML
<a name="aws-properties-greengrass-functiondefinition-resourceaccesspolicy-syntax.yaml"></a>

```
  [Permission](#cfn-greengrass-functiondefinition-resourceaccesspolicy-permission): String
  [ResourceId](#cfn-greengrass-functiondefinition-resourceaccesspolicy-resourceid): String
```

## Properties
<a name="aws-properties-greengrass-functiondefinition-resourceaccesspolicy-properties"></a>

`Permission`  <a name="cfn-greengrass-functiondefinition-resourceaccesspolicy-permission"></a>
The read-only or read-write access that the Lambda function has to the resource. Valid values are `ro` or `rw`.  
*Required*: No  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`ResourceId`  <a name="cfn-greengrass-functiondefinition-resourceaccesspolicy-resourceid"></a>
The ID of the resource. This ID is assigned to the resource when you create the resource definition.  
*Required*: Yes  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

## See also
<a name="aws-properties-greengrass-functiondefinition-resourceaccesspolicy--seealso"></a>
+ [ResourceAccessPolicy](https://docs.aws.amazon.com/greengrass/v1/apireference/definitions-resourceaccesspolicy.html) in the * AWS IoT Greengrass Version 1 API Reference *
+  [AWS IoT Greengrass Version 1 Developer Guide](https://docs.aws.amazon.com/greengrass/v1/developerguide/) 

# AWS::Greengrass::FunctionDefinition RunAs
<a name="aws-properties-greengrass-functiondefinition-runas"></a>

<a name="aws-properties-greengrass-functiondefinition-runas-description"></a>The access identity whose permissions are used to run the Lambda function. This setting overrides the default access identity that's specified for the group (by default, ggc\$1user and ggc\$1group). You can override the user, group, or both. For more information, see [Run as](https://docs.aws.amazon.com/greengrass/v1/developerguide/lambda-group-config.html#lambda-access-identity.html) in the * AWS IoT Greengrass Version 1 Developer Guide *.

**Important**  
Running as the root user increases risks to your data and device. Do not run as root (UID/GID=0) unless your business case requires it. For more information and requirements, see [Running a Lambda Function as Root](https://docs.aws.amazon.com/greengrass/v1/developerguide/lambda-group-config.html#lambda-running-as-root). 

<a name="aws-properties-greengrass-functiondefinition-runas-inheritance"></a> In an CloudFormation template, `RunAs` is a property of the [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinition-execution.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinition-execution.html) property type.

## Syntax
<a name="aws-properties-greengrass-functiondefinition-runas-syntax"></a>

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

### JSON
<a name="aws-properties-greengrass-functiondefinition-runas-syntax.json"></a>

```
{
  "[Gid](#cfn-greengrass-functiondefinition-runas-gid)" : Integer,
  "[Uid](#cfn-greengrass-functiondefinition-runas-uid)" : Integer
}
```

### YAML
<a name="aws-properties-greengrass-functiondefinition-runas-syntax.yaml"></a>

```
  [Gid](#cfn-greengrass-functiondefinition-runas-gid): Integer
  [Uid](#cfn-greengrass-functiondefinition-runas-uid): Integer
```

## Properties
<a name="aws-properties-greengrass-functiondefinition-runas-properties"></a>

`Gid`  <a name="cfn-greengrass-functiondefinition-runas-gid"></a>
The group ID whose permissions are used to run the Lambda function. You can use the **getent group** command on your core device to look up the group ID.  
*Required*: No  
*Type*: Integer  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Uid`  <a name="cfn-greengrass-functiondefinition-runas-uid"></a>
The user ID whose permissions are used to run the Lambda function. You can use the **getent passwd** command on your core device to look up the user ID.  
*Required*: No  
*Type*: Integer  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

## See also
<a name="aws-properties-greengrass-functiondefinition-runas--seealso"></a>
+ [FunctionRunAsConfig](https://docs.aws.amazon.com/greengrass/v1/apireference/definitions-functionrunasconfig.html) in the * AWS IoT Greengrass Version 1 API Reference *
+  [AWS IoT Greengrass Version 1 Developer Guide](https://docs.aws.amazon.com/greengrass/v1/developerguide/) 