# CfnFunctionProps

Properties for defining a `CfnFunction`.

Extends: CfnFunctionProps
Used as props by: CfnFunction

- Source: Generated code
- Type last changed: v2.251.0 · 24 Apr 2026

## Example

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_cloudfront as cloudfront } from 'aws-cdk-lib';
const cfnFunctionProps: cloudfront.CfnFunctionProps = {
  functionCode: 'functionCode',
  functionConfig: {
    comment: 'comment',
    runtime: 'runtime',

    // the properties below are optional
    keyValueStoreAssociations: [{
      keyValueStoreArn: 'keyValueStoreArn',
    }],
  },
  name: 'name',

  // the properties below are optional
  autoPublish: false,
  functionMetadata: {
    functionArn: 'functionArn',
  },
  tags: [{
    key: 'key',
    value: 'value',
  }],
};
```

## Properties

- `autoPublish`: boolean | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) — A flag that determines whether to automatically publish the function to the `LIVE` stage when it’s created.

  To automatically publish to the `LIVE` stage, set this property to `true` .

- `functionCode`: string (required) — The function code.

  For more information about writing a CloudFront function, see [Writing function code for CloudFront Functions](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/writing-function-code.html) in the *Amazon CloudFront Developer Guide* .

- `functionConfig`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnFunction.FunctionConfigProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.CfnFunction.FunctionConfigProperty.html) (required) — Contains configuration information about a CloudFront function.

- `functionMetadata`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnFunction.FunctionMetadataProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.CfnFunction.FunctionMetadataProperty.html) — Contains metadata about a CloudFront function.

- `name`: string (required) — A name to identify the function.

- `tags`: [CfnTag](/cdk/api/v2/docs/aws-cdk-lib.CfnTag.html)[] — A complex type that contains zero or more ``Tag`` elements.
