1. Packages
  2. AWS Cloud Control
  3. API Docs
  4. cloudfront
  5. Function

We recommend new projects start with resources from the AWS provider.

AWS Cloud Control v1.9.0 published on Monday, Nov 18, 2024 by Pulumi

aws-native.cloudfront.Function

Explore with Pulumi AI

aws-native logo

We recommend new projects start with resources from the AWS provider.

AWS Cloud Control v1.9.0 published on Monday, Nov 18, 2024 by Pulumi

    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.AwsNative.CloudFront.Inputs.FunctionConfig
    Contains configuration information about a CloudFront function.
    AutoPublish bool
    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.
    FunctionMetadata Pulumi.AwsNative.CloudFront.Inputs.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 FunctionConfigArgs
    Contains configuration information about a CloudFront function.
    AutoPublish bool
    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.
    FunctionMetadata FunctionMetadataArgs
    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 LIVE stage when it’s created. To automatically publish to the LIVE stage, set this property to true.
    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 LIVE stage when it’s created. To automatically publish to the LIVE stage, set this property to true.
    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 FunctionConfigArgs
    Contains configuration information about a CloudFront function.
    auto_publish bool
    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.
    function_metadata FunctionMetadataArgs
    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 LIVE stage when it’s created. To automatically publish to the LIVE stage, set this property to true.
    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.
    KeyValueStoreAssociations List<Pulumi.AwsNative.CloudFront.Inputs.FunctionKeyValueStoreAssociation>
    The configuration for the key value store associations.
    Comment string
    A comment to describe the function.
    Runtime string
    The function's runtime environment version.
    KeyValueStoreAssociations []FunctionKeyValueStoreAssociation
    The configuration for the key value store associations.
    comment String
    A comment to describe the function.
    runtime String
    The function's runtime environment version.
    keyValueStoreAssociations List<FunctionKeyValueStoreAssociation>
    The configuration for the key value store associations.
    comment string
    A comment to describe the function.
    runtime string
    The function's runtime environment version.
    keyValueStoreAssociations FunctionKeyValueStoreAssociation[]
    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_store_associations Sequence[FunctionKeyValueStoreAssociation]
    The configuration for the key value store associations.
    comment String
    A comment to describe the function.
    runtime String
    The function's runtime environment version.
    keyValueStoreAssociations List<Property Map>
    The configuration for the key value store associations.

    FunctionKeyValueStoreAssociation, FunctionKeyValueStoreAssociationArgs

    KeyValueStoreArn string
    The Amazon Resource Name (ARN) of the key value store association.
    KeyValueStoreArn string
    The Amazon Resource Name (ARN) of the key value store association.
    keyValueStoreArn String
    The Amazon Resource Name (ARN) of the key value store association.
    keyValueStoreArn string
    The Amazon Resource Name (ARN) of the key value store association.
    key_value_store_arn str
    The Amazon Resource Name (ARN) of the key value store association.
    keyValueStoreArn String
    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
    aws-native logo

    We recommend new projects start with resources from the AWS provider.

    AWS Cloud Control v1.9.0 published on Monday, Nov 18, 2024 by Pulumi