CloudFront
Bases: DuploTenantResourceV3
Manage CloudFront Distributions
Configuring a CloudFront distributions in DuploCloud are content delivery network (CDN) configurations that help you improve the performance of your web applications.
See more details at: https://docs.duplocloud.com/docs/overview/aws-services/cloudfront
apply
Apply a CloudFront
Create or Update a CloudFront resource with Duplocloud cli.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
body
|
BODY
|
The resource to apply. |
required |
wait
|
WAIT
|
Wait for the resource to be created. |
False
|
patches
|
PATCHES
|
The patches to apply to the resource. |
None
|
Returns:
Name | Type | Description |
---|---|---|
message |
dict
|
Success message. |
create
Create a CloudFront distribution.
Creates a new CloudFront distribution with the specified configuration.
Example cloudfront.yaml:
UseOAIIdentity: true
DistributionConfig:
DefaultRootObject: "index.html"
Aliases:
Items: []
Quantity: 0
ViewerCertificate:
MinimumProtocolVersion:
Value: "TLSv1.2_2021"
ACMCertificateArn: ""
SSLSupportMethod:
Value: "sni-only"
Origins:
Items:
- DomainName: ""
Id: ""
Quantity: 1
CacheBehaviors:
Items: []
Quantity: 0
CustomErrorResponses:
Items: []
Quantity: 0
Logging:
Enabled: false
DefaultCacheBehavior:
ViewerProtocolPolicy:
Value: "redirect-to-https"
LambdaFunctionAssociations:
Items: []
Quantity: 0
Compress: true
TargetOriginId: ""
CachePolicyId: ""
Comment: "duplo-cloudfront"
CorsAllowedHostNames: []
Parameters:
Name | Type | Description | Default |
---|---|---|---|
body
|
BODY
|
The distribution configuration including origins, behaviors, and other settings. |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
The created distribution details including the distribution ID. |
Raises:
Type | Description |
---|---|
DuploError
|
If the distribution could not be created or the configuration is invalid. |
DuploFailedResource
|
If the distribution creation process fails. |
delete
Delete a CloudFront distribution.
Permanently removes a CloudFront distribution. This operation is irreversible and will remove all distribution settings and cached content. The distribution must be disabled before it can be deleted.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
distribution_id
|
DISTRIBUTION_ID
|
The ID of the CloudFront distribution to delete. |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
Success message confirming the deletion. |
Raises:
Type | Description |
---|---|
DuploError
|
If the distribution could not be deleted or is not in a deletable state. |
disable
Disable a CloudFront distribution.
Disables content delivery for a CloudFront distribution. When disabled, the distribution will stop serving content but will retain its configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
distribution_id
|
DISTRIBUTION_ID
|
The ID of the CloudFront distribution to disable. |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
The updated distribution details. |
Raises:
Type | Description |
---|---|
DuploError
|
If the distribution could not be disabled. |
DuploFailedResource
|
If the disable process fails. |
enable
Enable a CloudFront distribution.
Enables content delivery for a previously disabled CloudFront distribution. When enabled, the distribution will start serving content using its current configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
distribution_id
|
DISTRIBUTION_ID
|
The ID of the CloudFront distribution to enable. |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
The updated distribution details. |
Raises:
Type | Description |
---|---|
DuploError
|
If the distribution could not be enabled. |
DuploFailedResource
|
If the enable process fails. |
find
Find a CloudFront distribution.
Find a CloudFront distribution by its distribution ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
distribution_id
|
DISTRIBUTION_ID
|
The CloudFront distribution ID. |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
The service object. |
get_status
Get the current status of a CloudFront distribution.
Retrieves the current deployment status of a CloudFront distribution. The status indicates whether the distribution is deployed, in progress, or in an error state.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
distribution_id
|
DISTRIBUTION_ID
|
The ID of the CloudFront distribution to check. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
The current status of the distribution (e.g., 'Deployed', 'InProgress'). |
Raises:
Type | Description |
---|---|
DuploError
|
If the distribution could not be found or the status is unavailable. |
list
Retrieve a List of CloudFront resources
Returns:
Name | Type | Description |
---|---|---|
list |
list
|
A list of CloudFront. |
update
Update a CloudFront distribution.
Updates an existing CloudFront distribution with new configuration settings.
Example cloudfront.yaml:
UseOAIIdentity: true
ProcessS3OriginPolicy: true
Id:
DistributionConfig:
Aliases:
Items: []
Quantity: 0
CacheBehaviors:
Items: []
Quantity: 0
CallerReference:
Comment: duplo-cloudfront
ContinuousDeploymentPolicyId: ""
CustomErrorResponses:
Items: []
Quantity: 0
DefaultCacheBehavior:
AllowedMethods:
CachedMethods:
Items:
- HEAD
- GET
Quantity: 2
Items:
- HEAD
- GET
Quantity: 2
CachePolicyId: ""
Compress: true
FieldLevelEncryptionId: ""
FunctionAssociations:
Items: []
Quantity: 0
LambdaFunctionAssociations:
Items: []
Quantity: 0
SmoothStreaming: false
TargetOriginId:
TrustedKeyGroups:
Enabled: false
Items: []
Quantity: 0
TrustedSigners:
Enabled: false
Items: []
Quantity: 0
ViewerProtocolPolicy:
Value: redirect-to-https
DefaultRootObject: main.html
Enabled: true
HttpVersion:
Value: http2
IsIPV6Enabled: true
Logging:
Bucket: ""
Enabled: false
IncludeCookies: false
Prefix: ""
OriginGroups:
Items: []
Quantity: 0
Origins:
Items:
- ConnectionAttempts: 3
ConnectionTimeout: 10
CustomHeaders:
Items: []
Quantity: 0
DomainName: ""
Id: ""
OriginAccessControlId: ""
OriginPath: ""
OriginShield:
Enabled: false
S3OriginConfig:
OriginAccessIdentity: ""
Quantity: 1
PriceClass:
Value: PriceClass_All
Restrictions:
GeoRestriction:
Items: []
Quantity: 0
RestrictionType:
Value: none
Staging: false
ViewerCertificate:
ACMCertificateArn: ""
Certificate: ""
CertificateSource:
Value: acm
CloudFrontDefaultCertificate: false
MinimumProtocolVersion:
Value: TLSv1.2_2021
SSLSupportMethod:
Value: sni-only
WebACLId: ""
Parameters:
Name | Type | Description | Default |
---|---|---|---|
body
|
BODY
|
The updated distribution configuration. |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
The updated distribution details. |
Raises:
Type | Description |
---|---|
DuploError
|
If the distribution could not be updated or the configuration is invalid. |
DuploFailedResource
|
If the update process fails. |