key_groups
Creates, updates, deletes, gets or lists a key_groups resource.
Overview
| Name | key_groups |
| Type | Resource |
| Id | aws.cloudfront.key_groups |
Fields
The following fields are returned by SELECT queries:
- get_key_group
- list_key_groups
| Name | Datatype | Description |
|---|---|---|
id | string | The identifier for the key group. |
key_group_config | string | The key group configuration. |
last_modified_time | string | The date and time when the key group was last modified. |
| Name | Datatype | Description |
|---|---|---|
items | string | A list of key groups. |
max_items | integer | The maximum number of key groups requested. |
next_marker | string | If there are more items in the list than are in this response, this element is present. It contains the value that you should use in the Marker field of a subsequent request to continue listing key groups. |
quantity | integer | The number of key groups returned in the response. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_key_group | select | id, region | Gets a key group, including the date and time when the key group was last modified. To get a key group, you must provide the key group's identifier. If the key group is referenced in a distribution's cache behavior, you can get the key group's identifier using ListDistributions or GetDistribution. If the key group is not referenced in a cache behavior, you can get the identifier using ListKeyGroups. | |
list_key_groups | select | region | Marker, MaxItems | Gets a list of key groups. You can optionally specify the maximum number of items to receive in the response. If the total number of items in the list exceeds the maximum that you specify, or the default maximum, the response is paginated. To get the next page of items, send a subsequent request that specifies the NextMarker value from the current response as the Marker value in the subsequent request. |
create_key_group | insert | region, KeyGroupConfig | 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. | |
update_key_group | update | id, region, KeyGroupConfig | If-Match | Updates a key group. When you update a key group, all the fields are updated with the values provided in the request. You cannot update some fields independent of others. To update a key group: Get the current key group with GetKeyGroup or GetKeyGroupConfig. Locally modify the fields in the key group that you want to update. For example, add or remove public key IDs. Call UpdateKeyGroup with the entire key group object, including the fields that you modified and those that you didn't. |
delete_key_group | delete | id, region | If-Match | Deletes a key group. You cannot delete a key group that is referenced in a cache behavior. First update your distributions to remove the key group from all cache behaviors, then delete the key group. To delete a key group, you must provide the key group's identifier and version. To get these values, use ListKeyGroups followed by GetKeyGroup or GetKeyGroupConfig. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
id | string | The identifier of the key group that you are deleting. To get the identifier, use ListKeyGroups. |
region | string | AWS region (default: us-east-1) |
If-Match | string | The version of the key group that you are deleting. The version is the key group's ETag value. To get the ETag, use GetKeyGroup or GetKeyGroupConfig. |
Marker | string | Use this field when paginating results to indicate where to begin in your list of key groups. The response includes key groups in the list that occur after the marker. To get the next page of the list, set this field's value to the value of NextMarker from the current page's response. |
MaxItems | string | The maximum number of key groups that you want in the response. |
SELECT examples
- get_key_group
- list_key_groups
Gets a key group, including the date and time when the key group was last modified. To get a key group, you must provide the key group's identifier. If the key group is referenced in a distribution's cache behavior, you can get the key group's identifier using ListDistributions or GetDistribution. If the key group is not referenced in a cache behavior, you can get the identifier using ListKeyGroups.
SELECT
id,
key_group_config,
last_modified_time
FROM aws.cloudfront.key_groups
WHERE id = '{{ id }}' -- required
AND region = '{{ region }}' -- required
;
Gets a list of key groups. You can optionally specify the maximum number of items to receive in the response. If the total number of items in the list exceeds the maximum that you specify, or the default maximum, the response is paginated. To get the next page of items, send a subsequent request that specifies the NextMarker value from the current response as the Marker value in the subsequent request.
SELECT
items,
max_items,
next_marker,
quantity
FROM aws.cloudfront.key_groups
WHERE region = '{{ region }}' -- required
AND Marker = '{{ Marker }}'
AND MaxItems = '{{ MaxItems }}'
;
INSERT examples
- create_key_group
- Manifest
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.
INSERT INTO aws.cloudfront.key_groups (
KeyGroupConfig,
region
)
SELECT
'{{ KeyGroupConfig }}' /* required */,
'{{ region }}'
RETURNING
id,
key_group_config,
last_modified_time
;
# Description fields are for documentation purposes
- name: key_groups
props:
- name: region
value: "{{ region }}"
description: Required parameter for the key_groups resource.
- name: KeyGroupConfig
description: |
A key group configuration. A key group contains a list of public keys that you can use with CloudFront signed URLs and signed cookies.
value:
Name: "{{ Name }}"
Items:
- "{{ Items }}"
Comment: "{{ Comment }}"
UPDATE examples
- update_key_group
Updates a key group. When you update a key group, all the fields are updated with the values provided in the request. You cannot update some fields independent of others. To update a key group: Get the current key group with GetKeyGroup or GetKeyGroupConfig. Locally modify the fields in the key group that you want to update. For example, add or remove public key IDs. Call UpdateKeyGroup with the entire key group object, including the fields that you modified and those that you didn't.
UPDATE aws.cloudfront.key_groups
SET
KeyGroupConfig = '{{ KeyGroupConfig }}'
WHERE
id = '{{ id }}' --required
AND region = '{{ region }}' --required
AND KeyGroupConfig = '{{ KeyGroupConfig }}' --required
AND `If-Match` = '{{ If-Match}}'
RETURNING
id,
key_group_config,
last_modified_time;
DELETE examples
- delete_key_group
Deletes a key group. You cannot delete a key group that is referenced in a cache behavior. First update your distributions to remove the key group from all cache behaviors, then delete the key group. To delete a key group, you must provide the key group's identifier and version. To get these values, use ListKeyGroups followed by GetKeyGroup or GetKeyGroupConfig.
DELETE FROM aws.cloudfront.key_groups
WHERE id = '{{ id }}' --required
AND region = '{{ region }}' --required
AND `If-Match` = '{{ If-Match }}'
;