distributions
Creates, updates, deletes or gets a distribution resource or lists distributions in a region
Overview
| Name | distributions |
| Type | Resource |
| Description | Resource Type definition for AWS::Lightsail::Distribution |
| Id | awscc.lightsail.distributions |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
distribution_name | string | The name for the distribution. |
distribution_arn | string | |
bundle_id | string | The bundle ID to use for the distribution. |
ip_address_type | string | The IP address type for the distribution. |
cache_behaviors | array | An array of objects that describe the per-path cache behavior for the distribution. |
cache_behavior_settings | object | An object that describes the cache behavior settings for the distribution. |
default_cache_behavior | object | An object that describes the default cache behavior for the distribution. |
origin | object | An object that describes the origin resource for the distribution, such as a Lightsail instance or load balancer. |
status | string | The status of the distribution. |
able_to_update_bundle | boolean | Indicates whether the bundle that is currently applied to your distribution, specified using the distributionName parameter, can be changed to another bundle. |
is_enabled | boolean | Indicates whether the distribution is enabled. |
certificate_name | string | The certificate attached to the Distribution. |
tags | array | An array of key-value pairs to apply to this resource. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
distribution_name | string | The name for the distribution. |
region | string | AWS region. |
For more information, see AWS::Lightsail::Distribution.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | distributions | INSERT | DistributionName, BundleId, DefaultCacheBehavior, Origin, region |
delete_resource | distributions | DELETE | Identifier, region |
update_resource | distributions | UPDATE | Identifier, PatchDocument, region |
list_resources | distributions_list_only | SELECT | region |
get_resource | distributions | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
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 = 'us-east-1' AND
Identifier = '{{ distribution_name }}';
Lists all distributions in a region.
SELECT
region,
distribution_name
FROM awscc.lightsail.distributions_list_only
WHERE
region = 'us-east-1';
INSERT example
Use the following StackQL query and manifest file to create a new distribution resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.lightsail.distributions (
DistributionName,
BundleId,
DefaultCacheBehavior,
Origin,
region
)
SELECT
'{{ distribution_name }}',
'{{ bundle_id }}',
'{{ default_cache_behavior }}',
'{{ origin }}',
'{{ region }}';
/*+ create */
INSERT INTO awscc.lightsail.distributions (
DistributionName,
BundleId,
IpAddressType,
CacheBehaviors,
CacheBehaviorSettings,
DefaultCacheBehavior,
Origin,
IsEnabled,
CertificateName,
Tags,
region
)
SELECT
'{{ distribution_name }}',
'{{ bundle_id }}',
'{{ ip_address_type }}',
'{{ cache_behaviors }}',
'{{ cache_behavior_settings }}',
'{{ default_cache_behavior }}',
'{{ origin }}',
'{{ is_enabled }}',
'{{ certificate_name }}',
'{{ tags }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: distribution
props:
- name: distribution_name
value: '{{ distribution_name }}'
- name: bundle_id
value: '{{ bundle_id }}'
- name: ip_address_type
value: '{{ ip_address_type }}'
- name: cache_behaviors
value:
- behavior: '{{ behavior }}'
path: '{{ path }}'
- name: cache_behavior_settings
value:
allowed_ht_tp_methods: '{{ allowed_ht_tp_methods }}'
cached_ht_tp_methods: '{{ cached_ht_tp_methods }}'
default_ttl: '{{ default_ttl }}'
maximum_ttl: '{{ maximum_ttl }}'
minimum_ttl: '{{ minimum_ttl }}'
forwarded_cookies:
cookies_allow_list:
- '{{ cookies_allow_list[0] }}'
option: '{{ option }}'
forwarded_headers:
headers_allow_list:
- '{{ headers_allow_list[0] }}'
option: '{{ option }}'
forwarded_query_strings:
query_strings_allow_list:
- '{{ query_strings_allow_list[0] }}'
option: '{{ option }}'
- name: default_cache_behavior
value:
behavior: '{{ behavior }}'
- name: origin
value:
name: '{{ name }}'
protocol_policy: '{{ protocol_policy }}'
region_name: '{{ region_name }}'
- name: is_enabled
value: '{{ is_enabled }}'
- name: certificate_name
value: '{{ certificate_name }}'
- name: tags
value:
- key: '{{ key }}'
value: '{{ value }}'
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 }}';
DELETE example
/*+ delete */
DELETE FROM awscc.lightsail.distributions
WHERE
Identifier = '{{ distribution_name }}' AND
region = 'us-east-1';
Permissions
To operate on the distributions resource, the following permissions are required:
- Create
- Read
- Update
- Delete
- List
lightsail:AttachCertificateToDistribution,
lightsail:CreateDistribution,
lightsail:DetachCertificateFromDistribution,
lightsail:GetCertificates,
lightsail:GetCertificateDetails,
lightsail:GetDistributions,
lightsail:TagResource,
lightsail:UntagResource,
lightsail:UpdateDistribution,
lightsail:UpdateDistributionBundle
lightsail:GetDistributions
lightsail:AttachCertificateToDistribution,
lightsail:DetachCertificateFromDistribution,
lightsail:GetCertificates,
lightsail:GetCertificateDetails,
lightsail:GetDistributions,
lightsail:TagResource,
lightsail:UntagResource,
lightsail:UpdateDistribution,
lightsail:UpdateDistributionBundle
lightsail:DeleteDistribution,
lightsail:GetDistributions
lightsail:GetDistributions