The Simplest Way to Make AWS Backup and Longhorn Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Using aws backup and longhorn together keeps your Kubernetes volume data safe in the cloud. Longhorn writes block snapshots to an object bucket, and AWS Backup protects that bucket. This workflow bridges local cluster storage and cloud recovery rules. Your team gets fast local restores from Longhorn and long-term cloud retention from AWS. You do not need custom scripts to move volume data off your nodes. How data and roles flow between aws backup and longhorn Longhorn runs inside your Kubern

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Using aws backup and longhorn together keeps your Kubernetes volume data safe in the cloud. Longhorn writes block snapshots to an object bucket, and AWS Backup protects that bucket.

This workflow bridges local cluster storage and cloud recovery rules. Your team gets fast local restores from Longhorn and long-term cloud retention from AWS. You do not need custom scripts to move volume data off your nodes.

How data and roles flow between aws backup and longhorn

Longhorn runs inside your Kubernetes cluster and manages block storage across your worker nodes. When you set up a backup target, Longhorn sends volume snapshots to Amazon S3. It only sends the blocks that changed since the last snapshot.

To write to the bucket, Longhorn needs an AWS identity with bucket permissions. The best method is to link a Kubernetes service account to an IAM role. This setup uses short-lived tokens instead of static keys stored in cluster secrets.

Once Longhorn writes the blocks to S3, AWS Backup takes over the cloud protection. AWS Backup reads the S3 bucket and copies the snapshot objects into a vault. You can set a schedule in AWS to run these vault copies every day.

This two-step flow separates cluster duties from cloud security duties. Platform engineers control snapshot schedules inside Kubernetes for fast app rollbacks. Cloud admins control vault lock rules and retention schedules inside the AWS account.

Common failure modes and how to scope access

Many teams fail by using one shared IAM user with broad S3 permissions. If an attacker reads that static key from the cluster, they can delete backups. They can also read data from other buckets in the same AWS account.

Another common issue happens when bucket versioning is turned off. AWS Backup needs S3 versioning to track and restore objects to a specific point. Without versioning, a broken Longhorn sync can overwrite good blocks in the bucket.

AWS IAM Policies + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Unlogged access to the S3 bucket or Kubernetes API also creates blind spots. When an engineer runs a manual restore or deletes old snapshots, teams lack records. You need clear logs that show which person ran each storage command.

To fix the role scope, limit the Longhorn IAM role to one bucket prefix. Give it permission to read, write, and list objects only under that path. Deny the Longhorn role any access to the AWS Backup vault itself.

Next, lock down the network path between your worker nodes and the cloud. Use a private VPC endpoint for S3 so snapshot traffic stays off the internet. Add a bucket policy that rejects requests coming from outside that private endpoint.

Testing your restore path before an outage

A backup setup only works if your team can restore data under pressure. You must test both the local Longhorn restore and the full vault recovery. Run these drills in a staging cluster on a regular calendar schedule.

For a normal app rollback, Longhorn pulls blocks straight from the active S3 bucket. If that bucket gets wiped, AWS Backup restores the objects to a new bucket. You then point Longhorn to the restored bucket and rebuild your cluster volumes.

Keep human access to your Kubernetes cluster and cloud CLI under strict rules. Engineers who run restore tests should use their own named accounts for every step. Clear audit trails help you pass security checks and spot mistakes during drills.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Can AWS Backup talk directly to Longhorn volumes on worker nodes?

No, AWS Backup cannot read raw Longhorn block devices on your cluster nodes. Longhorn must first push snapshots to an S3 bucket that AWS Backup protects.

What happens if someone deletes a file in the Longhorn S3 bucket?

You can restore the missing objects from the AWS Backup vault to S3. Once the objects return to the bucket, Longhorn can read the backup volume again.

How should Longhorn log in to AWS without static access keys?

Assign an IAM role directly to the Longhorn Kubernetes service account. AWS will issue short-lived tokens to the Longhorn pods so you avoid static keys.

The query runs. The emails stay hidden.