distributions
Creates, updates, deletes, gets or lists a distributions resource.
Overview
| Name | distributions |
| Type | Resource |
| Id | aws.lightsail.distributions |
Fields
The following fields are returned by SELECT queries:
- get_distributions
| Name | Datatype | Description |
|---|---|---|
distributions | array | An array of objects that describe your distributions. |
next_page_token | string | The token to advance to the next page of results from your request. A next page token is not returned if there are no more results to display. To get the next page of results, perform another GetDistributions request and specify the next page token using the pageToken parameter. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_distributions | select | region | Returns information about one or more of your Amazon Lightsail content delivery network (CDN) distributions. | |
create_distribution | insert | region, distributionName, origin, defaultCacheBehavior, bundleId | Creates an Amazon Lightsail content delivery network (CDN) distribution. 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. For more information, see Content delivery networks in Amazon Lightsail. | |
attach_certificate_to_distribution | update | region, distributionName, certificateName | Attaches an SSL/TLS certificate to your Amazon Lightsail content delivery network (CDN) distribution. After the certificate is attached, your distribution accepts HTTPS traffic for all of the domains that are associated with the certificate. Use the CreateCertificate action to create a certificate that you can attach to your distribution. Only certificates created in the us-east-1 Amazon Web Services Region can be attached to Lightsail distributions. Lightsail distributions are global resources that can reference an origin in any Amazon Web Services Region, and distribute its content globally. However, all distributions are located in the us-east-1 Region. | |
update_distribution | update | region, distributionName | Updates an existing Amazon Lightsail content delivery network (CDN) distribution. Use this action to update the configuration of your existing distribution. | |
delete_distribution | delete | region | Deletes your Amazon Lightsail content delivery network (CDN) distribution. | |
detach_certificate_from_distribution | exec | region, distributionName | Detaches an SSL/TLS certificate from your Amazon Lightsail content delivery network (CDN) distribution. After the certificate is detached, your distribution stops accepting traffic for all of the domains that are associated with the certificate. | |
reset_distribution_cache | exec | region | Deletes currently cached content from your Amazon Lightsail content delivery network (CDN) distribution. After resetting the cache, the next time a content request is made, your distribution pulls, serves, and caches it from the origin. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
SELECT examples
- get_distributions
Returns information about one or more of your Amazon Lightsail content delivery network (CDN) distributions.
SELECT
distributions,
next_page_token
FROM aws.lightsail.distributions
WHERE region = '{{ region }}' -- required
;
INSERT examples
- create_distribution
- Manifest
Creates an Amazon Lightsail content delivery network (CDN) distribution. 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. For more information, see Content delivery networks in Amazon Lightsail.
INSERT INTO aws.lightsail.distributions (
distributionName,
origin,
defaultCacheBehavior,
cacheBehaviorSettings,
cacheBehaviors,
bundleId,
ipAddressType,
tags,
certificateName,
viewerMinimumTlsProtocolVersion,
region
)
SELECT
'{{ distributionName }}' /* required */,
'{{ origin }}' /* required */,
'{{ defaultCacheBehavior }}' /* required */,
'{{ cacheBehaviorSettings }}',
'{{ cacheBehaviors }}',
'{{ bundleId }}' /* required */,
'{{ ipAddressType }}',
'{{ tags }}',
'{{ certificateName }}',
'{{ viewerMinimumTlsProtocolVersion }}',
'{{ region }}'
RETURNING
distribution,
operation
;
# Description fields are for documentation purposes
- name: distributions
props:
- name: region
value: "{{ region }}"
description: Required parameter for the distributions resource.
- name: distributionName
value: "{{ distributionName }}"
description: |
The name for the distribution.
- name: origin
description: |
An object that describes the origin resource for the distribution, such as a Lightsail instance, bucket, or load balancer. The distribution pulls, caches, and serves content from the origin.
value:
name: "{{ name }}"
regionName: "{{ regionName }}"
protocolPolicy: "{{ protocolPolicy }}"
responseTimeout: {{ responseTimeout }}
ipAddressType: "{{ ipAddressType }}"
- name: defaultCacheBehavior
description: |
An object that describes the default cache behavior for the distribution.
value:
behavior: "{{ behavior }}"
- name: cacheBehaviorSettings
description: |
An object that describes the cache behavior settings for the distribution.
value:
defaultTTL: {{ defaultTTL }}
minimumTTL: {{ minimumTTL }}
maximumTTL: {{ maximumTTL }}
allowedHTTPMethods: "{{ allowedHTTPMethods }}"
cachedHTTPMethods: "{{ cachedHTTPMethods }}"
forwardedCookies:
option: "{{ option }}"
cookiesAllowList:
- "{{ cookiesAllowList }}"
forwardedHeaders:
option: "{{ option }}"
headersAllowList:
- "{{ headersAllowList }}"
forwardedQueryStrings:
option: {{ option }}
queryStringsAllowList:
- "{{ queryStringsAllowList }}"
- name: cacheBehaviors
description: |
An array of objects that describe the per-path cache behavior for the distribution.
value:
- path: "{{ path }}"
behavior: "{{ behavior }}"
- name: bundleId
value: "{{ bundleId }}"
description: |
The bundle ID to use for the distribution. A distribution bundle describes the specifications of your distribution, such as the monthly cost and monthly network transfer quota. Use the GetDistributionBundles action to get a list of distribution bundle IDs that you can specify.
- name: ipAddressType
value: "{{ ipAddressType }}"
description: |
The IP address type for the distribution. The possible values are ipv4 for IPv4 only, and dualstack for IPv4 and IPv6. The default value is dualstack.
valid_values: ['dualstack', 'ipv4', 'ipv6']
- name: tags
description: |
The tag keys and optional values to add to the distribution during create. Use the TagResource action to tag a resource after it's created.
value:
- key: "{{ key }}"
value: "{{ value }}"
- name: certificateName
value: "{{ certificateName }}"
description: |
The name of the SSL/TLS certificate that you want to attach to the distribution. Use the GetCertificates action to get a list of certificate names that you can specify.
- name: viewerMinimumTlsProtocolVersion
value: "{{ viewerMinimumTlsProtocolVersion }}"
description: |
The minimum TLS protocol version for the SSL/TLS certificate.
valid_values: ['TLSv1.1_2016', 'TLSv1.2_2018', 'TLSv1.2_2019', 'TLSv1.2_2021']
UPDATE examples
- attach_certificate_to_distribution
- update_distribution
Attaches an SSL/TLS certificate to your Amazon Lightsail content delivery network (CDN) distribution. After the certificate is attached, your distribution accepts HTTPS traffic for all of the domains that are associated with the certificate. Use the CreateCertificate action to create a certificate that you can attach to your distribution. Only certificates created in the us-east-1 Amazon Web Services Region can be attached to Lightsail distributions. Lightsail distributions are global resources that can reference an origin in any Amazon Web Services Region, and distribute its content globally. However, all distributions are located in the us-east-1 Region.
UPDATE aws.lightsail.distributions
SET
distributionName = '{{ distributionName }}',
certificateName = '{{ certificateName }}'
WHERE
region = '{{ region }}' --required
AND distributionName = '{{ distributionName }}' --required
AND certificateName = '{{ certificateName }}' --required
RETURNING
operation;
Updates an existing Amazon Lightsail content delivery network (CDN) distribution. Use this action to update the configuration of your existing distribution.
UPDATE aws.lightsail.distributions
SET
distributionName = '{{ distributionName }}',
origin = '{{ origin }}',
defaultCacheBehavior = '{{ defaultCacheBehavior }}',
cacheBehaviorSettings = '{{ cacheBehaviorSettings }}',
cacheBehaviors = '{{ cacheBehaviors }}',
isEnabled = {{ isEnabled }},
viewerMinimumTlsProtocolVersion = '{{ viewerMinimumTlsProtocolVersion }}',
certificateName = '{{ certificateName }}',
useDefaultCertificate = {{ useDefaultCertificate }}
WHERE
region = '{{ region }}' --required
AND distributionName = '{{ distributionName }}' --required
RETURNING
operation;
DELETE examples
- delete_distribution
Deletes your Amazon Lightsail content delivery network (CDN) distribution.
DELETE FROM aws.lightsail.distributions
WHERE region = '{{ region }}' --required
;
Lifecycle Methods
- detach_certificate_from_distribution
- reset_distribution_cache
Detaches an SSL/TLS certificate from your Amazon Lightsail content delivery network (CDN) distribution. After the certificate is detached, your distribution stops accepting traffic for all of the domains that are associated with the certificate.
EXEC aws.lightsail.distributions.detach_certificate_from_distribution
@region='{{ region }}' --required
@@json=
'{
"distributionName": "{{ distributionName }}"
}'
;
Deletes currently cached content from your Amazon Lightsail content delivery network (CDN) distribution. After resetting the cache, the next time a content request is made, your distribution pulls, serves, and caches it from the origin.
EXEC aws.lightsail.distributions.reset_distribution_cache
@region='{{ region }}' --required
@@json=
'{
"distributionName": "{{ distributionName }}"
}'
;