CloudFront / Client / create_origin_access_control
create_origin_access_control#
- CloudFront.Client.create_origin_access_control(**kwargs)#
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.
See also: AWS API Documentation
Request Syntax
response = client.create_origin_access_control( OriginAccessControlConfig={ 'Name': 'string', 'Description': 'string', 'SigningProtocol': 'sigv4', 'SigningBehavior': 'never'|'always'|'no-override', 'OriginAccessControlOriginType': 's3'|'mediastore'|'mediapackagev2'|'lambda' } )
- Parameters:
OriginAccessControlConfig (dict) –
[REQUIRED]
Contains the origin access control.
Name (string) – [REQUIRED]
A name to identify the origin access control. You can specify up to 64 characters.
Description (string) –
A description of the origin access control.
SigningProtocol (string) – [REQUIRED]
The signing protocol of the origin access control, which determines how CloudFront signs (authenticates) requests. The only valid value is
sigv4
.SigningBehavior (string) – [REQUIRED]
Specifies which requests CloudFront signs (adds authentication information to). Specify
always
for the most common use case. For more information, see origin access control advanced settings in the Amazon CloudFront Developer Guide.This field can have one of the following values:
always
– CloudFront signs all origin requests, overwriting theAuthorization
header from the viewer request if one exists.never
– CloudFront doesn’t sign any origin requests. This value turns off origin access control for all origins in all distributions that use this origin access control.no-override
– If the viewer request doesn’t contain theAuthorization
header, then CloudFront signs the origin request. If the viewer request contains theAuthorization
header, then CloudFront doesn’t sign the origin request and instead passes along theAuthorization
header from the viewer request. WARNING: To pass along theAuthorization
header from the viewer request, you must add theAuthorization
header to a cache policy for all cache behaviors that use origins associated with this origin access control.
OriginAccessControlOriginType (string) – [REQUIRED]
The type of origin that this origin access control is for.
- Return type:
dict
- Returns:
Response Syntax
{ 'OriginAccessControl': { 'Id': 'string', 'OriginAccessControlConfig': { 'Name': 'string', 'Description': 'string', 'SigningProtocol': 'sigv4', 'SigningBehavior': 'never'|'always'|'no-override', 'OriginAccessControlOriginType': 's3'|'mediastore'|'mediapackagev2'|'lambda' } }, 'Location': 'string', 'ETag': 'string' }
Response Structure
(dict) –
OriginAccessControl (dict) –
Contains an origin access control.
Id (string) –
The unique identifier of the origin access control.
OriginAccessControlConfig (dict) –
The origin access control.
Name (string) –
A name to identify the origin access control. You can specify up to 64 characters.
Description (string) –
A description of the origin access control.
SigningProtocol (string) –
The signing protocol of the origin access control, which determines how CloudFront signs (authenticates) requests. The only valid value is
sigv4
.SigningBehavior (string) –
Specifies which requests CloudFront signs (adds authentication information to). Specify
always
for the most common use case. For more information, see origin access control advanced settings in the Amazon CloudFront Developer Guide.This field can have one of the following values:
always
– CloudFront signs all origin requests, overwriting theAuthorization
header from the viewer request if one exists.never
– CloudFront doesn’t sign any origin requests. This value turns off origin access control for all origins in all distributions that use this origin access control.no-override
– If the viewer request doesn’t contain theAuthorization
header, then CloudFront signs the origin request. If the viewer request contains theAuthorization
header, then CloudFront doesn’t sign the origin request and instead passes along theAuthorization
header from the viewer request. WARNING: To pass along theAuthorization
header from the viewer request, you must add theAuthorization
header to a cache policy for all cache behaviors that use origins associated with this origin access control.
OriginAccessControlOriginType (string) –
The type of origin that this origin access control is for.
Location (string) –
The URL of the origin access control.
ETag (string) –
The version identifier for the current version of the origin access control.
Exceptions
CloudFront.Client.exceptions.OriginAccessControlAlreadyExists
CloudFront.Client.exceptions.TooManyOriginAccessControls
CloudFront.Client.exceptions.InvalidArgument