Skip to main content

origin_access_controls

Creates, updates, deletes, gets or lists an origin_access_controls resource.

Overview

Nameorigin_access_controls
TypeResource
Idaws.cloudfront.origin_access_controls

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe unique identifier of the origin access control.
origin_access_control_configstringThe origin access control.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_origin_access_controlselectid, regionGets a CloudFront origin access control, including its unique identifier.
list_origin_access_controlsselectregionMarker, MaxItemsGets the list of CloudFront origin access controls (OACs) in this 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 another request that specifies the NextMarker value from the current response as the Marker value in the next request. If you're not using origin access controls for your Amazon Web Services account, the ListOriginAccessControls operation doesn't return the Items element in the response.
create_origin_access_controlinsertregion, OriginAccessControlConfigCreates a new origin access control in CloudFront. After you create an origin access control, you can add it to an origin in a CloudFront distribution so that CloudFront sends authenticated (signed) requests to the origin. This makes it possible to block public access to the origin, allowing viewers (users) to access the origin's content only through CloudFront. For more information about using a CloudFront origin access control, see Restricting access to an Amazon Web Services origin in the Amazon CloudFront Developer Guide.
update_origin_access_controlupdateid, region, OriginAccessControlConfigIf-MatchUpdates a CloudFront origin access control.
delete_origin_access_controldeleteid, regionIf-MatchDeletes a CloudFront origin access control. You cannot delete an origin access control if it's in use. First, update all distributions to remove the origin access control from all origins, then delete the origin access control.

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.

NameDatatypeDescription
idstringThe unique identifier of the origin access control that you are deleting.
regionstringAWS region (default: us-east-1)
If-MatchstringThe current version (ETag value) of the origin access control that you are deleting.
MarkerstringUse this field when paginating results to indicate where to begin in your list of origin access controls. The response includes the items 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.
MaxItemsstringThe maximum number of origin access controls that you want in the response.

SELECT examples

Gets a CloudFront origin access control, including its unique identifier.

SELECT
id,
origin_access_control_config
FROM aws.cloudfront.origin_access_controls
WHERE id = '{{ id }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

Creates a new origin access control in CloudFront. After you create an origin access control, you can add it to an origin in a CloudFront distribution so that CloudFront sends authenticated (signed) requests to the origin. This makes it possible to block public access to the origin, allowing viewers (users) to access the origin's content only through CloudFront. For more information about using a CloudFront origin access control, see Restricting access to an Amazon Web Services origin in the Amazon CloudFront Developer Guide.

INSERT INTO aws.cloudfront.origin_access_controls (
OriginAccessControlConfig,
region
)
SELECT
'{{ OriginAccessControlConfig }}' /* required */,
'{{ region }}'
RETURNING
id,
origin_access_control_config
;

UPDATE examples

Updates a CloudFront origin access control.

UPDATE aws.cloudfront.origin_access_controls
SET
OriginAccessControlConfig = '{{ OriginAccessControlConfig }}'
WHERE
id = '{{ id }}' --required
AND region = '{{ region }}' --required
AND OriginAccessControlConfig = '{{ OriginAccessControlConfig }}' --required
AND `If-Match` = '{{ If-Match}}'
RETURNING
id,
origin_access_control_config;

DELETE examples

Deletes a CloudFront origin access control. You cannot delete an origin access control if it's in use. First, update all distributions to remove the origin access control from all origins, then delete the origin access control.

DELETE FROM aws.cloudfront.origin_access_controls
WHERE id = '{{ id }}' --required
AND region = '{{ region }}' --required
AND `If-Match` = '{{ If-Match }}'
;