origin_request_policies
Creates, updates, deletes or gets an origin_request_policy resource or lists origin_request_policies in a region
Overview
| Name | origin_request_policies |
| Type | Resource |
| Description | An origin request policy. When it's attached to a cache behavior, the origin request policy determines the values that CloudFront includes in requests that it sends to the origin. Each request that CloudFront sends to the origin includes the following: + The request body and the URL path (without the domain name) from the viewer request. + The headers that CloudFront automatically includes in every origin request, including ``Host``, ``User-Agent``, and ``X-Amz-Cf-Id``. + All HTTP headers, cookies, and URL query strings that are specified in the cache policy or the origin request policy. These can include items from the viewer request and, in the case of headers, additional ones that are added by CloudFront. CloudFront sends a request when it can't find an object in its cache that matches the request. If you want to send values to the origin and also include them in the cache key, use ``CachePolicy``. |
| Id | awscc.cloudfront.origin_request_policies |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
id | string | |
last_modified_time | string | |
origin_request_policy_config | object | The origin request policy configuration. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
id | string | |
region | string | AWS region. |
For more information, see AWS::CloudFront::OriginRequestPolicy.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | origin_request_policies | INSERT | OriginRequestPolicyConfig, region |
delete_resource | origin_request_policies | DELETE | Identifier, region |
update_resource | origin_request_policies | UPDATE | Identifier, PatchDocument, region |
list_resources | origin_request_policies_list_only | SELECT | region |
get_resource | origin_request_policies | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual origin_request_policy.
SELECT
region,
id,
last_modified_time,
origin_request_policy_config
FROM awscc.cloudfront.origin_request_policies
WHERE
region = 'us-east-1' AND
Identifier = '{{ id }}';
Lists all origin_request_policies in a region.
SELECT
region,
id
FROM awscc.cloudfront.origin_request_policies_list_only
WHERE
region = 'us-east-1';
INSERT example
Use the following StackQL query and manifest file to create a new origin_request_policy resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.cloudfront.origin_request_policies (
OriginRequestPolicyConfig,
region
)
SELECT
'{{ origin_request_policy_config }}',
'{{ region }}';
/*+ create */
INSERT INTO awscc.cloudfront.origin_request_policies (
OriginRequestPolicyConfig,
region
)
SELECT
'{{ origin_request_policy_config }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: origin_request_policy
props:
- name: origin_request_policy_config
value:
comment: '{{ comment }}'
cookies_config:
cookie_behavior: '{{ cookie_behavior }}'
cookies:
- '{{ cookies[0] }}'
headers_config:
header_behavior: '{{ header_behavior }}'
headers:
- '{{ headers[0] }}'
name: '{{ name }}'
query_strings_config:
query_string_behavior: '{{ query_string_behavior }}'
query_strings:
- '{{ query_strings[0] }}'
UPDATE example
Use the following StackQL query and manifest file to update a origin_request_policy resource, using stack-deploy.
/*+ update */
UPDATE awscc.cloudfront.origin_request_policies
SET PatchDocument = string('{{ {
"OriginRequestPolicyConfig": origin_request_policy_config
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ id }}';
DELETE example
/*+ delete */
DELETE FROM awscc.cloudfront.origin_request_policies
WHERE
Identifier = '{{ id }}' AND
region = 'us-east-1';
Permissions
To operate on the origin_request_policies resource, the following permissions are required:
- Create
- Delete
- List
- Read
- Update
cloudfront:CreateOriginRequestPolicy
cloudfront:DeleteOriginRequestPolicy,
cloudfront:GetOriginRequestPolicy
cloudfront:ListOriginRequestPolicies
cloudfront:GetOriginRequestPolicy
cloudfront:UpdateOriginRequestPolicy,
cloudfront:GetOriginRequestPolicy