create_cache_policy¶
Operation¶
create_cache_policy
async
¶
create_cache_policy(input: CreateCachePolicyInput, plugins: list[Plugin] | None = None) -> CreateCachePolicyOutput
Creates a cache policy.
After you create a cache policy, you can attach it to one or more cache behaviors. When it's attached to a cache behavior, the cache policy determines the following:
-
The values that CloudFront includes in the cache key. These values can include HTTP headers, cookies, and URL query strings. CloudFront uses the cache key to find an object in its cache that it can return to the viewer.
-
The default, minimum, and maximum time to live (TTL) values that you want objects to stay in the CloudFront cache.
Warning:
If your minimum TTL is greater than 0, CloudFront will cache content
for at least the duration specified in the cache policy's minimum
TTL, even if the Cache-Control: no-cache, no-store, or private
directives are present in the origin headers.
The headers, cookies, and query strings that are included in the cache
key are also included in requests that CloudFront sends to the origin.
CloudFront sends a request when it can't find an object in its cache
that matches the request's cache key. If you want to send values to the
origin but not include them in the cache key, use
OriginRequestPolicy.
For more information about cache policies, see Controlling the cache key in the Amazon CloudFront Developer Guide.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
CreateCachePolicyInput
|
An instance of |
required |
plugins
|
list[Plugin] | None
|
A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations. |
None
|
Returns:
| Type | Description |
|---|---|
CreateCachePolicyOutput
|
An instance of |
Input¶
CreateCachePolicyInput
dataclass
¶
Output¶
CreateCachePolicyOutput
dataclass
¶
Bases: _SerdeShape
Dataclass for CreateCachePolicyOutput structure.
Attributes¶
cache_policy
class-attribute
instance-attribute
¶
A cache policy.
e_tag
class-attribute
instance-attribute
¶
e_tag: str | None = ...
The current version of the cache policy.
location
class-attribute
instance-attribute
¶
location: str | None = ...
The fully qualified URI of the cache policy just created.
response_metadata
class-attribute
instance-attribute
¶
Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.