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 | aws.cloudfront.distributions |
Fields
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. |
Methods
Name | Accessible by | Required Params |
---|---|---|
create_resource | INSERT | DistributionConfig, region |
delete_resource | DELETE | data__Identifier, region |
update_resource | UPDATE | data__Identifier, data__PatchDocument, region |
list_resources | SELECT | region |
get_resource | SELECT | data__Identifier, region |
SELECT
examples
Gets all distributions
in a region.
SELECT
region,
distribution_config,
domain_name,
id,
tags
FROM aws.cloudfront.distributions
;
Gets all properties from an individual distribution
.
SELECT
region,
distribution_config,
domain_name,
id,
tags
FROM aws.cloudfront.distributions
WHERE data__Identifier = '<Id>';
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 aws.cloudfront.distributions (
DistributionConfig,
region
)
SELECT
'{{ DistributionConfig }}',
'{{ region }}';
/*+ create */
INSERT INTO aws.cloudfront.distributions (
DistributionConfig,
Tags,
region
)
SELECT
'{{ DistributionConfig }}',
'{{ Tags }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: distribution
props:
- name: DistributionConfig
value:
Aliases:
- '{{ Aliases[0] }}'
CNAMEs:
- '{{ CNAMEs[0] }}'
CacheBehaviors:
- AllowedMethods:
- '{{ AllowedMethods[0] }}'
CachePolicyId: '{{ CachePolicyId }}'
CachedMethods:
- '{{ CachedMethods[0] }}'
Compress: '{{ Compress }}'
DefaultTTL: null
FieldLevelEncryptionId: '{{ FieldLevelEncryptionId }}'
ForwardedValues:
Cookies:
Forward: '{{ Forward }}'
WhitelistedNames:
- '{{ WhitelistedNames[0] }}'
Headers:
- '{{ Headers[0] }}'
QueryString: '{{ QueryString }}'
QueryStringCacheKeys:
- '{{ QueryStringCacheKeys[0] }}'
FunctionAssociations:
- EventType: '{{ EventType }}'
FunctionARN: '{{ FunctionARN }}'
LambdaFunctionAssociations:
- EventType: '{{ EventType }}'
IncludeBody: '{{ IncludeBody }}'
LambdaFunctionARN: '{{ LambdaFunctionARN }}'
MaxTTL: null
MinTTL: null
OriginRequestPolicyId: '{{ OriginRequestPolicyId }}'
PathPattern: '{{ PathPattern }}'
RealtimeLogConfigArn: '{{ RealtimeLogConfigArn }}'
ResponseHeadersPolicyId: '{{ ResponseHeadersPolicyId }}'
SmoothStreaming: '{{ SmoothStreaming }}'
TargetOriginId: '{{ TargetOriginId }}'
TrustedKeyGroups:
- '{{ TrustedKeyGroups[0] }}'
TrustedSigners:
- '{{ TrustedSigners[0] }}'
ViewerProtocolPolicy: '{{ ViewerProtocolPolicy }}'
Comment: '{{ Comment }}'
ContinuousDeploymentPolicyId: '{{ ContinuousDeploymentPolicyId }}'
CustomErrorResponses:
- ErrorCachingMinTTL: null
ErrorCode: '{{ ErrorCode }}'
ResponseCode: '{{ ResponseCode }}'
ResponsePagePath: '{{ ResponsePagePath }}'
CustomOrigin:
DNSName: '{{ DNSName }}'
HTTPPort: '{{ HTTPPort }}'
HTTPSPort: '{{ HTTPSPort }}'
OriginProtocolPolicy: '{{ OriginProtocolPolicy }}'
OriginSSLProtocols:
- '{{ OriginSSLProtocols[0] }}'
DefaultCacheBehavior:
AllowedMethods:
- '{{ AllowedMethods[0] }}'
CachePolicyId: '{{ CachePolicyId }}'
CachedMethods:
- '{{ CachedMethods[0] }}'
Compress: '{{ Compress }}'
DefaultTTL: null
FieldLevelEncryptionId: '{{ FieldLevelEncryptionId }}'
ForwardedValues: null
FunctionAssociations:
- null
LambdaFunctionAssociations:
- null
MaxTTL: null
MinTTL: null
OriginRequestPolicyId: '{{ OriginRequestPolicyId }}'
RealtimeLogConfigArn: '{{ RealtimeLogConfigArn }}'
ResponseHeadersPolicyId: '{{ ResponseHeadersPolicyId }}'
SmoothStreaming: '{{ SmoothStreaming }}'
TargetOriginId: '{{ TargetOriginId }}'
TrustedKeyGroups:
- '{{ TrustedKeyGroups[0] }}'
TrustedSigners:
- '{{ TrustedSigners[0] }}'
ViewerProtocolPolicy: '{{ ViewerProtocolPolicy }}'
DefaultRootObject: '{{ DefaultRootObject }}'
Enabled: '{{ Enabled }}'
HttpVersion: '{{ HttpVersion }}'
IPV6Enabled: '{{ IPV6Enabled }}'
Logging:
Bucket: '{{ Bucket }}'
IncludeCookies: '{{ IncludeCookies }}'
Prefix: '{{ Prefix }}'
OriginGroups:
Items:
- FailoverCriteria:
StatusCodes:
Items:
- '{{ Items[0] }}'
Quantity: '{{ Quantity }}'
Id: '{{ Id }}'
Members:
Items:
- OriginId: '{{ OriginId }}'
Quantity: '{{ Quantity }}'
Quantity: '{{ Quantity }}'
Origins:
- ConnectionAttempts: '{{ ConnectionAttempts }}'
ConnectionTimeout: '{{ ConnectionTimeout }}'
CustomOriginConfig:
HTTPPort: '{{ HTTPPort }}'
HTTPSPort: '{{ HTTPSPort }}'
OriginKeepaliveTimeout: '{{ OriginKeepaliveTimeout }}'
OriginProtocolPolicy: '{{ OriginProtocolPolicy }}'
OriginReadTimeout: '{{ OriginReadTimeout }}'
OriginSSLProtocols:
- '{{ OriginSSLProtocols[0] }}'
DomainName: '{{ DomainName }}'
Id: '{{ Id }}'
OriginAccessControlId: '{{ OriginAccessControlId }}'
OriginCustomHeaders:
- HeaderName: '{{ HeaderName }}'
HeaderValue: '{{ HeaderValue }}'
OriginPath: '{{ OriginPath }}'
OriginShield:
Enabled: '{{ Enabled }}'
OriginShieldRegion: '{{ OriginShieldRegion }}'
S3OriginConfig:
OriginAccessIdentity: '{{ OriginAccessIdentity }}'
PriceClass: '{{ PriceClass }}'
Restrictions:
GeoRestriction:
Locations:
- '{{ Locations[0] }}'
RestrictionType: '{{ RestrictionType }}'
S3Origin:
DNSName: '{{ DNSName }}'
OriginAccessIdentity: '{{ OriginAccessIdentity }}'
Staging: '{{ Staging }}'
ViewerCertificate:
AcmCertificateArn: '{{ AcmCertificateArn }}'
CloudFrontDefaultCertificate: '{{ CloudFrontDefaultCertificate }}'
IamCertificateId: '{{ IamCertificateId }}'
MinimumProtocolVersion: '{{ MinimumProtocolVersion }}'
SslSupportMethod: '{{ SslSupportMethod }}'
WebACLId: '{{ WebACLId }}'
- name: Tags
value:
- Key: '{{ Key }}'
Value: '{{ Value }}'
DELETE
example
/*+ delete */
DELETE FROM aws.cloudfront.distributions
WHERE data__Identifier = '<Id>'
AND region = 'us-east-1';
Permissions
To operate on the distributions
resource, the following permissions are required:
Create
cloudfront:CreateDistribution,
cloudfront:CreateDistributionWithTags,
cloudfront:GetDistribution,
cloudfront:GetDistributionConfig,
cloudfront:TagResource
Delete
cloudfront:DeleteDistribution,
cloudfront:GetDistribution,
cloudfront:GetDistributionConfig
List
cloudfront:ListDistributions
Read
cloudfront:GetDistribution,
cloudfront:GetDistributionConfig
Update
cloudfront:GetDistribution,
cloudfront:GetDistributionConfig,
cloudfront:UpdateDistribution,
cloudfront:UpdateDistributionWithStagingConfig,
cloudfront:ListTagsForResource,
cloudfront:TagResource,
cloudfront:UntagResource