response_headers_policies
Creates, updates, deletes, gets or lists a response_headers_policies resource.
Overview
| Name | response_headers_policies |
| Type | Resource |
| Id | aws.cloudfront.response_headers_policies |
Fields
The following fields are returned by SELECT queries:
- get_response_headers_policy
- list_response_headers_policies
| Name | Datatype | Description |
|---|---|---|
id | string | The identifier for the response headers policy. |
last_modified_time | string | The date and time when the response headers policy was last modified. |
response_headers_policy_config | string | A response headers policy configuration. |
| Name | Datatype | Description |
|---|---|---|
items | string | The response headers policies in the list. |
max_items | integer | The maximum number of response headers policies 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 response headers policies where you left off. |
quantity | integer | The number of response headers policies returned. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_response_headers_policy | select | id, region | Gets a response headers policy, including metadata (the policy's identifier and the date and time when the policy was last modified). To get a response headers policy, you must provide the policy's identifier. If the response headers policy is attached to a distribution's cache behavior, you can get the policy's identifier using ListDistributions or GetDistribution. If the response headers policy is not attached to a cache behavior, you can get the identifier using ListResponseHeadersPolicies. | |
list_response_headers_policies | select | region | Type, Marker, MaxItems | Gets a list of response headers policies. You can optionally apply a filter to get only the managed policies created by Amazon Web Services, or only the custom policies created in your Amazon Web Services account. 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_response_headers_policy | insert | region, ResponseHeadersPolicyConfig | Creates a response headers policy. A response headers policy contains information about a set of HTTP headers. To create a response headers policy, you provide some metadata about the policy and a set of configurations that specify the headers. After you create a response headers policy, you can use its ID to attach it to one or more cache behaviors in a CloudFront distribution. When it's attached to a cache behavior, the response headers policy affects the HTTP headers that CloudFront includes in HTTP responses to requests that match the cache behavior. CloudFront adds or removes response headers according to the configuration of the response headers policy. For more information, see Adding or removing HTTP headers in CloudFront responses in the Amazon CloudFront Developer Guide. | |
update_response_headers_policy | update | id, region, ResponseHeadersPolicyConfig | If-Match | Updates a response headers policy. When you update a response headers policy, the entire policy is replaced. You cannot update some policy fields independent of others. To update a response headers policy configuration: Use GetResponseHeadersPolicyConfig to get the current policy's configuration. Modify the fields in the response headers policy configuration that you want to update. Call UpdateResponseHeadersPolicy, providing the entire response headers policy configuration, including the fields that you modified and those that you didn't. |
delete_response_headers_policy | delete | id, region | If-Match | Deletes a response headers policy. You cannot delete a response headers policy if it's attached to a cache behavior. First update your distributions to remove the response headers policy from all cache behaviors, then delete the response headers policy. To delete a response headers policy, you must provide the policy's identifier and version. To get these values, you can use ListResponseHeadersPolicies or GetResponseHeadersPolicy. |
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 for the response headers policy that you are deleting. To get the identifier, you can use ListResponseHeadersPolicies. |
region | string | AWS region (default: us-east-1) |
If-Match | string | The version of the response headers policy that you are deleting. The version is the response headers policy's ETag value, which you can get using ListResponseHeadersPolicies, GetResponseHeadersPolicy, or GetResponseHeadersPolicyConfig. |
Marker | string | Use this field when paginating results to indicate where to begin in your list of response headers policies. The response includes response headers policies 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 response headers policies that you want to get in the response. |
Type | string | A filter to get only the specified kind of response headers policies. Valid values are: managed – Gets only the managed policies created by Amazon Web Services. custom – Gets only the custom policies created in your Amazon Web Services account. |
SELECT examples
- get_response_headers_policy
- list_response_headers_policies
Gets a response headers policy, including metadata (the policy's identifier and the date and time when the policy was last modified). To get a response headers policy, you must provide the policy's identifier. If the response headers policy is attached to a distribution's cache behavior, you can get the policy's identifier using ListDistributions or GetDistribution. If the response headers policy is not attached to a cache behavior, you can get the identifier using ListResponseHeadersPolicies.
SELECT
id,
last_modified_time,
response_headers_policy_config
FROM aws.cloudfront.response_headers_policies
WHERE id = '{{ id }}' -- required
AND region = '{{ region }}' -- required
;
Gets a list of response headers policies. You can optionally apply a filter to get only the managed policies created by Amazon Web Services, or only the custom policies created in your Amazon Web Services account. 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.response_headers_policies
WHERE region = '{{ region }}' -- required
AND Type = '{{ Type }}'
AND Marker = '{{ Marker }}'
AND MaxItems = '{{ MaxItems }}'
;
INSERT examples
- create_response_headers_policy
- Manifest
Creates a response headers policy. A response headers policy contains information about a set of HTTP headers. To create a response headers policy, you provide some metadata about the policy and a set of configurations that specify the headers. After you create a response headers policy, you can use its ID to attach it to one or more cache behaviors in a CloudFront distribution. When it's attached to a cache behavior, the response headers policy affects the HTTP headers that CloudFront includes in HTTP responses to requests that match the cache behavior. CloudFront adds or removes response headers according to the configuration of the response headers policy. For more information, see Adding or removing HTTP headers in CloudFront responses in the Amazon CloudFront Developer Guide.
INSERT INTO aws.cloudfront.response_headers_policies (
ResponseHeadersPolicyConfig,
region
)
SELECT
'{{ ResponseHeadersPolicyConfig }}' /* required */,
'{{ region }}'
RETURNING
id,
last_modified_time,
response_headers_policy_config
;
# Description fields are for documentation purposes
- name: response_headers_policies
props:
- name: region
value: "{{ region }}"
description: Required parameter for the response_headers_policies resource.
- name: ResponseHeadersPolicyConfig
description: |
A response headers policy configuration. A response headers policy configuration contains metadata about the response headers policy, and configurations for sets of HTTP response headers.
value:
Comment: "{{ Comment }}"
Name: "{{ Name }}"
CorsConfig:
AccessControlAllowOrigins:
Quantity: {{ Quantity }}
Items:
- "{{ Items }}"
AccessControlAllowHeaders:
Quantity: {{ Quantity }}
Items:
- "{{ Items }}"
AccessControlAllowMethods:
Quantity: {{ Quantity }}
Items:
- "{{ Items }}"
AccessControlAllowCredentials: {{ AccessControlAllowCredentials }}
AccessControlExposeHeaders:
Quantity: {{ Quantity }}
Items:
- "{{ Items }}"
AccessControlMaxAgeSec: {{ AccessControlMaxAgeSec }}
OriginOverride: {{ OriginOverride }}
SecurityHeadersConfig:
XSSProtection:
Override: {{ Override }}
Protection: {{ Protection }}
ModeBlock: {{ ModeBlock }}
ReportUri: "{{ ReportUri }}"
FrameOptions:
Override: {{ Override }}
FrameOption: "{{ FrameOption }}"
ReferrerPolicy:
Override: {{ Override }}
ReferrerPolicy: "{{ ReferrerPolicy }}"
ContentSecurityPolicy:
Override: {{ Override }}
ContentSecurityPolicy: "{{ ContentSecurityPolicy }}"
ContentTypeOptions:
Override: {{ Override }}
StrictTransportSecurity:
Override: {{ Override }}
IncludeSubdomains: {{ IncludeSubdomains }}
Preload: {{ Preload }}
AccessControlMaxAgeSec: {{ AccessControlMaxAgeSec }}
ServerTimingHeadersConfig:
Enabled: {{ Enabled }}
SamplingRate: {{ SamplingRate }}
CustomHeadersConfig:
Quantity: {{ Quantity }}
Items:
- Header: "{{ Header }}"
Value: "{{ Value }}"
Override: {{ Override }}
RemoveHeadersConfig:
Quantity: {{ Quantity }}
Items:
- Header: "{{ Header }}"
UPDATE examples
- update_response_headers_policy
Updates a response headers policy. When you update a response headers policy, the entire policy is replaced. You cannot update some policy fields independent of others. To update a response headers policy configuration: Use GetResponseHeadersPolicyConfig to get the current policy's configuration. Modify the fields in the response headers policy configuration that you want to update. Call UpdateResponseHeadersPolicy, providing the entire response headers policy configuration, including the fields that you modified and those that you didn't.
UPDATE aws.cloudfront.response_headers_policies
SET
ResponseHeadersPolicyConfig = '{{ ResponseHeadersPolicyConfig }}'
WHERE
id = '{{ id }}' --required
AND region = '{{ region }}' --required
AND ResponseHeadersPolicyConfig = '{{ ResponseHeadersPolicyConfig }}' --required
AND `If-Match` = '{{ If-Match}}'
RETURNING
id,
last_modified_time,
response_headers_policy_config;
DELETE examples
- delete_response_headers_policy
Deletes a response headers policy. You cannot delete a response headers policy if it's attached to a cache behavior. First update your distributions to remove the response headers policy from all cache behaviors, then delete the response headers policy. To delete a response headers policy, you must provide the policy's identifier and version. To get these values, you can use ListResponseHeadersPolicies or GetResponseHeadersPolicy.
DELETE FROM aws.cloudfront.response_headers_policies
WHERE id = '{{ id }}' --required
AND region = '{{ region }}' --required
AND `If-Match` = '{{ If-Match }}'
;