Deployment guide

DuckDB

Overview

DuckDB is a fast, in-process analytical database designed for complex queries over large datasets. It is optimized for Online Analytical Processing (OLAP) workloads and can query CSV, Parquet and JSON files directly.

This SecureAnyCloud AMI from the AWS Marketplace gives you DuckDB on Linux, ready for analytical work as soon as the instance boots.

What you get:

  • The DuckDB executable at /apps/duckdb
  • A host ready for analytical workloads and data processing
  • An OS package update script that keeps the system current
  • AWS CLI v2 for AWS service integration
  • Systems Manager Agent (SSM) for remote management
  • CloudWatch Agent for monitoring
  • Latest security patches applied at build time
  • 24/7 SecureAnyCloud support with a guaranteed 24-hour response SLA

Prerequisites

Before you launch this AMI, make sure you have:

  • An active AWS account
  • An active subscription to the DuckDB listing on AWS Marketplace
  • An EC2 key pair for SSH access
  • Familiarity with EC2 instance management and SSH

Recommended instance type: t3.large (2 vCPU, 8 GB RAM) or larger for analytical workloads. The minimum requirements are 1 vCPU, 1 GB RAM and 20 GB of disk space. DuckDB performance scales well with additional memory and CPU.

1

Launch the AMI

  • Open the AWS Marketplace and search for "DuckDB SecureAnyCloud".
  • Select Continue to Subscribe, accept the terms, then select Continue to Configuration.
  • Choose your Region and Software Version.
  • Select Continue to Launch.
  • Choose Launch through EC2 for full control over instance configuration.
  • Select your instance type (t3.large is recommended).
  • Configure storage with at least 20 GB of gp3. Increase it for large datasets.
  • Configure your Security Group with one inbound rule: port 22, TCP, source your IP address, for SSH access.
  • Select your EC2 key pair and launch the instance.
2

Connect over SSH

Wait until the instance is running and has passed both status checks (2/2). Then connect over SSH:

ssh -i your-key.pem ec2-user@<public-ip-address>

To switch to the root user, run:

sudo su -
3

Launch DuckDB

The DuckDB executable is at /apps/duckdb/duckdb. Start the interactive CLI:

/apps/duckdb/duckdb

At the DuckDB prompt you can run SQL queries directly.

Use an in-memory database (the default):

SELECT 'Hello from DuckDB on AWS!' AS message;

Create a persistent database:

/apps/duckdb/duckdb /apps/duckdb/mydata.db

Working with DuckDB

Create a table and insert data:

CREATE TABLE sales ( id INTEGER, product VARCHAR, amount DECIMAL(10,2), sale_date DATE ); INSERT INTO sales VALUES (1, 'Widget A', 29.99, '2024-01-15'), (2, 'Widget B', 49.99, '2024-01-16'), (3, 'Widget A', 29.99, '2024-01-17'); SELECT product, SUM(amount) as total_revenue, COUNT(*) as num_sales FROM sales GROUP BY product ORDER BY total_revenue DESC;

Query a CSV file directly:

SELECT * FROM read_csv_auto('/path/to/data.csv');

Query a Parquet file:

SELECT * FROM read_parquet('/path/to/data.parquet');

Query a JSON file:

SELECT * FROM read_json_auto('/path/to/data.json');

Query a file directly from S3:

SELECT * FROM read_parquet('s3://your-bucket/data.parquet');

Export query results to CSV:

COPY (SELECT * FROM sales) TO '/tmp/sales_export.csv' (HEADER, DELIMITER ',');

Export query results to Parquet:

COPY (SELECT * FROM sales) TO '/tmp/sales_export.parquet' (FORMAT PARQUET);

Server Components

DuckDB is installed at /apps/duckdb.

Note: The automatic OS package update script may update component versions on first boot.

Filesystem Layout

The image uses these mount points:

  • / (38 GB): root filesystem
  • /boot (2 GB): operating system kernel files
  • /apps (9.8 GB): DuckDB installation directory

Key directories:

  • /apps/duckdb: DuckDB installation and executable
  • /apps/duckdb/duckdb: DuckDB binary executable

Scripts and Log Files

Both files are in /stage/scripts:

  • initial_boot_update.sh: updates the OS with the latest packages on first boot
  • initial_boot_update.log: output log for the boot update script

On Startup

An OS package update script runs on first boot so the image is fully up to date. To disable it, remove the script and its crontab entry:

rm -f /stage/scripts/initial_boot_update.sh crontab -e
# Delete the following line, save and exit: @reboot /stage/scripts/initial_boot_update.sh

Troubleshooting

DuckDB command not found

  • Use the full path: /apps/duckdb/duckdb.
  • Or add it to your PATH: export PATH=$PATH:/apps/duckdb.
  • Verify that the binary exists: ls -la /apps/duckdb/duckdb.

Out of memory when querying large datasets

  • DuckDB processes data in memory, so move to a larger instance type.
  • Set an explicit memory limit with PRAGMA memory_limit='4GB';.
  • Process data in smaller batches with LIMIT and OFFSET.

Cannot read S3 files

  • Make sure the instance has an IAM role with S3 read access.
  • Or set credentials in DuckDB: sql SET s3_region='us-east-1'; SET s3_access_key_id='your-key'; SET s3_secret_access_key='your-secret';

Permission denied on database file

  • Check file ownership and permissions.
  • Make sure the user has write access to the directory.
  • Try creating the database in a different location: /tmp/test.db.

Security Recommendations

  • Restrict SSH access. Allow port 22 only from trusted IP addresses.
  • Use IAM roles for S3 access. Avoid storing AWS credentials on the instance.
  • Protect database files. Set appropriate file permissions on persistent database files.
  • Keep DuckDB updated. Check for new versions that include security fixes.
  • Keep the OS patched. Apply the latest security updates.
  • Back up your data. Back up database files to S3 on a regular schedule.

Support

If you run into any issue with this product, contact SecureAnyCloud support:

  • Email: sales@secureanycloud.com
  • Website: secureanycloud.com
  • Support hours: 24/7 with a guaranteed 24-hour response SLA

Deploy on AWS

Launch DuckDB with 24/7 support from SecureAnyCloud.

View on Marketplace

Need Help?

Our support team is available 24/7.

sales@secureanycloud.com