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 | aws.cloudfront.origin_request_policies |
Fields
Name | Datatype | Description |
---|---|---|
id | string | |
last_modified_time | string | |
origin_request_policy_config | object | The origin request policy configuration. |
region | string | AWS region. |
For more information, see AWS::CloudFront::OriginRequestPolicy
.
Methods
Name | Accessible by | Required Params |
---|---|---|
create_resource | INSERT | OriginRequestPolicyConfig, region |
delete_resource | DELETE | data__Identifier, region |
update_resource | UPDATE | data__Identifier, data__PatchDocument, region |
list_resources | SELECT | region |
get_resource | SELECT | data__Identifier, region |
SELECT
examples
Gets all origin_request_policies
in a region.
SELECT
region,
id,
last_modified_time,
origin_request_policy_config
FROM aws.cloudfront.origin_request_policies
;
Gets all properties from an individual origin_request_policy
.
SELECT
region,
id,
last_modified_time,
origin_request_policy_config
FROM aws.cloudfront.origin_request_policies
WHERE data__Identifier = '<Id>';
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 aws.cloudfront.origin_request_policies (
OriginRequestPolicyConfig,
region
)
SELECT
'{{ OriginRequestPolicyConfig }}',
'{{ region }}';
/*+ create */
INSERT INTO aws.cloudfront.origin_request_policies (
OriginRequestPolicyConfig,
region
)
SELECT
'{{ OriginRequestPolicyConfig }}',
'{{ 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: OriginRequestPolicyConfig
value:
Comment: '{{ Comment }}'
CookiesConfig:
CookieBehavior: '{{ CookieBehavior }}'
Cookies:
- '{{ Cookies[0] }}'
HeadersConfig:
HeaderBehavior: '{{ HeaderBehavior }}'
Headers:
- '{{ Headers[0] }}'
Name: '{{ Name }}'
QueryStringsConfig:
QueryStringBehavior: '{{ QueryStringBehavior }}'
QueryStrings:
- '{{ QueryStrings[0] }}'
DELETE
example
/*+ delete */
DELETE FROM aws.cloudfront.origin_request_policies
WHERE data__Identifier = '<Id>'
AND region = 'us-east-1';
Permissions
To operate on the origin_request_policies
resource, the following permissions are required:
Create
cloudfront:CreateOriginRequestPolicy
Delete
cloudfront:DeleteOriginRequestPolicy,
cloudfront:GetOriginRequestPolicy
List
cloudfront:ListOriginRequestPolicies
Read
cloudfront:GetOriginRequestPolicy
Update
cloudfront:UpdateOriginRequestPolicy,
cloudfront:GetOriginRequestPolicy