CfnOriginAccessControlPropsMixin
- class aws_cdk.mixins_preview.aws_cloudfront.mixins.CfnOriginAccessControlPropsMixin(props, *, strategy=None)
Bases:
MixinCreates 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 AWS origin in the Amazon CloudFront Developer Guide .
- See:
- CloudformationResource:
AWS::CloudFront::OriginAccessControl
- Mixin:
true
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk.mixins_preview import mixins from aws_cdk.mixins_preview.aws_cloudfront import mixins as cloudfront_mixins cfn_origin_access_control_props_mixin = cloudfront_mixins.CfnOriginAccessControlPropsMixin(cloudfront_mixins.CfnOriginAccessControlMixinProps( origin_access_control_config=cloudfront_mixins.CfnOriginAccessControlPropsMixin.OriginAccessControlConfigProperty( description="description", name="name", origin_access_control_origin_type="originAccessControlOriginType", signing_behavior="signingBehavior", signing_protocol="signingProtocol" ) ), strategy=mixins.PropertyMergeStrategy.OVERRIDE )
Create a mixin to apply properties to
AWS::CloudFront::OriginAccessControl.- Parameters:
props (
Union[CfnOriginAccessControlMixinProps,Dict[str,Any]]) – L1 properties to apply.strategy (
Optional[PropertyMergeStrategy]) – (experimental) Strategy for merging nested properties. Default: - PropertyMergeStrategy.MERGE
Methods
- apply_to(construct)
Apply the mixin properties to the construct.
- Parameters:
construct (
IConstruct)- Return type:
- supports(construct)
Check if this mixin supports the given construct.
- Parameters:
construct (
IConstruct)- Return type:
bool
Attributes
- CFN_PROPERTY_KEYS = ['originAccessControlConfig']
Static Methods
- classmethod is_mixin(x)
(experimental) Checks if
xis a Mixin.- Parameters:
x (
Any) – Any object.- Return type:
bool- Returns:
true if
xis an object created from a class which extendsMixin.- Stability:
experimental
OriginAccessControlConfigProperty
- class CfnOriginAccessControlPropsMixin.OriginAccessControlConfigProperty(*, description=None, name=None, origin_access_control_origin_type=None, signing_behavior=None, signing_protocol=None)
Bases:
objectCreates 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 AWS origin in the Amazon CloudFront Developer Guide .
- Parameters:
description (
Optional[str]) – A description of the origin access control.name (
Optional[str]) – A name to identify the origin access control. You can specify up to 64 characters.origin_access_control_origin_type (
Optional[str]) – The type of origin that this origin access control is for.signing_behavior (
Optional[str]) – Specifies which requests CloudFront signs (adds authentication information to). Specifyalwaysfor 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 theAuthorizationheader 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 theAuthorizationheader, then CloudFront signs the origin request. If the viewer request contains theAuthorizationheader, then CloudFront doesn’t sign the origin request and instead passes along theAuthorizationheader from the viewer request. WARNING: To pass along the ``Authorization`` header from the viewer request, you *must add theAuthorizationheader to a cache policy for all cache behaviors that use origins associated with this origin access control.*signing_protocol (
Optional[str]) – The signing protocol of the origin access control, which determines how CloudFront signs (authenticates) requests. The only valid value issigv4.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk.mixins_preview.aws_cloudfront import mixins as cloudfront_mixins origin_access_control_config_property = cloudfront_mixins.CfnOriginAccessControlPropsMixin.OriginAccessControlConfigProperty( description="description", name="name", origin_access_control_origin_type="originAccessControlOriginType", signing_behavior="signingBehavior", signing_protocol="signingProtocol" )
Attributes
- description
A description of the origin access control.
- name
A name to identify the origin access control.
You can specify up to 64 characters.
- origin_access_control_origin_type
The type of origin that this origin access control is for.
- signing_behavior
Specifies which requests CloudFront signs (adds authentication information to).
Specify
alwaysfor 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 theAuthorizationheader 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 theAuthorizationheader, then CloudFront signs the origin request. If the viewer request contains theAuthorizationheader, then CloudFront doesn’t sign the origin request and instead passes along theAuthorizationheader from the viewer request. WARNING: To pass along the ``Authorization`` header from the viewer request, you *must add theAuthorizationheader to a cache policy for all cache behaviors that use origins associated with this origin access control.*
- signing_protocol
The signing protocol of the origin access control, which determines how CloudFront signs (authenticates) requests.
The only valid value is
sigv4.