Skip to main content

distributions

Creates, updates, deletes, gets or lists a distributions resource.

Overview

Namedistributions
TypeResource
Idaws.lightsail.distributions

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
distributionsarrayAn array of objects that describe your distributions.
next_page_tokenstringThe 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:

NameAccessible byRequired ParamsOptional ParamsDescription
get_distributionsselectregionReturns information about one or more of your Amazon Lightsail content delivery network (CDN) distributions.
create_distributioninsertregion, distributionName, origin, defaultCacheBehavior, bundleIdCreates 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_distributionupdateregion, distributionName, certificateNameAttaches 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_distributionupdateregion, distributionNameUpdates an existing Amazon Lightsail content delivery network (CDN) distribution. Use this action to update the configuration of your existing distribution.
delete_distributiondeleteregionDeletes your Amazon Lightsail content delivery network (CDN) distribution.
detach_certificate_from_distributionexecregion, distributionNameDetaches 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_cacheexecregionDeletes 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.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

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

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
;

UPDATE examples

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;

DELETE examples

Deletes your Amazon Lightsail content delivery network (CDN) distribution.

DELETE FROM aws.lightsail.distributions
WHERE region = '{{ region }}' --required
;

Lifecycle Methods

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 }}"
}'
;