Skip to main content

CloudFront Sites

CI/CD and drift detection with CloudFront Sites.

  1. Github project: dinghydev/dinghy-showcases-cloudfrontsites
  2. Deployed Site: https://cloudfront-site-demo.dinghy.dev/

Features

  • Simplifies the deployment of static websites using AWS CloudFront and S3 with minimal configuration
  • Provides secure and scalable hosting with integrated HTTPS using AWS ACM certificates
  • Supports the multiple SSL certificates and certificate rotation workflow
  • Automatically configures Route53 DNS records for custom domain support
  • Supports redirection from alternate domains or custom paths
  • Supports uploading static files to S3 buckets with customizable cache-control headers and MIME type settings
  • Manages S3 bucket permissions and logging for security and compliance
  • Enables CI/CD pipeline for site updates and supports drift detection for infrastructure consistency
  • Generates clear Terraform code and visual infrastructure diagrams as output

Source Code

import { MoveToHere } from '@dinghy/base-components'
import { AwsStack } from '@dinghy/tf-aws'
import { CloudfrontSites } from '@dinghy/tf-aws/cloudfront'

export default () => (
<AwsStack infrastructure={<MoveToHere includes='AwsRoute53Zone' />}>
<CloudfrontSites />
</AwsStack>
)

Outputs

Resource types

List of resource types used by this stack, in approximate order of creation:

  1. aws_s3_bucket
  2. aws_s3_bucket_versioning
  3. aws_s3_bucket_logging
  4. aws_s3_bucket_policy
  5. aws_s3_bucket_ownership_controls
  6. aws_s3_object
  7. data.aws_caller_identity
  8. data.aws_route53_zone
  9. aws_acm_certificate
  10. aws_route53_record
  11. aws_route53_record
  12. aws_cloudfront_function
  13. aws_cloudfront_distribution
  14. aws_cloudfront_origin_access_control

Workflows

CI/CD

Github CI/CD workflow: cicd

Sample Screenshot

Drift Detection

Github Drift Detection workflow with manual approval to deploy: drift-detection

Sample Drift Detection Screenshot

When drift is detected, a Manual Approval Issue will be created, allowing you to manually trigger the correction workflow:

After you add the approved-deployment label to the issue, the Drift Correction workflow will be triggered:

After the correction workflow completes successfully, it will automatically close the associated issue: