# EnvironmentProperty

The environment configuration for a Lambda function on the AWS IoT Greengrass core.

In an CloudFormation template, `Environment` is a property of the [`FunctionConfiguration`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-greengrass-functiondefinitionversion-functionconfiguration.html) property type.

- Source: Generated at build time
- Type last changed: v2.93.0 · 23 Aug 2023

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_greengrass as greengrass } from 'aws-cdk-lib';

declare const variables: any;
const environmentProperty: greengrass.CfnFunctionDefinitionVersion.EnvironmentProperty = {
  accessSysfs: false,
  execution: {
    isolationMode: 'isolationMode',
    runAs: {
      gid: 123,
      uid: 123,
    },
  },
  resourceAccessPolicies: [{
    resourceId: 'resourceId',

    // the properties below are optional
    permission: 'permission',
  }],
  variables: variables,
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_greengrass as greengrass

# variables: Any

environment_property = greengrass.CfnFunctionDefinitionVersion.EnvironmentProperty(
    access_sysfs=False,
    execution=greengrass.CfnFunctionDefinitionVersion.ExecutionProperty(
        isolation_mode="isolationMode",
        run_as=greengrass.CfnFunctionDefinitionVersion.RunAsProperty(
            gid=123,
            uid=123
        )
    ),
    resource_access_policies=[greengrass.CfnFunctionDefinitionVersion.ResourceAccessPolicyProperty(
        resource_id="resourceId",

        # the properties below are optional
        permission="permission"
    )],
    variables=variables
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.greengrass.*;

Object variables;

EnvironmentProperty environmentProperty = EnvironmentProperty.builder()
        .accessSysfs(false)
        .execution(ExecutionProperty.builder()
                .isolationMode("isolationMode")
                .runAs(RunAsProperty.builder()
                        .gid(123)
                        .uid(123)
                        .build())
                .build())
        .resourceAccessPolicies(List.of(ResourceAccessPolicyProperty.builder()
                .resourceId("resourceId")

                // the properties below are optional
                .permission("permission")
                .build()))
        .variables(variables)
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Greengrass;

var variables;

var environmentProperty = new EnvironmentProperty {
    AccessSysfs = false,
    Execution = new ExecutionProperty {
        IsolationMode = "isolationMode",
        RunAs = new RunAsProperty {
            Gid = 123,
            Uid = 123
        }
    },
    ResourceAccessPolicies = new [] { new ResourceAccessPolicyProperty {
        ResourceId = "resourceId",

        // the properties below are optional
        Permission = "permission"
    } },
    Variables = variables
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var variables interface{}

environmentProperty := &EnvironmentProperty{
	AccessSysfs: jsii.Boolean(false),
	Execution: &ExecutionProperty{
		IsolationMode: jsii.String("isolationMode"),
		RunAs: &RunAsProperty{
			Gid: jsii.Number(123),
			Uid: jsii.Number(123),
		},
	},
	ResourceAccessPolicies: []interface{}{
		&ResourceAccessPolicyProperty{
			ResourceId: jsii.String("resourceId"),

			// the properties below are optional
			Permission: jsii.String("permission"),
		},
	},
	Variables: variables,
}
```

## Properties

- `accessSysfs`: boolean | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) — 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.

- `execution`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnFunctionDefinitionVersion.ExecutionProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_greengrass.CfnFunctionDefinitionVersion.ExecutionProperty.html) — Settings for the Lambda execution environment in AWS IoT Greengrass .

- `resourceAccessPolicies`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnFunctionDefinitionVersion.ResourceAccessPolicyProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_greengrass.CfnFunctionDefinitionVersion.ResourceAccessPolicyProperty.html)[] — 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 to Lambda functions that run in a Greengrass container.

- `variables`: any — Environment variables for the Lambda function.
