:doc:`CloudFront <../../cloudfront>` / Client / create_connection_function

**************************
create_connection_function
**************************



.. py:method:: CloudFront.Client.create_connection_function(**kwargs)

  

  Creates a connection function.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2020-05-31/CreateConnectionFunction>`_  


  **Request Syntax**
  ::

    response = client.create_connection_function(
        Name='string',
        ConnectionFunctionConfig={
            'Comment': 'string',
            'Runtime': 'cloudfront-js-1.0'|'cloudfront-js-2.0',
            'KeyValueStoreAssociations': {
                'Quantity': 123,
                'Items': [
                    {
                        'KeyValueStoreARN': 'string'
                    },
                ]
            }
        },
        ConnectionFunctionCode=b'bytes',
        Tags={
            'Items': [
                {
                    'Key': 'string',
                    'Value': 'string'
                },
            ]
        }
    )
    
  :type Name: string
  :param Name: **[REQUIRED]** 

    A name for the connection function.

    

  
  :type ConnectionFunctionConfig: dict
  :param ConnectionFunctionConfig: **[REQUIRED]** 

    Contains configuration information about a CloudFront function.

    

  
    - **Comment** *(string) --* **[REQUIRED]** 

      A comment to describe the function.

      

    
    - **Runtime** *(string) --* **[REQUIRED]** 

      The function's runtime environment version.

      

    
    - **KeyValueStoreAssociations** *(dict) --* 

      The configuration for the key value store associations.

      

    
      - **Quantity** *(integer) --* **[REQUIRED]** 

        The quantity of key value store associations.

        

      
      - **Items** *(list) --* 

        The items of the key value store association.

        

      
        - *(dict) --* 

          The key value store association.

          

        
          - **KeyValueStoreARN** *(string) --* **[REQUIRED]** 

            The Amazon Resource Name (ARN) of the key value store association.

            

          
        
    
    
  
  :type ConnectionFunctionCode: bytes
  :param ConnectionFunctionCode: **[REQUIRED]** 

    The code for the connection function.

    

  
  :type Tags: dict
  :param Tags: 

    A complex type that contains zero or more ``Tag`` elements.

    

  
    - **Items** *(list) --* 

      A complex type that contains ``Tag`` elements.

      

    
      - *(dict) --* 

        A complex type that contains ``Tag`` key and ``Tag`` value.

        

      
        - **Key** *(string) --* **[REQUIRED]** 

          A string that contains ``Tag`` key.

           

          The string length should be between 1 and 128 characters. Valid characters include ``a-z``, ``A-Z``, ``0-9``, space, and the special characters ``_ - . : / = + @``.

          

        
        - **Value** *(string) --* 

          A string that contains an optional ``Tag`` value.

           

          The string length should be between 0 and 256 characters. Valid characters include ``a-z``, ``A-Z``, ``0-9``, space, and the special characters ``_ - . : / = + @``.

          

        
      
  
  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'ConnectionFunctionSummary': {
              'Name': 'string',
              'Id': 'string',
              'ConnectionFunctionConfig': {
                  'Comment': 'string',
                  'Runtime': 'cloudfront-js-1.0'|'cloudfront-js-2.0',
                  'KeyValueStoreAssociations': {
                      'Quantity': 123,
                      'Items': [
                          {
                              'KeyValueStoreARN': 'string'
                          },
                      ]
                  }
              },
              'ConnectionFunctionArn': 'string',
              'Status': 'string',
              'Stage': 'DEVELOPMENT'|'LIVE',
              'CreatedTime': datetime(2015, 1, 1),
              'LastModifiedTime': datetime(2015, 1, 1)
          },
          'Location': 'string',
          'ETag': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **ConnectionFunctionSummary** *(dict) --* 

        The summary for the connection function.

        
        

        - **Name** *(string) --* 

          The connection function name.

          
        

        - **Id** *(string) --* 

          The connection function ID.

          
        

        - **ConnectionFunctionConfig** *(dict) --* 

          Contains configuration information about a CloudFront function.

          
          

          - **Comment** *(string) --* 

            A comment to describe the function.

            
          

          - **Runtime** *(string) --* 

            The function's runtime environment version.

            
          

          - **KeyValueStoreAssociations** *(dict) --* 

            The configuration for the key value store associations.

            
            

            - **Quantity** *(integer) --* 

              The quantity of key value store associations.

              
            

            - **Items** *(list) --* 

              The items of the key value store association.

              
              

              - *(dict) --* 

                The key value store association.

                
                

                - **KeyValueStoreARN** *(string) --* 

                  The Amazon Resource Name (ARN) of the key value store association.

                  
            
          
        
      
        

        - **ConnectionFunctionArn** *(string) --* 

          The connection function Amazon Resource Name (ARN).

          
        

        - **Status** *(string) --* 

          The connection function status.

          
        

        - **Stage** *(string) --* 

          The connection function stage.

          
        

        - **CreatedTime** *(datetime) --* 

          The connection function created time.

          
        

        - **LastModifiedTime** *(datetime) --* 

          The connection function last modified time.

          
    
      

      - **Location** *(string) --* 

        The location of the connection function.

        
      

      - **ETag** *(string) --* 

        The version identifier for the current version of the connection function.

        
  
  **Exceptions**
  
  *   :py:class:`CloudFront.Client.exceptions.AccessDenied`

  
  *   :py:class:`CloudFront.Client.exceptions.UnsupportedOperation`

  
  *   :py:class:`CloudFront.Client.exceptions.EntityAlreadyExists`

  
  *   :py:class:`CloudFront.Client.exceptions.InvalidTagging`

  
  *   :py:class:`CloudFront.Client.exceptions.EntityLimitExceeded`

  
  *   :py:class:`CloudFront.Client.exceptions.InvalidArgument`

  
  *   :py:class:`CloudFront.Client.exceptions.EntitySizeLimitExceeded`

  