CloudFront
Bases: DuploResourceV3
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
Commands
apply
Apply a CloudFront
Create or Update a CloudFront resource with Duplocloud cli.
Returns:
| Name | Type | Description |
|---|---|---|
message |
dict
|
Success message. |
Parameters:
--file, -f, --cli-input
--patches, --add, --remove, --copy, --replace, --test, --move
create
Create a CloudFront distribution.
Creates a new CloudFront distribution with the specified configuration.
Example cloudfront.yaml:
# Origin DomainName, Id, and TargetOriginId are replaced at test runtime
# with the actual S3 bucket domain created by TestS3.
UseOAIIdentity: true
DistributionConfig:
DefaultRootObject: index.html
Aliases:
Items: []
Quantity: 0
ViewerCertificate:
CloudFrontDefaultCertificate: true
Origins:
Items:
- DomainName: placeholder.s3.amazonaws.com
Id: placeholder.s3.amazonaws.com
S3OriginConfig:
OriginAccessIdentity: ""
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: placeholder.s3.amazonaws.com
# CachingOptimized managed policy — works for S3 origins without requiring ForwardedValues/MinTTL
CachePolicyId: 658327ea-f89d-4fab-a63d-7e88639e58f6
Comment: duplo-cloudfront
CorsAllowedHostNames: []
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. |
Model: AmazonCloudFrontRequest
{
"description": "AmazonCloudFrontRequest",
"properties": {},
"title": "AmazonCloudFrontRequest",
"type": "object"
}
Parameters:
--file, -f, --cli-input
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.
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. |
Parameters:
distribution_id
positional
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.
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. |
Parameters:
distribution_id
positional
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.
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. |
Parameters:
distribution_id
positional
find
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.
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. |
Parameters:
distribution_id
positional
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:
# Origin DomainName, Id, and TargetOriginId are replaced at test runtime
# with the actual S3 bucket domain created by TestS3.
UseOAIIdentity: 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: 658327ea-f89d-4fab-a63d-7e88639e58f6
Compress: true
FieldLevelEncryptionId: ""
FunctionAssociations:
Items: []
Quantity: 0
LambdaFunctionAssociations:
Items: []
Quantity: 0
SmoothStreaming: false
TargetOriginId: placeholder.s3.amazonaws.com
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: placeholder.s3.amazonaws.com
Id: placeholder.s3.amazonaws.com
OriginAccessControlId: ""
OriginPath: ""
OriginShield:
Enabled: false
S3OriginConfig:
OriginAccessIdentity: ""
Quantity: 1
PriceClass:
Value: PriceClass_All
Restrictions:
GeoRestriction:
Items: []
Quantity: 0
RestrictionType:
Value: none
Staging: false
ViewerCertificate:
CloudFrontDefaultCertificate: true
MinimumProtocolVersion:
Value: TLSv1
WebACLId: ""
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. |
Model: AmazonCloudFrontRequest
{
"description": "AmazonCloudFrontRequest",
"properties": {},
"title": "AmazonCloudFrontRequest",
"type": "object"
}
Parameters:
--file, -f, --cli-input