We recommend new projects start with resources from the AWS provider.
aws-native.cloudfront.Function
Explore with Pulumi AI
We recommend new projects start with resources from the AWS provider.
Creates a CF function.
To create a function, you provide the function code and some configuration information about the function. The response contains an Amazon Resource Name (ARN) that uniquely identifies the function, and the function’s stage.
By default, when you create a function, it’s in the DEVELOPMENT stage. In this stage, you can test the function in the CF console (or with TestFunction in the CF API).
When you’re ready to use your function with a CF distribution, publish the function to the LIVE stage. You can do this in the CF console, with PublishFunction in the CF API, or by updating the AWS::CloudFront::Function resource with the AutoPublish property set to true. When the function is published to the LIVE stage, you can attach it to a distribution’s cache behavior, using the function’s ARN.
To automatically publish the function to the LIVE stage when it’s created, set the AutoPublish property to true.
Create Function Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Function(name: string, args: FunctionArgs, opts?: CustomResourceOptions);@overload
def Function(resource_name: str,
             args: FunctionArgs,
             opts: Optional[ResourceOptions] = None)
@overload
def Function(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             function_code: Optional[str] = None,
             function_config: Optional[FunctionConfigArgs] = None,
             auto_publish: Optional[bool] = None,
             function_metadata: Optional[FunctionMetadataArgs] = None,
             name: Optional[str] = None)func NewFunction(ctx *Context, name string, args FunctionArgs, opts ...ResourceOption) (*Function, error)public Function(string name, FunctionArgs args, CustomResourceOptions? opts = null)
public Function(String name, FunctionArgs args)
public Function(String name, FunctionArgs args, CustomResourceOptions options)
type: aws-native:cloudfront:Function
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args FunctionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args FunctionArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args FunctionArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args FunctionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args FunctionArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Function Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Function resource accepts the following input properties:
- FunctionCode string
- The function code. For more information about writing a CloudFront function, see Writing function code for CloudFront Functions in the Amazon CloudFront Developer Guide.
- FunctionConfig Pulumi.Aws Native. Cloud Front. Inputs. Function Config 
- Contains configuration information about a CloudFront function.
- AutoPublish bool
- A flag that determines whether to automatically publish the function to the LIVEstage when it’s created. To automatically publish to theLIVEstage, set this property totrue.
- FunctionMetadata Pulumi.Aws Native. Cloud Front. Inputs. Function Metadata 
- Contains metadata about a CloudFront function.
- Name string
- A name to identify the function.
- FunctionCode string
- The function code. For more information about writing a CloudFront function, see Writing function code for CloudFront Functions in the Amazon CloudFront Developer Guide.
- FunctionConfig FunctionConfig Args 
- Contains configuration information about a CloudFront function.
- AutoPublish bool
- A flag that determines whether to automatically publish the function to the LIVEstage when it’s created. To automatically publish to theLIVEstage, set this property totrue.
- FunctionMetadata FunctionMetadata Args 
- Contains metadata about a CloudFront function.
- Name string
- A name to identify the function.
- functionCode String
- The function code. For more information about writing a CloudFront function, see Writing function code for CloudFront Functions in the Amazon CloudFront Developer Guide.
- functionConfig FunctionConfig 
- Contains configuration information about a CloudFront function.
- autoPublish Boolean
- A flag that determines whether to automatically publish the function to the LIVEstage when it’s created. To automatically publish to theLIVEstage, set this property totrue.
- functionMetadata FunctionMetadata 
- Contains metadata about a CloudFront function.
- name String
- A name to identify the function.
- functionCode string
- The function code. For more information about writing a CloudFront function, see Writing function code for CloudFront Functions in the Amazon CloudFront Developer Guide.
- functionConfig FunctionConfig 
- Contains configuration information about a CloudFront function.
- autoPublish boolean
- A flag that determines whether to automatically publish the function to the LIVEstage when it’s created. To automatically publish to theLIVEstage, set this property totrue.
- functionMetadata FunctionMetadata 
- Contains metadata about a CloudFront function.
- name string
- A name to identify the function.
- function_code str
- The function code. For more information about writing a CloudFront function, see Writing function code for CloudFront Functions in the Amazon CloudFront Developer Guide.
- function_config FunctionConfig Args 
- Contains configuration information about a CloudFront function.
- auto_publish bool
- A flag that determines whether to automatically publish the function to the LIVEstage when it’s created. To automatically publish to theLIVEstage, set this property totrue.
- function_metadata FunctionMetadata Args 
- Contains metadata about a CloudFront function.
- name str
- A name to identify the function.
- functionCode String
- The function code. For more information about writing a CloudFront function, see Writing function code for CloudFront Functions in the Amazon CloudFront Developer Guide.
- functionConfig Property Map
- Contains configuration information about a CloudFront function.
- autoPublish Boolean
- A flag that determines whether to automatically publish the function to the LIVEstage when it’s created. To automatically publish to theLIVEstage, set this property totrue.
- functionMetadata Property Map
- Contains metadata about a CloudFront function.
- name String
- A name to identify the function.
Outputs
All input properties are implicitly available as output properties. Additionally, the Function resource produces the following output properties:
- FunctionArn string
- The ARN of the function. For example: - arn:aws:cloudfront::123456789012:function/ExampleFunction.- To get the function ARN, use the following syntax: - !GetAtt *Function_Logical_ID* .FunctionMetadata.FunctionARN
- Id string
- The provider-assigned unique ID for this managed resource.
- Stage string
- FunctionArn string
- The ARN of the function. For example: - arn:aws:cloudfront::123456789012:function/ExampleFunction.- To get the function ARN, use the following syntax: - !GetAtt *Function_Logical_ID* .FunctionMetadata.FunctionARN
- Id string
- The provider-assigned unique ID for this managed resource.
- Stage string
- functionArn String
- The ARN of the function. For example: - arn:aws:cloudfront::123456789012:function/ExampleFunction.- To get the function ARN, use the following syntax: - !GetAtt *Function_Logical_ID* .FunctionMetadata.FunctionARN
- id String
- The provider-assigned unique ID for this managed resource.
- stage String
- functionArn string
- The ARN of the function. For example: - arn:aws:cloudfront::123456789012:function/ExampleFunction.- To get the function ARN, use the following syntax: - !GetAtt *Function_Logical_ID* .FunctionMetadata.FunctionARN
- id string
- The provider-assigned unique ID for this managed resource.
- stage string
- function_arn str
- The ARN of the function. For example: - arn:aws:cloudfront::123456789012:function/ExampleFunction.- To get the function ARN, use the following syntax: - !GetAtt *Function_Logical_ID* .FunctionMetadata.FunctionARN
- id str
- The provider-assigned unique ID for this managed resource.
- stage str
- functionArn String
- The ARN of the function. For example: - arn:aws:cloudfront::123456789012:function/ExampleFunction.- To get the function ARN, use the following syntax: - !GetAtt *Function_Logical_ID* .FunctionMetadata.FunctionARN
- id String
- The provider-assigned unique ID for this managed resource.
- stage String
Supporting Types
FunctionConfig, FunctionConfigArgs    
- Comment string
- A comment to describe the function.
- Runtime string
- The function's runtime environment version.
- KeyValue List<Pulumi.Store Associations Aws Native. Cloud Front. Inputs. Function Key Value Store Association> 
- The configuration for the key value store associations.
- Comment string
- A comment to describe the function.
- Runtime string
- The function's runtime environment version.
- KeyValue []FunctionStore Associations Key Value Store Association 
- The configuration for the key value store associations.
- comment String
- A comment to describe the function.
- runtime String
- The function's runtime environment version.
- keyValue List<FunctionStore Associations Key Value Store Association> 
- The configuration for the key value store associations.
- comment string
- A comment to describe the function.
- runtime string
- The function's runtime environment version.
- keyValue FunctionStore Associations Key Value Store Association[] 
- The configuration for the key value store associations.
- comment str
- A comment to describe the function.
- runtime str
- The function's runtime environment version.
- key_value_ Sequence[Functionstore_ associations Key Value Store Association] 
- The configuration for the key value store associations.
- comment String
- A comment to describe the function.
- runtime String
- The function's runtime environment version.
- keyValue List<Property Map>Store Associations 
- The configuration for the key value store associations.
FunctionKeyValueStoreAssociation, FunctionKeyValueStoreAssociationArgs          
- KeyValue stringStore Arn 
- The Amazon Resource Name (ARN) of the key value store association.
- KeyValue stringStore Arn 
- The Amazon Resource Name (ARN) of the key value store association.
- keyValue StringStore Arn 
- The Amazon Resource Name (ARN) of the key value store association.
- keyValue stringStore Arn 
- The Amazon Resource Name (ARN) of the key value store association.
- key_value_ strstore_ arn 
- The Amazon Resource Name (ARN) of the key value store association.
- keyValue StringStore Arn 
- The Amazon Resource Name (ARN) of the key value store association.
FunctionMetadata, FunctionMetadataArgs    
- FunctionArn string
- The Amazon Resource Name (ARN) of the function. The ARN uniquely identifies the function.
- FunctionArn string
- The Amazon Resource Name (ARN) of the function. The ARN uniquely identifies the function.
- functionArn String
- The Amazon Resource Name (ARN) of the function. The ARN uniquely identifies the function.
- functionArn string
- The Amazon Resource Name (ARN) of the function. The ARN uniquely identifies the function.
- function_arn str
- The Amazon Resource Name (ARN) of the function. The ARN uniquely identifies the function.
- functionArn String
- The Amazon Resource Name (ARN) of the function. The ARN uniquely identifies the function.
Package Details
- Repository
- AWS Native pulumi/pulumi-aws-native
- License
- Apache-2.0
We recommend new projects start with resources from the AWS provider.