Skip to main content

origin_access_controls

Creates, updates, deletes or gets an origin_access_control resource or lists origin_access_controls in a region

Overview

Nameorigin_access_controls
TypeResource
Description
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 origin in the Amazon CloudFront Developer Guide.
Idawscc.cloudfront.origin_access_controls

Fields

NameDatatypeDescription
idstring
origin_access_control_configobjectThe origin access control.
regionstringAWS region.

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

Methods

NameResourceAccessible byRequired Params
create_resourceorigin_access_controlsINSERTOriginAccessControlConfig, region
delete_resourceorigin_access_controlsDELETEIdentifier, region
update_resourceorigin_access_controlsUPDATEIdentifier, PatchDocument, region
list_resourcesorigin_access_controls_list_onlySELECTregion
get_resourceorigin_access_controlsSELECTIdentifier, region

SELECT examples

Gets all properties from an individual origin_access_control.

SELECT
region,
id,
origin_access_control_config
FROM awscc.cloudfront.origin_access_controls
WHERE
region = 'us-east-1' AND
Identifier = '{{ id }}';

INSERT example

Use the following StackQL query and manifest file to create a new origin_access_control resource, using stack-deploy.

/*+ create */
INSERT INTO awscc.cloudfront.origin_access_controls (
OriginAccessControlConfig,
region
)
SELECT
'{{ origin_access_control_config }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

UPDATE example

Use the following StackQL query and manifest file to update a origin_access_control resource, using stack-deploy.

/*+ update */
UPDATE awscc.cloudfront.origin_access_controls
SET PatchDocument = string('{{ {
"OriginAccessControlConfig": origin_access_control_config
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ id }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

DELETE example

/*+ delete */
DELETE FROM awscc.cloudfront.origin_access_controls
WHERE
Identifier = '{{ id }}' AND
region = 'us-east-1'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

Additional Parameters

Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:

ParameterDescription
ClientToken
A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.
A client token is valid for 36 hours once used.
After that, a resource request with the same client token is treated as a new request.
If you do not specify a client token, one is generated for inclusion in the request.
RoleArn
The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.
If you do not specify a role, a temporary session is created using your AWS user credentials.
TypeVersionId
For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used.

Permissions

To operate on the origin_access_controls resource, the following permissions are required:

cloudfront:CreateOriginAccessControl