distributions
Creates, updates, deletes or gets a distribution resource or lists distributions in a region
Overview
| Name | distributions |
| Type | Resource |
| Description | A distribution tells CloudFront where you want content to be delivered from, and the details about how to track and manage content delivery. |
| Id | awscc.cloudfront.distributions |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
distribution_config | object | The distribution's configuration. |
domain_name | string | |
id | string | |
tags | array | A complex type that contains zero or more Tag elements. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
id | string | |
region | string | AWS region. |
For more information, see AWS::CloudFront::Distribution.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | distributions | INSERT | DistributionConfig, 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_config,
domain_name,
id,
tags
FROM awscc.cloudfront.distributions
WHERE
region = 'us-east-1' AND
Identifier = '{{ id }}';
Lists all distributions in a region.
SELECT
region,
id
FROM awscc.cloudfront.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.cloudfront.distributions (
DistributionConfig,
region
)
SELECT
'{{ distribution_config }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ create */
INSERT INTO awscc.cloudfront.distributions (
DistributionConfig,
Tags,
region
)
SELECT
'{{ distribution_config }}',
'{{ tags }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: distribution
props:
- name: distribution_config
value:
aliases:
- '{{ aliases[0] }}'
anycast_ip_list_id: '{{ anycast_ip_list_id }}'
cnames:
- '{{ cnames[0] }}'
cache_behaviors:
- allowed_methods:
- '{{ allowed_methods[0] }}'
cache_policy_id: '{{ cache_policy_id }}'
cached_methods:
- '{{ cached_methods[0] }}'
compress: '{{ compress }}'
default_ttl: null
field_level_encryption_id: '{{ field_level_encryption_id }}'
forwarded_values:
cookies:
forward: '{{ forward }}'
whitelisted_names:
- '{{ whitelisted_names[0] }}'
headers:
- '{{ headers[0] }}'
query_string: '{{ query_string }}'
query_string_cache_keys:
- '{{ query_string_cache_keys[0] }}'
function_associations:
- event_type: '{{ event_type }}'
function_arn: '{{ function_arn }}'
grpc_config:
enabled: '{{ enabled }}'
lambda_function_associations:
- event_type: '{{ event_type }}'
include_body: '{{ include_body }}'
lambda_function_arn: '{{ lambda_function_arn }}'
max_ttl: null
min_ttl: null
origin_request_policy_id: '{{ origin_request_policy_id }}'
path_pattern: '{{ path_pattern }}'
realtime_log_config_arn: '{{ realtime_log_config_arn }}'
response_headers_policy_id: '{{ response_headers_policy_id }}'
smooth_streaming: '{{ smooth_streaming }}'
target_origin_id: '{{ target_origin_id }}'
trusted_key_groups:
- '{{ trusted_key_groups[0] }}'
trusted_signers:
- '{{ trusted_signers[0] }}'
viewer_protocol_policy: '{{ viewer_protocol_policy }}'
comment: '{{ comment }}'
connection_mode: '{{ connection_mode }}'
continuous_deployment_policy_id: '{{ continuous_deployment_policy_id }}'
custom_error_responses:
- error_caching_min_ttl: null
error_code: '{{ error_code }}'
response_code: '{{ response_code }}'
response_page_path: '{{ response_page_path }}'
custom_origin:
dns_name: '{{ dns_name }}'
h_tt_pport: '{{ h_tt_pport }}'
h_tt_ps_port: '{{ h_tt_ps_port }}'
origin_protocol_policy: '{{ origin_protocol_policy }}'
origin_ss_lprotocols:
- '{{ origin_ss_lprotocols[0] }}'
default_cache_behavior:
allowed_methods:
- '{{ allowed_methods[0] }}'
cache_policy_id: '{{ cache_policy_id }}'
cached_methods:
- '{{ cached_methods[0] }}'
compress: '{{ compress }}'
default_ttl: null
field_level_encryption_id: '{{ field_level_encryption_id }}'
forwarded_values: null
function_associations:
- null
grpc_config: null
lambda_function_associations:
- null
max_ttl: null
min_ttl: null
origin_request_policy_id: '{{ origin_request_policy_id }}'
realtime_log_config_arn: '{{ realtime_log_config_arn }}'
response_headers_policy_id: '{{ response_headers_policy_id }}'
smooth_streaming: '{{ smooth_streaming }}'
target_origin_id: '{{ target_origin_id }}'
trusted_key_groups:
- '{{ trusted_key_groups[0] }}'
trusted_signers:
- '{{ trusted_signers[0] }}'
viewer_protocol_policy: '{{ viewer_protocol_policy }}'
default_root_object: '{{ default_root_object }}'
enabled: '{{ enabled }}'
http_version: '{{ http_version }}'
ip_v6_enabled: '{{ ip_v6_enabled }}'
logging:
bucket: '{{ bucket }}'
include_cookies: '{{ include_cookies }}'
prefix: '{{ prefix }}'
origin_groups:
items:
- failover_criteria:
status_codes:
items:
- '{{ items[0] }}'
quantity: '{{ quantity }}'
id: '{{ id }}'
members:
items:
- origin_id: '{{ origin_id }}'
quantity: '{{ quantity }}'
selection_criteria: '{{ selection_criteria }}'
quantity: '{{ quantity }}'
origins:
- connection_attempts: '{{ connection_attempts }}'
connection_timeout: '{{ connection_timeout }}'
response_completion_timeout: '{{ response_completion_timeout }}'
custom_origin_config:
h_tt_pport: '{{ h_tt_pport }}'
h_tt_ps_port: '{{ h_tt_ps_port }}'
origin_keepalive_timeout: '{{ origin_keepalive_timeout }}'
origin_protocol_policy: '{{ origin_protocol_policy }}'
origin_read_timeout: '{{ origin_read_timeout }}'
origin_ss_lprotocols:
- '{{ origin_ss_lprotocols[0] }}'
ip_address_type: '{{ ip_address_type }}'
domain_name: '{{ domain_name }}'
id: '{{ id }}'
origin_access_control_id: '{{ origin_access_control_id }}'
origin_custom_headers:
- header_name: '{{ header_name }}'
header_value: '{{ header_value }}'
origin_path: '{{ origin_path }}'
origin_shield:
enabled: '{{ enabled }}'
origin_shield_region: '{{ origin_shield_region }}'
s3_origin_config:
origin_access_identity: '{{ origin_access_identity }}'
origin_read_timeout: '{{ origin_read_timeout }}'
vpc_origin_config:
origin_keepalive_timeout: '{{ origin_keepalive_timeout }}'
origin_read_timeout: '{{ origin_read_timeout }}'
vpc_origin_id: '{{ vpc_origin_id }}'
price_class: '{{ price_class }}'
restrictions:
geo_restriction:
locations:
- '{{ locations[0] }}'
restriction_type: '{{ restriction_type }}'
s3_origin:
dns_name: '{{ dns_name }}'
origin_access_identity: '{{ origin_access_identity }}'
staging: '{{ staging }}'
tenant_config:
parameter_definitions:
- name: '{{ name }}'
definition:
string_schema:
comment: '{{ comment }}'
default_value: '{{ default_value }}'
required: '{{ required }}'
viewer_certificate:
acm_certificate_arn: '{{ acm_certificate_arn }}'
cloud_front_default_certificate: '{{ cloud_front_default_certificate }}'
iam_certificate_id: '{{ iam_certificate_id }}'
minimum_protocol_version: '{{ minimum_protocol_version }}'
ssl_support_method: '{{ ssl_support_method }}'
web_acl_id: '{{ web_acl_id }}'
- 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.cloudfront.distributions
SET PatchDocument = string('{{ {
"DistributionConfig": distribution_config,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ id }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
DELETE example
/*+ delete */
DELETE FROM awscc.cloudfront.distributions
WHERE
Identifier = '{{ id }}' AND
region = 'us-east-1'
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:
| Parameter | Description |
|---|---|
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:
- Create
- Delete
- List
- Read
- Update
cloudfront:CreateConnectionGroup,
cloudfront:CreateDistribution,
cloudfront:CreateDistributionWithTags,
cloudfront:GetConnectionGroup,
cloudfront:GetDistribution,
cloudfront:GetDistributionConfig,
cloudfront:TagResource
cloudfront:DeleteDistribution,
cloudfront:GetDistribution,
cloudfront:GetDistributionConfig
cloudfront:ListTagsForResource,
cloudfront:ListDistributions
cloudfront:GetDistribution,
cloudfront:GetDistributionConfig
cloudfront:CreateConnectionGroup,
cloudfront:GetConnectionGroup,
cloudfront:GetDistribution,
cloudfront:GetDistributionConfig,
cloudfront:UpdateDistribution,
cloudfront:UpdateDistributionWithStagingConfig,
cloudfront:ListTagsForResource,
cloudfront:TagResource,
cloudfront:UntagResource