AWS Tools for Windows PowerShell
Command Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Synopsis

Calls the Amazon CloudFront UpdateCachePolicy API operation.

Syntax

Update-CFCachePolicy
-Id <String>
-CachePolicyConfig_Comment <String>
-CookiesConfig_CookieBehavior <CachePolicyCookieBehavior>
-CachePolicyConfig_DefaultTTL <Int64>
-ParametersInCacheKeyAndForwardedToOrigin_EnableAcceptEncodingBrotli <Boolean>
-ParametersInCacheKeyAndForwardedToOrigin_EnableAcceptEncodingGzip <Boolean>
-HeadersConfig_HeaderBehavior <CachePolicyHeaderBehavior>
-IfMatch <String>
-Cookies_Item <String[]>
-Headers_Item <String[]>
-QueryStrings_Item <String[]>
-CachePolicyConfig_MaxTTL <Int64>
-CachePolicyConfig_MinTTL <Int64>
-CachePolicyConfig_Name <String>
-Cookies_Quantity <Int32>
-Headers_Quantity <Int32>
-QueryStrings_Quantity <Int32>
-QueryStringsConfig_QueryStringBehavior <CachePolicyQueryStringBehavior>
-Select <String>
-PassThru <SwitchParameter>
-Force <SwitchParameter>
-ClientConfig <AmazonCloudFrontConfig>

Description

Updates a cache policy configuration. When you update a cache policy configuration, all the fields are updated with the values provided in the request. You cannot update some fields independent of others. To update a cache policy configuration:
  1. Use GetCachePolicyConfig to get the current configuration.
  2. Locally modify the fields in the cache policy configuration that you want to update.
  3. Call UpdateCachePolicy by providing the entire cache policy configuration, including the fields that you modified and those that you didn't.

Parameters

-CachePolicyConfig_Comment <String>
A comment to describe the cache policy. The comment cannot be longer than 128 characters.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-CachePolicyConfig_DefaultTTL <Int64>
The default amount of time, in seconds, that you want objects to stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated. CloudFront uses this value as the object's time to live (TTL) only when the origin does not send Cache-Control or Expires headers with the object. For more information, see Managing How Long Content Stays in an Edge Cache (Expiration) in the Amazon CloudFront Developer Guide.The default value for this field is 86400 seconds (one day). If the value of MinTTL is more than 86400 seconds, then the default value for this field is the same as the value of MinTTL.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-CachePolicyConfig_MaxTTL <Int64>
The maximum amount of time, in seconds, that objects stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated. CloudFront uses this value only when the origin sends Cache-Control or Expires headers with the object. For more information, see Managing How Long Content Stays in an Edge Cache (Expiration) in the Amazon CloudFront Developer Guide.The default value for this field is 31536000 seconds (one year). If the value of MinTTL or DefaultTTL is more than 31536000 seconds, then the default value for this field is the same as the value of DefaultTTL.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-CachePolicyConfig_MinTTL <Int64>
The minimum amount of time, in seconds, that you want objects to stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated. For more information, see Managing How Long Content Stays in an Edge Cache (Expiration) in the Amazon CloudFront Developer Guide.
Required?True
Position?Named
Accept pipeline input?True (ByPropertyName)
-CachePolicyConfig_Name <String>
A unique name to identify the cache policy.
Required?True
Position?Named
Accept pipeline input?True (ByPropertyName)
-ClientConfig <AmazonCloudFrontConfig>
Amazon.PowerShell.Cmdlets.CF.AmazonCloudFrontClientCmdlet.ClientConfig
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-Cookies_Item <String[]>
A list of cookie names.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesCachePolicyConfig_ParametersInCacheKeyAndForwardedToOrigin_CookiesConfig_Cookies_Items
-Cookies_Quantity <Int32>
The number of cookie names in the Items list.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesCachePolicyConfig_ParametersInCacheKeyAndForwardedToOrigin_CookiesConfig_Cookies_Quantity
-CookiesConfig_CookieBehavior <CachePolicyCookieBehavior>
Determines whether any cookies in viewer requests are included in the cache key and in requests that CloudFront sends to the origin. Valid values are:
  • none – No cookies in viewer requests are included in the cache key or in requests that CloudFront sends to the origin. Even when this field is set to none, any cookies that are listed in an OriginRequestPolicyare included in origin requests.
  • whitelist – Only the cookies in viewer requests that are listed in the CookieNames type are included in the cache key and in requests that CloudFront sends to the origin.
  • allExcept – All cookies in viewer requests are included in the cache key and in requests that CloudFront sends to the origin, except for those that are listed in the CookieNames type, which are not included.
  • all – All cookies in viewer requests are included in the cache key and in requests that CloudFront sends to the origin.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesCachePolicyConfig_ParametersInCacheKeyAndForwardedToOrigin_CookiesConfig_CookieBehavior
This parameter overrides confirmation prompts to force the cmdlet to continue its operation. This parameter should always be used with caution.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-Headers_Item <String[]>
A list of HTTP header names.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesCachePolicyConfig_ParametersInCacheKeyAndForwardedToOrigin_HeadersConfig_Headers_Items
-Headers_Quantity <Int32>
The number of header names in the Items list.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesCachePolicyConfig_ParametersInCacheKeyAndForwardedToOrigin_HeadersConfig_Headers_Quantity
-HeadersConfig_HeaderBehavior <CachePolicyHeaderBehavior>
Determines whether any HTTP headers are included in the cache key and in requests that CloudFront sends to the origin. Valid values are:
  • none – No HTTP headers are included in the cache key or in requests that CloudFront sends to the origin. Even when this field is set to none, any headers that are listed in an OriginRequestPolicyare included in origin requests.
  • whitelist – Only the HTTP headers that are listed in the Headers type are included in the cache key and in requests that CloudFront sends to the origin.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesCachePolicyConfig_ParametersInCacheKeyAndForwardedToOrigin_HeadersConfig_HeaderBehavior
-Id <String>
The unique identifier for the cache policy that you are updating. The identifier is returned in a cache behavior's CachePolicyId field in the response to GetDistributionConfig.
Required?True
Position?1
Accept pipeline input?True (ByValue, ByPropertyName)
-IfMatch <String>
The version of the cache policy that you are updating. The version is returned in the cache policy's ETag field in the response to GetCachePolicyConfig.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-ParametersInCacheKeyAndForwardedToOrigin_EnableAcceptEncodingBrotli <Boolean>
A flag that can affect whether the Accept-Encoding HTTP header is included in the cache key and included in requests that CloudFront sends to the origin.This field is related to the EnableAcceptEncodingGzip field. If one or both of these fields is trueand the viewer request includes the Accept-Encoding header, then CloudFront does the following:
  • Normalizes the value of the viewer's Accept-Encoding header
  • Includes the normalized header in the cache key
  • Includes the normalized header in the request to the origin, if a request is necessary
For more information, see Compression support in the Amazon CloudFront Developer Guide.If you set this value to true, and this cache behavior also has an origin request policy attached, do not include the Accept-Encoding header in the origin request policy. CloudFront always includes the Accept-Encoding header in origin requests when the value of this field is true, so including this header in an origin request policy has no effect.If both of these fields are false, then CloudFront treats the Accept-Encoding header the same as any other HTTP header in the viewer request. By default, it's not included in the cache key and it's not included in origin requests. In this case, you can manually add Accept-Encoding to the headers whitelist like any other HTTP header.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesCachePolicyConfig_ParametersInCacheKeyAndForwardedToOrigin_EnableAcceptEncodingBrotli
-ParametersInCacheKeyAndForwardedToOrigin_EnableAcceptEncodingGzip <Boolean>
A flag that can affect whether the Accept-Encoding HTTP header is included in the cache key and included in requests that CloudFront sends to the origin.This field is related to the EnableAcceptEncodingBrotli field. If one or both of these fields is trueand the viewer request includes the Accept-Encoding header, then CloudFront does the following:
  • Normalizes the value of the viewer's Accept-Encoding header
  • Includes the normalized header in the cache key
  • Includes the normalized header in the request to the origin, if a request is necessary
For more information, see Compression support in the Amazon CloudFront Developer Guide.If you set this value to true, and this cache behavior also has an origin request policy attached, do not include the Accept-Encoding header in the origin request policy. CloudFront always includes the Accept-Encoding header in origin requests when the value of this field is true, so including this header in an origin request policy has no effect.If both of these fields are false, then CloudFront treats the Accept-Encoding header the same as any other HTTP header in the viewer request. By default, it's not included in the cache key and it's not included in origin requests. In this case, you can manually add Accept-Encoding to the headers whitelist like any other HTTP header.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesCachePolicyConfig_ParametersInCacheKeyAndForwardedToOrigin_EnableAcceptEncodingGzip
-PassThru <SwitchParameter>
Changes the cmdlet behavior to return the value passed to the Id parameter. The -PassThru parameter is deprecated, use -Select '^Id' instead. This parameter will be removed in a future version.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-QueryStrings_Item <String[]>
A list of query string names.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesCachePolicyConfig_ParametersInCacheKeyAndForwardedToOrigin_QueryStringsConfig_QueryStrings_Items
-QueryStrings_Quantity <Int32>
The number of query string names in the Items list.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesCachePolicyConfig_ParametersInCacheKeyAndForwardedToOrigin_QueryStringsConfig_QueryStrings_Quantity
-QueryStringsConfig_QueryStringBehavior <CachePolicyQueryStringBehavior>
Determines whether any URL query strings in viewer requests are included in the cache key and in requests that CloudFront sends to the origin. Valid values are:
  • none – No query strings in viewer requests are included in the cache key or in requests that CloudFront sends to the origin. Even when this field is set to none, any query strings that are listed in an OriginRequestPolicyare included in origin requests.
  • whitelist – Only the query strings in viewer requests that are listed in the QueryStringNames type are included in the cache key and in requests that CloudFront sends to the origin.
  • allExcept – All query strings in viewer requests are included in the cache key and in requests that CloudFront sends to the origin, except those that are listed in the QueryStringNames type, which are not included.
  • all – All query strings in viewer requests are included in the cache key and in requests that CloudFront sends to the origin.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesCachePolicyConfig_ParametersInCacheKeyAndForwardedToOrigin_QueryStringsConfig_QueryStringBehavior
-Select <String>
Use the -Select parameter to control the cmdlet output. The default value is 'CachePolicy'. Specifying -Select '*' will result in the cmdlet returning the whole service response (Amazon.CloudFront.Model.UpdateCachePolicyResponse). Specifying the name of a property of type Amazon.CloudFront.Model.UpdateCachePolicyResponse will result in that property being returned. Specifying -Select '^ParameterName' will result in the cmdlet returning the selected cmdlet parameter value.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)

Common Credential and Region Parameters

-AccessKey <String>
The AWS access key for the user account. This can be a temporary access key if the corresponding session token is supplied to the -SessionToken parameter.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesAK
-Credential <AWSCredentials>
An AWSCredentials object instance containing access and secret key information, and optionally a token for session-based credentials.
Required?False
Position?Named
Accept pipeline input?True (ByValue, ByPropertyName)
-EndpointUrl <String>
The endpoint to make the call against.Note: This parameter is primarily for internal AWS use and is not required/should not be specified for normal usage. The cmdlets normally determine which endpoint to call based on the region specified to the -Region parameter or set as default in the shell (via Set-DefaultAWSRegion). Only specify this parameter if you must direct the call to a specific custom endpoint.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-NetworkCredential <PSCredential>
Used with SAML-based authentication when ProfileName references a SAML role profile. Contains the network credentials to be supplied during authentication with the configured identity provider's endpoint. This parameter is not required if the user's default network identity can or should be used during authentication.
Required?False
Position?Named
Accept pipeline input?True (ByValue, ByPropertyName)
-ProfileLocation <String>
Used to specify the name and location of the ini-format credential file (shared with the AWS CLI and other AWS SDKs)If this optional parameter is omitted this cmdlet will search the encrypted credential file used by the AWS SDK for .NET and AWS Toolkit for Visual Studio first. If the profile is not found then the cmdlet will search in the ini-format credential file at the default location: (user's home directory)\.aws\credentials.If this parameter is specified then this cmdlet will only search the ini-format credential file at the location given.As the current folder can vary in a shell or during script execution it is advised that you use specify a fully qualified path instead of a relative path.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesAWSProfilesLocation, ProfilesLocation
-ProfileName <String>
The user-defined name of an AWS credentials or SAML-based role profile containing credential information. The profile is expected to be found in the secure credential file shared with the AWS SDK for .NET and AWS Toolkit for Visual Studio. You can also specify the name of a profile stored in the .ini-format credential file used with the AWS CLI and other AWS SDKs.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesStoredCredentials, AWSProfileName
-Region <Object>
The system name of an AWS region or an AWSRegion instance. This governs the endpoint that will be used when calling service operations. Note that the AWS resources referenced in a call are usually region-specific.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesRegionToCall
-SecretKey <String>
The AWS secret key for the user account. This can be a temporary secret key if the corresponding session token is supplied to the -SessionToken parameter.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesSK, SecretAccessKey
-SessionToken <String>
The session token if the access and secret keys are temporary session-based credentials.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
AliasesST

Outputs

This cmdlet returns an Amazon.CloudFront.Model.CachePolicy object. The service call response (type Amazon.CloudFront.Model.UpdateCachePolicyResponse) can also be referenced from properties attached to the cmdlet entry in the $AWSHistory stack.

Supported Version

AWS Tools for PowerShell: 2.x.y.z