Behavior¶
-
class
aws_cdk.aws_cloudfront.
Behavior
(*, allowed_methods=None, cached_methods=None, compress=None, default_ttl=None, forwarded_values=None, is_default_behavior=None, lambda_function_associations=None, max_ttl=None, min_ttl=None, path_pattern=None, trusted_key_groups=None, trusted_signers=None)¶ Bases:
object
A CloudFront behavior wrapper.
- Parameters
allowed_methods (
Optional
[CloudFrontAllowedMethods
]) – The method this CloudFront distribution responds do. Default: GET_HEADcached_methods (
Optional
[CloudFrontAllowedCachedMethods
]) – Which methods are cached by CloudFront by default. Default: GET_HEADcompress (
Optional
[bool
]) – If CloudFront should automatically compress some content types. Default: truedefault_ttl (
Optional
[Duration
]) – The default amount of time CloudFront will cache an object. This value applies only when your custom origin does not add HTTP headers, such as Cache-Control max-age, Cache-Control s-maxage, and Expires to objects. Default: 86400 (1 day)forwarded_values (
Optional
[ForwardedValuesProperty
]) – The values CloudFront will forward to the origin when making a request. Default: none (no cookies - no headers)is_default_behavior (
Optional
[bool
]) – If this behavior is the default behavior for the distribution. You must specify exactly one default distribution per CloudFront distribution. The default behavior is allowed to omit the “path” property.lambda_function_associations (
Optional
[Sequence
[LambdaFunctionAssociation
]]) – Declares associated lambda@edge functions for this distribution behaviour. Default: No lambda function associatedmax_ttl (
Optional
[Duration
]) – The max amount of time you want objects to stay in the cache before CloudFront queries your origin. Default: Duration.seconds(31536000) (one year)min_ttl (
Optional
[Duration
]) – The minimum amount of time that you want objects to stay in the cache before CloudFront queries your origin.path_pattern (
Optional
[str
]) – The path this behavior responds to. Required for all non-default behaviors. (The default behavior implicitly has “*” as the path pattern. )trusted_key_groups (
Optional
[Sequence
[IKeyGroup
]]) – A list of Key Groups that CloudFront can use to validate signed URLs or signed cookies. Default: - no KeyGroups are associated with cache behaviortrusted_signers (
Optional
[Sequence
[str
]]) – (deprecated) Trusted signers is how CloudFront allows you to serve private content. The signers are the account IDs that are allowed to sign cookies/presigned URLs for this distribution. If you pass a non empty value, all requests for this behavior must be signed (no public access will be allowed)
Attributes
-
allowed_methods
¶ The method this CloudFront distribution responds do.
- Default
GET_HEAD
- Return type
Optional
[CloudFrontAllowedMethods
]
-
cached_methods
¶ Which methods are cached by CloudFront by default.
- Default
GET_HEAD
- Return type
Optional
[CloudFrontAllowedCachedMethods
]
-
compress
¶ If CloudFront should automatically compress some content types.
- Default
true
- Return type
Optional
[bool
]
-
default_ttl
¶ The default amount of time CloudFront will cache an object.
This value applies only when your custom origin does not add HTTP headers, such as Cache-Control max-age, Cache-Control s-maxage, and Expires to objects.
- Default
86400 (1 day)
- Return type
Optional
[Duration
]
-
forwarded_values
¶ The values CloudFront will forward to the origin when making a request.
- Default
none (no cookies - no headers)
- Return type
Optional
[ForwardedValuesProperty
]
-
is_default_behavior
¶ If this behavior is the default behavior for the distribution.
You must specify exactly one default distribution per CloudFront distribution. The default behavior is allowed to omit the “path” property.
- Return type
Optional
[bool
]
-
lambda_function_associations
¶ Declares associated lambda@edge functions for this distribution behaviour.
- Default
No lambda function associated
- Return type
Optional
[List
[LambdaFunctionAssociation
]]
-
max_ttl
¶ The max amount of time you want objects to stay in the cache before CloudFront queries your origin.
- Default
Duration.seconds(31536000) (one year)
- Return type
Optional
[Duration
]
-
min_ttl
¶ The minimum amount of time that you want objects to stay in the cache before CloudFront queries your origin.
- Return type
Optional
[Duration
]
-
path_pattern
¶ The path this behavior responds to.
Required for all non-default behaviors. (The default behavior implicitly has “*” as the path pattern. )
- Return type
Optional
[str
]
-
trusted_key_groups
¶ A list of Key Groups that CloudFront can use to validate signed URLs or signed cookies.
- Default
no KeyGroups are associated with cache behavior
- See
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html
- Return type
Optional
[List
[IKeyGroup
]]
-
trusted_signers
¶ (deprecated) Trusted signers is how CloudFront allows you to serve private content.
The signers are the account IDs that are allowed to sign cookies/presigned URLs for this distribution.
If you pass a non empty value, all requests for this behavior must be signed (no public access will be allowed)
- Deprecated
We recommend using trustedKeyGroups instead of trustedSigners.
- Stability
deprecated
- Return type
Optional
[List
[str
]]