Skip to main content

origin_request_policies

Creates, updates, deletes or gets an origin_request_policy resource or lists origin_request_policies in a region

Overview

Nameorigin_request_policies
TypeResource
DescriptionAn 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.
Idaws.cloudfront.origin_request_policies

Fields

NameDatatypeDescription
idstring
last_modified_timestring
origin_request_policy_configobjectThe origin request policy configuration.
regionstringAWS region.

For more information, see AWS::CloudFront::OriginRequestPolicy.

Methods

NameAccessible byRequired Params
create_resourceINSERTOriginRequestPolicyConfig, region
delete_resourceDELETEdata__Identifier, region
update_resourceUPDATEdata__Identifier, data__PatchDocument, region
list_resourcesSELECTregion
get_resourceSELECTdata__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.

/*+ create */
INSERT INTO aws.cloudfront.origin_request_policies (
OriginRequestPolicyConfig,
region
)
SELECT
'{{ OriginRequestPolicyConfig }}',
'{{ region }}';

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