CloudFront / Client / create_key_group

create_key_group#

CloudFront.Client.create_key_group(**kwargs)#

Creates a key group that you can use with CloudFront signed URLs and signed cookies.

To create a key group, you must specify at least one public key for the key group. After you create a key group, you can reference it from one or more cache behaviors. When you reference a key group in a cache behavior, CloudFront requires signed URLs or signed cookies for all requests that match the cache behavior. The URLs or cookies must be signed with a private key whose corresponding public key is in the key group. The signed URL or cookie contains information about which public key CloudFront should use to verify the signature. For more information, see Serving private content in the Amazon CloudFront Developer Guide.

See also: AWS API Documentation

Request Syntax

response = client.create_key_group(
    KeyGroupConfig={
        'Name': 'string',
        'Items': [
            'string',
        ],
        'Comment': 'string'
    }
)
Parameters:

KeyGroupConfig (dict) –

[REQUIRED]

A key group configuration.

  • Name (string) – [REQUIRED]

    A name to identify the key group.

  • Items (list) – [REQUIRED]

    A list of the identifiers of the public keys in the key group.

    • (string) –

  • Comment (string) –

    A comment to describe the key group. The comment cannot be longer than 128 characters.

Return type:

dict

Returns:

Response Syntax

{
    'KeyGroup': {
        'Id': 'string',
        'LastModifiedTime': datetime(2015, 1, 1),
        'KeyGroupConfig': {
            'Name': 'string',
            'Items': [
                'string',
            ],
            'Comment': 'string'
        }
    },
    'Location': 'string',
    'ETag': 'string'
}

Response Structure

  • (dict) –

    • KeyGroup (dict) –

      The key group that was just created.

      • Id (string) –

        The identifier for the key group.

      • LastModifiedTime (datetime) –

        The date and time when the key group was last modified.

      • KeyGroupConfig (dict) –

        The key group configuration.

        • Name (string) –

          A name to identify the key group.

        • Items (list) –

          A list of the identifiers of the public keys in the key group.

          • (string) –

        • Comment (string) –

          A comment to describe the key group. The comment cannot be longer than 128 characters.

    • Location (string) –

      The URL of the key group.

    • ETag (string) –

      The identifier for this version of the key group.

Exceptions

  • CloudFront.Client.exceptions.TooManyPublicKeysInKeyGroup

  • CloudFront.Client.exceptions.TooManyKeyGroups

  • CloudFront.Client.exceptions.InvalidArgument

  • CloudFront.Client.exceptions.KeyGroupAlreadyExists