Skip to main content

CloudDuck Icon

CloudDuck is a CDK construct for simple and easy-to-use analysis environment for S3 data, featuring DuckDB with built-in authentication.

By simply deploying the Construct, you can launch a SaaS that provides an analytics dashboard like the one shown below. User authentication for access is implemented using Cognito, ensuring that only authorized users can log in.

CloudDuck Display Image

View on Construct Hub Open in Visual Studio Code npm version Build Status Release Status License Downloads npm downloads

Detailed information

Table of Contents

Use Cases

  • When you want to request data analysis on S3 using DuckDB but prefer not to issue S3 access credentials to the analysts.
  • When you want to minimize the costs incurred from downloading large amounts of S3 data to local storage.

Architecture

Architecture

Installation

npm i cloud-duck

Setup

Deploy

You can deploy the CloudDuck with the following code in the CDK stack.

import { CloudDuck } from 'cloud-duck';
import { Size } from 'aws-cdk-lib';
import * as cognito from 'aws-cdk-lib/aws-cognito';

declare const logBucket: s3.IBucket;

new CloudDuck(this, 'CloudDuck', {
  // The S3 bucket to analyze
  // CloudDuck can access to all of the buckets in the account by default.
  // If you want to restrict the access, you can use the targetBuckets property.
  targetBuckets: [logBucket],
  // The memory size of the Lambda function
  // Default: 1024 MB
  memory: Size.mebibytes(1024),
  // You can customize the Cognito User Pool
  // For example, you can force the user to use MFA.
  userPoolPlpos: {
    mfa: cognito.Mfa.REQUIRED,
    mfaSecondFactor: {
      sms: false,
      otp: true,
    },
  },
});

Add user to the Cognito User Pool

Add a user to the Cognito User Pool with the following command.

aws cognito-idp admin-create-user \
--user-pool-id "us-east-1_XXXXX" \
--username "naonao@example.com" \
--user-attributes Name=email,Value="naonao@example.com" Name=email_verified,Value=true \
--message-action SUPPRESS \
--temporary-password Password1!

You can also add a user via the AWS Management Console.

Access

Access to the CloudDuck with the cloudfront URL.

❯ npx cdk deploy
...
AwsStack.CloudDuckDistributionUrl84FC8296 = https://dosjykpv096qr.cloudfront.net
Stack ARN:
arn:aws:cloudformation:us-east-1:123456789012:stack/AwsStack/dd0960c0-b3d5-11ef-bcfc-12cf7722116f

✨  Total time: 73.59s

Enter the username and password.

Login

When you log in at the first time, you need to change the password.

Change Password

Play with the CloudDuck!

CloudDuck

Usage

Query

You can query the S3 data with SQL.

SELECT * FROM read_csv_auto('s3://your-bucket-name/your-file.csv');
SELECT * FROM parquet_scan('s3://your-bucket-name/your-file.parquet');

Ofcourse, you can store the result as a new table.

CREATE TABLE new_table AS SELECT * FROM read_csv_auto('s3://your-bucket-name/your-file.csv');

Detail usage of DuckDB is available at DuckDB Documentation.

Persistence

All query results are persisted in individual DuckDB files for each user. Therefore, you can freely save your query results without worrying about affecting other users.

Note

CloudDuck is still under development. Updates may include breaking changes. If you encounter any bugs, please report them via issues.

Metadata

Release files for cloud-duck 0.0.29

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cloud-duck 0.0.29
File Size Uploaded Provenance Actions
cloud_duck-0.0.29.tar.gz 54.0 MB Without provenance Details for cloud_duck-0.0.29.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cloud-duck 0.0.29
File Interpreter ABI Platform Actions
cloud_duck-0.0.29-py3-none-any.whl Python 3 none any Details for cloud_duck-0.0.29-py3-none-any.whl

Total release size: 107.9 MB

Release files / cloud_duck-0.0.29.tar.gz

Download URL cloud_duck-0.0.29.tar.gz
Size 54.0 MB
Tags Source
SHA-256 checksum
How to use checksums
82037f5755230d140a7aa17ea184ef816bc11ecdf25360431e24feec0444d71b
BLAKE2b-256 checksum
How to use checksums
d1833f54e28a7af4d48259d6d1837b546a208daf67974e8f260cc99576d14dd8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.14.7

Release files / cloud_duck-0.0.29-py3-none-any.whl

Download URL cloud_duck-0.0.29-py3-none-any.whl
Size 54.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
a8f1b56eb49c6a8c517447c3295009ccba73ca9f99f490f8ed7b2a388f1a7eb8
BLAKE2b-256 checksum
How to use checksums
9d0adebe43e16410be49b228ad3e952cdbc3cb35fdc43cd9cc53fbaef747abcf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.14.7

Security for cloud-duck 0.0.29

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.29 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page