Skip to content
v2.277.0

CacheSettingsProperty Struct ​

CacheSettings is a property of the AWS::Lightsail::Distribution resource. It describes the cache settings of an Amazon Lightsail content delivery network (CDN) distribution.

These settings apply only to your distribution’s CacheBehaviors that have a Behavior of cache . This includes the DefaultCacheBehavior .

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_lightsail as lightsail } from 'aws-cdk-lib';
const cacheSettingsProperty: lightsail.CfnDistribution.CacheSettingsProperty = {
  allowedHttpMethods: 'allowedHttpMethods',
  cachedHttpMethods: 'cachedHttpMethods',
  defaultTtl: 123,
  forwardedCookies: {
    cookiesAllowList: ['cookiesAllowList'],
    option: 'option',
  },
  forwardedHeaders: {
    headersAllowList: ['headersAllowList'],
    option: 'option',
  },
  forwardedQueryStrings: {
    option: false,
    queryStringsAllowList: ['queryStringsAllowList'],
  },
  maximumTtl: 123,
  minimumTtl: 123,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_lightsail as lightsail

cache_settings_property = lightsail.CfnDistribution.CacheSettingsProperty(
    allowed_http_methods="allowedHttpMethods",
    cached_http_methods="cachedHttpMethods",
    default_ttl=123,
    forwarded_cookies=lightsail.CfnDistribution.CookieObjectProperty(
        cookies_allow_list=["cookiesAllowList"],
        option="option"
    ),
    forwarded_headers=lightsail.CfnDistribution.HeaderObjectProperty(
        headers_allow_list=["headersAllowList"],
        option="option"
    ),
    forwarded_query_strings=lightsail.CfnDistribution.QueryStringObjectProperty(
        option=False,
        query_strings_allow_list=["queryStringsAllowList"]
    ),
    maximum_ttl=123,
    minimum_ttl=123
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.lightsail.*;

CacheSettingsProperty cacheSettingsProperty = CacheSettingsProperty.builder()
        .allowedHttpMethods("allowedHttpMethods")
        .cachedHttpMethods("cachedHttpMethods")
        .defaultTtl(123)
        .forwardedCookies(CookieObjectProperty.builder()
                .cookiesAllowList(List.of("cookiesAllowList"))
                .option("option")
                .build())
        .forwardedHeaders(HeaderObjectProperty.builder()
                .headersAllowList(List.of("headersAllowList"))
                .option("option")
                .build())
        .forwardedQueryStrings(QueryStringObjectProperty.builder()
                .option(false)
                .queryStringsAllowList(List.of("queryStringsAllowList"))
                .build())
        .maximumTtl(123)
        .minimumTtl(123)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Lightsail;

var cacheSettingsProperty = new CacheSettingsProperty {
    AllowedHttpMethods = "allowedHttpMethods",
    CachedHttpMethods = "cachedHttpMethods",
    DefaultTtl = 123,
    ForwardedCookies = new CookieObjectProperty {
        CookiesAllowList = new [] { "cookiesAllowList" },
        Option = "option"
    },
    ForwardedHeaders = new HeaderObjectProperty {
        HeadersAllowList = new [] { "headersAllowList" },
        Option = "option"
    },
    ForwardedQueryStrings = new QueryStringObjectProperty {
        Option = false,
        QueryStringsAllowList = new [] { "queryStringsAllowList" }
    },
    MaximumTtl = 123,
    MinimumTtl = 123
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

cacheSettingsProperty := &CacheSettingsProperty{
	AllowedHttpMethods: jsii.String("allowedHttpMethods"),
	CachedHttpMethods: jsii.String("cachedHttpMethods"),
	DefaultTtl: jsii.Number(123),
	ForwardedCookies: &CookieObjectProperty{
		CookiesAllowList: []*string{
			jsii.String("cookiesAllowList"),
		},
		Option: jsii.String("option"),
	},
	ForwardedHeaders: &HeaderObjectProperty{
		HeadersAllowList: []*string{
			jsii.String("headersAllowList"),
		},
		Option: jsii.String("option"),
	},
	ForwardedQueryStrings: &QueryStringObjectProperty{
		Option: jsii.Boolean(false),
		QueryStringsAllowList: []*string{
			jsii.String("queryStringsAllowList"),
		},
	},
	MaximumTtl: jsii.Number(123),
	MinimumTtl: jsii.Number(123),
}

Properties ​

allowedHttpMethodsoptionalstringallowed_http_methodsoptionalstrallowedHttpMethodsoptionalStringAllowedHttpMethodsoptionalstringAllowedHttpMethodsoptional*string#
The HTTP methods that are processed and forwarded to the distribution's origin.
notes

You can specify the following options:

  • GET,HEAD - The distribution forwards the GET and HEAD methods.
  • GET,HEAD,OPTIONS - The distribution forwards the GET , HEAD , and OPTIONS methods.
  • GET,HEAD,OPTIONS,PUT,PATCH,POST,DELETE - The distribution forwards the GET , HEAD , OPTIONS , PUT , PATCH , POST , and DELETE methods.

If you specify GET,HEAD,OPTIONS,PUT,PATCH,POST,DELETE , you might need to restrict access to your distribution's origin so users can't perform operations that you don't want them to. For example, you might not want users to have permission to delete objects from your origin.

cachedHttpMethodsoptionalstringcached_http_methodsoptionalstrcachedHttpMethodsoptionalStringCachedHttpMethodsoptionalstringCachedHttpMethodsoptional*string#
The HTTP method responses that are cached by your distribution.

You can specify the following options:

  • GET,HEAD - The distribution caches responses to the GET and HEAD methods.
  • GET,HEAD,OPTIONS - The distribution caches responses to the GET , HEAD , and OPTIONS methods.
defaultTtloptionalnumberdefault_ttloptionalint | floatdefaultTtloptionalNumberDefaultTtloptionaldoubleDefaultTtloptional*float64#
The default amount of time that objects stay in the distribution's cache before the distribution forwards another request to the origin to determine whether the content has been updated.

The value specified applies only when the origin does not add HTTP headers such as Cache-Control max-age , Cache-Control s-maxage , and Expires to objects.

forwardedCookiesoptionalIResolvable | CfnDistribution.CookieObjectPropertyforwarded_cookiesoptionaltyping.Union[IResolvable, CookieObjectProperty]forwardedCookiesoptionalIResolvableForwardedCookiesoptionalIResolvableForwardedCookiesoptionalinterface{}#
An object that describes the cookies that are forwarded to the origin.

Your content is cached based on the cookies that are forwarded.

forwardedHeadersoptionalIResolvable | CfnDistribution.HeaderObjectPropertyforwarded_headersoptionaltyping.Union[IResolvable, HeaderObjectProperty]forwardedHeadersoptionalIResolvableForwardedHeadersoptionalIResolvableForwardedHeadersoptionalinterface{}#
An object that describes the headers that are forwarded to the origin.

Your content is cached based on the headers that are forwarded.

forwardedQueryStringsoptionalIResolvable | CfnDistribution.QueryStringObjectPropertyforwarded_query_stringsoptionaltyping.Union[IResolvable, QueryStringObjectProperty]forwardedQueryStringsoptionalIResolvableForwardedQueryStringsoptionalIResolvableForwardedQueryStringsoptionalinterface{}#
An object that describes the query strings that are forwarded to the origin.

Your content is cached based on the query strings that are forwarded.

maximumTtloptionalnumbermaximum_ttloptionalint | floatmaximumTtloptionalNumberMaximumTtloptionaldoubleMaximumTtloptional*float64#
The maximum amount of time that objects stay in the distribution's cache before the distribution forwards another request to the origin to determine whether the object has been updated.

The value specified applies only when the origin adds HTTP headers such as Cache-Control max-age , Cache-Control s-maxage , and Expires to objects.

minimumTtloptionalnumberminimum_ttloptionalint | floatminimumTtloptionalNumberMinimumTtloptionaldoubleMinimumTtloptional*float64#
The minimum amount of time that objects stay in the distribution's cache before the distribution forwards another request to the origin to determine whether the object has been updated.

A value of 0 must be specified for minimumTTL if the distribution is configured to forward all headers to the origin.