CfnDistributionPropsMixin
- class aws_cdk.mixins_preview.aws_lightsail.mixins.CfnDistributionPropsMixin(props, *, strategy=None)
Bases:
MixinThe
AWS::Lightsail::Distributionresource specifies a content delivery network (CDN) distribution.You can create distributions only in the
us-east-1AWS Region.A distribution is a globally distributed network of caching servers that improve the performance of your website or web application hosted on a Lightsail instance, static content hosted on a Lightsail bucket, or through a Lightsail load balancer.
- See:
- CloudformationResource:
AWS::Lightsail::Distribution
- 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_lightsail import mixins as lightsail_mixins cfn_distribution_props_mixin = lightsail_mixins.CfnDistributionPropsMixin(lightsail_mixins.CfnDistributionMixinProps( bundle_id="bundleId", cache_behaviors=[lightsail_mixins.CfnDistributionPropsMixin.CacheBehaviorPerPathProperty( behavior="behavior", path="path" )], cache_behavior_settings=lightsail_mixins.CfnDistributionPropsMixin.CacheSettingsProperty( allowed_http_methods="allowedHttpMethods", cached_http_methods="cachedHttpMethods", default_ttl=123, forwarded_cookies=lightsail_mixins.CfnDistributionPropsMixin.CookieObjectProperty( cookies_allow_list=["cookiesAllowList"], option="option" ), forwarded_headers=lightsail_mixins.CfnDistributionPropsMixin.HeaderObjectProperty( headers_allow_list=["headersAllowList"], option="option" ), forwarded_query_strings=lightsail_mixins.CfnDistributionPropsMixin.QueryStringObjectProperty( option=False, query_strings_allow_list=["queryStringsAllowList"] ), maximum_ttl=123, minimum_ttl=123 ), certificate_name="certificateName", default_cache_behavior=lightsail_mixins.CfnDistributionPropsMixin.CacheBehaviorProperty( behavior="behavior" ), distribution_name="distributionName", ip_address_type="ipAddressType", is_enabled=False, origin=lightsail_mixins.CfnDistributionPropsMixin.InputOriginProperty( name="name", protocol_policy="protocolPolicy", region_name="regionName" ), tags=[CfnTag( key="key", value="value" )] ), strategy=mixins.PropertyMergeStrategy.OVERRIDE )
Create a mixin to apply properties to
AWS::Lightsail::Distribution.- Parameters:
props (
Union[CfnDistributionMixinProps,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 = ['bundleId', 'cacheBehaviors', 'cacheBehaviorSettings', 'certificateName', 'defaultCacheBehavior', 'distributionName', 'ipAddressType', 'isEnabled', 'origin', 'tags']
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
CacheBehaviorPerPathProperty
- class CfnDistributionPropsMixin.CacheBehaviorPerPathProperty(*, behavior=None, path=None)
Bases:
objectCacheBehaviorPerPathis a property of the AWS::Lightsail::Distribution resource. It describes the per-path cache behavior of an Amazon Lightsail content delivery network (CDN) distribution.Use a per-path cache behavior to override the default cache behavior of a distribution, or to add an exception to it. For example, if you set the
CacheBehaviortocache, you can use a per-path cache behavior to specify a directory, file, or file type that your distribution will cache. If you don’t want your distribution to cache a specified directory, file, or file type, set the per-path cache behavior todont-cache.- Parameters:
behavior (
Optional[str]) – The cache behavior for the specified path. You can specify one of the following per-path cache behaviors: - ``cache`` - This behavior caches the specified path. - ``dont-cache`` - This behavior doesn’t cache the specified path.path (
Optional[str]) – The path to a directory or file to cache, or not cache. Use an asterisk symbol to specify wildcard directories (path/to/assets/*), and file types (*.html,*jpg,*js). Directories and file paths are case-sensitive. Examples: - Specify the following to cache all files in the document root of an Apache web server running on a instance.var/www/html/- Specify the following file to cache only the index page in the document root of an Apache web server.var/www/html/index.html- Specify the following to cache only the .html files in the document root of an Apache web server.var/www/html/*.html- Specify the following to cache only the .jpg, .png, and .gif files in the images sub-directory of the document root of an Apache web server.var/www/html/images/*.jpgvar/www/html/images/*.pngvar/www/html/images/*.gifSpecify the following to cache all files in the images subdirectory of the document root of an Apache web server.var/www/html/images/
- 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_lightsail import mixins as lightsail_mixins cache_behavior_per_path_property = lightsail_mixins.CfnDistributionPropsMixin.CacheBehaviorPerPathProperty( behavior="behavior", path="path" )
Attributes
- behavior
The cache behavior for the specified path.
You can specify one of the following per-path cache behaviors:
``cache`` - This behavior caches the specified path.
``dont-cache`` - This behavior doesn’t cache the specified path.
- path
The path to a directory or file to cache, or not cache.
Use an asterisk symbol to specify wildcard directories (
path/to/assets/*), and file types (*.html,*jpg,*js). Directories and file paths are case-sensitive.Examples:
Specify the following to cache all files in the document root of an Apache web server running on a instance.
var/www/html/Specify the following file to cache only the index page in the document root of an Apache web server.
var/www/html/index.htmlSpecify the following to cache only the .html files in the document root of an Apache web server.
var/www/html/*.htmlSpecify the following to cache only the .jpg, .png, and .gif files in the images sub-directory of the document root of an Apache web server.
var/www/html/images/*.jpgvar/www/html/images/*.pngvar/www/html/images/*.gifSpecify the following to cache all files in the images subdirectory of the document root of an Apache web server.
var/www/html/images/
CacheBehaviorProperty
- class CfnDistributionPropsMixin.CacheBehaviorProperty(*, behavior=None)
Bases:
objectCacheBehavioris a property of the AWS::Lightsail::Distribution resource. It describes the default cache behavior of an Amazon Lightsail content delivery network (CDN) distribution.- Parameters:
behavior (
Optional[str]) – The cache behavior of the distribution. The following cache behaviors can be specified: - ``cache`` - This option is best for static sites. When specified, your distribution caches and serves your entire website as static content. This behavior is ideal for websites with static content that doesn’t change depending on who views it, or for websites that don’t use cookies, headers, or query strings to personalize content. - ``dont-cache`` - This option is best for sites that serve a mix of static and dynamic content. When specified, your distribution caches and serves only the content that is specified in the distribution’sCacheBehaviorPerPathparameter. This behavior is ideal for websites or web applications that use cookies, headers, and query strings to personalize content for individual users.- 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_lightsail import mixins as lightsail_mixins cache_behavior_property = lightsail_mixins.CfnDistributionPropsMixin.CacheBehaviorProperty( behavior="behavior" )
Attributes
- behavior
The cache behavior of the distribution.
The following cache behaviors can be specified:
``cache`` - This option is best for static sites. When specified, your distribution caches and serves your entire website as static content. This behavior is ideal for websites with static content that doesn’t change depending on who views it, or for websites that don’t use cookies, headers, or query strings to personalize content.
``dont-cache`` - This option is best for sites that serve a mix of static and dynamic content. When specified, your distribution caches and serves only the content that is specified in the distribution’s
CacheBehaviorPerPathparameter. This behavior is ideal for websites or web applications that use cookies, headers, and query strings to personalize content for individual users.
CacheSettingsProperty
- class CfnDistributionPropsMixin.CacheSettingsProperty(*, allowed_http_methods=None, cached_http_methods=None, default_ttl=None, forwarded_cookies=None, forwarded_headers=None, forwarded_query_strings=None, maximum_ttl=None, minimum_ttl=None)
Bases:
objectCacheSettingsis 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
CacheBehaviorsthat have aBehaviorofcache. This includes theDefaultCacheBehavior.- Parameters:
allowed_http_methods (
Optional[str]) – The HTTP methods that are processed and forwarded to the distribution’s origin. You can specify the following options: -GET,HEAD- The distribution forwards theGETandHEADmethods. -GET,HEAD,OPTIONS- The distribution forwards theGET,HEAD, andOPTIONSmethods. -GET,HEAD,OPTIONS,PUT,PATCH,POST,DELETE- The distribution forwards theGET,HEAD,OPTIONS,PUT,PATCH,POST, andDELETEmethods. If you specifyGET,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.cached_http_methods (
Optional[str]) – The HTTP method responses that are cached by your distribution. You can specify the following options: -GET,HEAD- The distribution caches responses to theGETandHEADmethods. -GET,HEAD,OPTIONS- The distribution caches responses to theGET,HEAD, andOPTIONSmethods.default_ttl (
Union[int,float,None]) – 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. .. epigraph:: The value specified applies only when the origin does not add HTTP headers such asCache-Control max-age,Cache-Control s-maxage, andExpiresto objects.forwarded_cookies (
Union[IResolvable,CookieObjectProperty,Dict[str,Any],None]) – An object that describes the cookies that are forwarded to the origin. Your content is cached based on the cookies that are forwarded.forwarded_headers (
Union[IResolvable,HeaderObjectProperty,Dict[str,Any],None]) – An object that describes the headers that are forwarded to the origin. Your content is cached based on the headers that are forwarded.forwarded_query_strings (
Union[IResolvable,QueryStringObjectProperty,Dict[str,Any],None]) – 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.maximum_ttl (
Union[int,float,None]) – 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 asCache-Control max-age,Cache-Control s-maxage, andExpiresto objects.minimum_ttl (
Union[int,float,None]) – 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 of0must be specified forminimumTTLif the distribution is configured to forward all headers to the origin.
- 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_lightsail import mixins as lightsail_mixins cache_settings_property = lightsail_mixins.CfnDistributionPropsMixin.CacheSettingsProperty( allowed_http_methods="allowedHttpMethods", cached_http_methods="cachedHttpMethods", default_ttl=123, forwarded_cookies=lightsail_mixins.CfnDistributionPropsMixin.CookieObjectProperty( cookies_allow_list=["cookiesAllowList"], option="option" ), forwarded_headers=lightsail_mixins.CfnDistributionPropsMixin.HeaderObjectProperty( headers_allow_list=["headersAllowList"], option="option" ), forwarded_query_strings=lightsail_mixins.CfnDistributionPropsMixin.QueryStringObjectProperty( option=False, query_strings_allow_list=["queryStringsAllowList"] ), maximum_ttl=123, minimum_ttl=123 )
Attributes
- allowed_http_methods
The HTTP methods that are processed and forwarded to the distribution’s origin.
You can specify the following options:
GET,HEAD- The distribution forwards theGETandHEADmethods.GET,HEAD,OPTIONS- The distribution forwards theGET,HEAD, andOPTIONSmethods.GET,HEAD,OPTIONS,PUT,PATCH,POST,DELETE- The distribution forwards theGET,HEAD,OPTIONS,PUT,PATCH,POST, andDELETEmethods.
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.
- cached_http_methods
The HTTP method responses that are cached by your distribution.
You can specify the following options:
GET,HEAD- The distribution caches responses to theGETandHEADmethods.GET,HEAD,OPTIONS- The distribution caches responses to theGET,HEAD, andOPTIONSmethods.
- default_ttl
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, andExpiresto objects.
- forwarded_cookies
An object that describes the cookies that are forwarded to the origin.
Your content is cached based on the cookies that are forwarded.
- forwarded_headers
An object that describes the headers that are forwarded to the origin.
Your content is cached based on the headers that are forwarded.
- forwarded_query_strings
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.
- maximum_ttl
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, andExpiresto objects.
- minimum_ttl
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
0must be specified forminimumTTLif the distribution is configured to forward all headers to the origin.
HeaderObjectProperty
- class CfnDistributionPropsMixin.HeaderObjectProperty(*, headers_allow_list=None, option=None)
Bases:
objectHeaderObjectis a property of the CacheSettings property. It describes the request headers used by your distribution, which caches your content based on the request headers.For the headers that you specify, your distribution caches separate versions of the specified content based on the header values in viewer requests. For example, suppose that viewer requests for logo.jpg contain a custom product header that has a value of either acme or apex. Also, suppose that you configure your distribution to cache your content based on values in the product header. Your distribution forwards the product header to the origin and caches the response from the origin once for each header value.
- Parameters:
headers_allow_list (
Optional[Sequence[str]]) – The specific headers to forward to your distribution’s origin.option (
Optional[str]) – The headers that you want your distribution to forward to your origin. Your distribution caches your content based on these headers. Use one of the following configurations for your distribution: - ``all`` - Forwards all headers to your origin.. - ``none`` - Forwards only the default headers. - ``allow-list`` - Forwards only the headers that you specify using theHeadersAllowListparameter.
- 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_lightsail import mixins as lightsail_mixins header_object_property = lightsail_mixins.CfnDistributionPropsMixin.HeaderObjectProperty( headers_allow_list=["headersAllowList"], option="option" )
Attributes
- headers_allow_list
The specific headers to forward to your distribution’s origin.
- option
The headers that you want your distribution to forward to your origin.
Your distribution caches your content based on these headers.
Use one of the following configurations for your distribution:
``all`` - Forwards all headers to your origin..
``none`` - Forwards only the default headers.
``allow-list`` - Forwards only the headers that you specify using the
HeadersAllowListparameter.
InputOriginProperty
- class CfnDistributionPropsMixin.InputOriginProperty(*, name=None, protocol_policy=None, region_name=None)
Bases:
objectInputOriginis a property of the AWS::Lightsail::Distribution resource. It describes the origin resource of an Amazon Lightsail content delivery network (CDN) distribution.An origin can be a instance, bucket, or load balancer. A distribution pulls content from an origin, caches it, and serves it to viewers through a worldwide network of edge servers.
- Parameters:
name (
Optional[str]) – The name of the origin resource.protocol_policy (
Optional[str]) – The protocol that your Amazon Lightsail distribution uses when establishing a connection with your origin to pull content.region_name (
Optional[str]) – The AWS Region name of the origin resource.
- 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_lightsail import mixins as lightsail_mixins input_origin_property = lightsail_mixins.CfnDistributionPropsMixin.InputOriginProperty( name="name", protocol_policy="protocolPolicy", region_name="regionName" )
Attributes
- name
The name of the origin resource.
- protocol_policy
The protocol that your Amazon Lightsail distribution uses when establishing a connection with your origin to pull content.
- region_name
The AWS Region name of the origin resource.
QueryStringObjectProperty
- class CfnDistributionPropsMixin.QueryStringObjectProperty(*, option=None, query_strings_allow_list=None)
Bases:
objectQueryStringObjectis a property of the CacheSettings property. It describes the query string parameters that an Amazon Lightsail content delivery network (CDN) distribution to bases caching on.For the query strings that you specify, your distribution caches separate versions of the specified content based on the query string values in viewer requests.
- Parameters:
option (
Union[bool,IResolvable,None]) – Indicates whether the distribution forwards and caches based on query strings.query_strings_allow_list (
Optional[Sequence[str]]) – The specific query strings that the distribution forwards to the origin. Your distribution caches content based on the specified query strings. If theoptionparameter is true, then your distribution forwards all query strings, regardless of what you specify using theQueryStringsAllowListparameter.
- 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_lightsail import mixins as lightsail_mixins query_string_object_property = lightsail_mixins.CfnDistributionPropsMixin.QueryStringObjectProperty( option=False, query_strings_allow_list=["queryStringsAllowList"] )
Attributes
- option
Indicates whether the distribution forwards and caches based on query strings.
- query_strings_allow_list
The specific query strings that the distribution forwards to the origin.
Your distribution caches content based on the specified query strings.
If the
optionparameter is true, then your distribution forwards all query strings, regardless of what you specify using theQueryStringsAllowListparameter.