Skip to main content

distributions

Creates, updates, deletes or gets a distribution resource or lists distributions in a region

Overview

Namedistributions
TypeResource
DescriptionResource Type definition for AWS::Lightsail::Distribution
Idawscc.lightsail.distributions

Fields

NameDatatypeDescription
distribution_namestringThe name for the distribution.
distribution_arnstring
bundle_idstringThe bundle ID to use for the distribution.
ip_address_typestringThe IP address type for the distribution.
cache_behaviorsarrayAn array of objects that describe the per-path cache behavior for the distribution.
cache_behavior_settingsobjectAn object that describes the cache behavior settings for the distribution.
default_cache_behaviorobjectAn object that describes the default cache behavior for the distribution.
originobjectAn object that describes the origin resource for the distribution, such as a Lightsail instance or load balancer.
statusstringThe status of the distribution.
able_to_update_bundlebooleanIndicates whether the bundle that is currently applied to your distribution, specified using the distributionName parameter, can be changed to another bundle.
is_enabledbooleanIndicates whether the distribution is enabled.
certificate_namestringThe certificate attached to the Distribution.
tagsarrayAn array of key-value pairs to apply to this resource.
regionstringAWS region.

For more information, see AWS::Lightsail::Distribution.

Methods

NameResourceAccessible byRequired Params
create_resourcedistributionsINSERTDistributionName, BundleId, DefaultCacheBehavior, Origin, region
delete_resourcedistributionsDELETEIdentifier, region
update_resourcedistributionsUPDATEIdentifier, PatchDocument, region
list_resourcesdistributions_list_onlySELECTregion
get_resourcedistributionsSELECTIdentifier, region

SELECT examples

Gets all properties from an individual distribution.

SELECT
region,
distribution_name,
distribution_arn,
bundle_id,
ip_address_type,
cache_behaviors,
cache_behavior_settings,
default_cache_behavior,
origin,
status,
able_to_update_bundle,
is_enabled,
certificate_name,
tags
FROM awscc.lightsail.distributions
WHERE
region = '{{ region }}' AND
Identifier = '{{ distribution_name }}';

INSERT example

Use the following StackQL query and manifest file to create a new distribution resource, using stack-deploy.

/*+ create */
INSERT INTO awscc.lightsail.distributions (
DistributionName,
BundleId,
DefaultCacheBehavior,
Origin,
region
)
SELECT
'{{ distribution_name }}',
'{{ bundle_id }}',
'{{ default_cache_behavior }}',
'{{ origin }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

UPDATE example

Use the following StackQL query and manifest file to update a distribution resource, using stack-deploy.

/*+ update */
UPDATE awscc.lightsail.distributions
SET PatchDocument = string('{{ {
"BundleId": bundle_id,
"CacheBehaviors": cache_behaviors,
"CacheBehaviorSettings": cache_behavior_settings,
"DefaultCacheBehavior": default_cache_behavior,
"Origin": origin,
"IsEnabled": is_enabled,
"CertificateName": certificate_name,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ distribution_name }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

DELETE example

/*+ delete */
DELETE FROM awscc.lightsail.distributions
WHERE
Identifier = '{{ distribution_name }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

Additional Parameters

Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:

ParameterDescription
ClientToken
A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.
A client token is valid for 36 hours once used.
After that, a resource request with the same client token is treated as a new request.
If you do not specify a client token, one is generated for inclusion in the request.
RoleArn
The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.
If you do not specify a role, a temporary session is created using your AWS user credentials.
TypeVersionId
For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used.

Permissions

To operate on the distributions resource, the following permissions are required:

lightsail:AttachCertificateToDistribution,
lightsail:CreateDistribution,
lightsail:DetachCertificateFromDistribution,
lightsail:GetCertificates,
lightsail:GetCertificateDetails,
lightsail:GetDistributions,
lightsail:TagResource,
lightsail:UntagResource,
lightsail:UpdateDistribution,
lightsail:UpdateDistributionBundle