--- title: Back up and restore your Amazon EKS cluster resources using Velero | Amazon Web Services type: raw source: newsletter source_url: https://aws.amazon.com/blogs/containers/back-up-and-restore-your-amazon-eks-cluster-resources-using-velero/ tags: [aws-china-blog, agentic-ai, context-engineering] ingested: 2026-05-20 sha256: ee01b2327662c1b2 --- Title: Back up and restore your Amazon EKS cluster resources using Velero | Amazon Web Services URL Source: https://aws.amazon.com/blogs/containers/back-up-and-restore-your-amazon-eks-cluster-resources-using-velero/ Published Time: 2026-05-12T18:19:57+00:00 Markdown Content: When you accidentally delete a production namespace or a cluster upgrade fails, rebuilding your Amazon Elastic Kubernetes Service (Amazon EKS) cluster resources means recreating every deployment, service, and persistent volume manually. With Velero, a backup and restore tool for Kubernetes, you capture resource definitions to Amazon Simple Storage Service (Amazon S3) and persistent volume data as Amazon Elastic Block Store (Amazon EBS) snapshots. Velero supports cross-cluster restores, namespace-level granularity, and portability across Kubernetes distributions. If you need centralized, fully managed backup scheduling instead, [AWS Backup for Amazon EKS](https://docs.aws.amazon.com/aws-backup/latest/devguide/whatisbackup.html) handles that for you. In this post, you’ll learn to back up and restore Amazon EKS cluster resources and persistent volume data using Velero. You’ll deploy a sample stateful application, back it up, and restore it to a different namespace within the same cluster. Along the way, you’ll configure least-privilege AWS Identity and Access Management (AWS IAM) roles using Amazon EKS Pod Identity and scope Velero’s Kubernetes permissions with a custom ClusterRole. A ClusterRole is a Kubernetes resource that defines cluster-wide permissions. ## Prerequisites You’ll spend 45 to 60 minutes on this tutorial and incur costs for Amazon S3 storage (based on data stored), Amazon EBS snapshots (based on snapshot storage), and Amazon EKS cluster usage (based on cluster runtime). For detailed pricing information, see Amazon S3 Pricing, Amazon EBS Pricing, and Amazon EKS Pricing. Clean up instructions at the end help you remove all billable resources. To complete this tutorial, make sure you have the following: * An active AWS account with permissions to create Amazon S3 buckets, IAM policies and roles, and Amazon EKS resources * An Amazon EKS cluster running Kubernetes 1.35 or later with [Amazon EKS Auto Mode](https://docs.aws.amazon.com/eks/latest/userguide/automode.html) enabled. Auto Mode automates networking, node provisioning and scaling. You can use eksctl to create this cluster – Refer steps [here](https://docs.aws.amazon.com/eks/latest/userguide/automode-get-started-eksctl.html) * [AWS CLI v2](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), [Helm v3.x](https://helm.sh/docs/intro/install/), and [kubectl](https://kubernetes.io/docs/tasks/tools/) installed and configured * Experience with [Kubernetes concepts](https://kubernetes.io/docs/concepts/) such as pods, deployments, and persistent volumes, and with [IAM roles](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html) The default Velero installation uses cluster-admin, which grants broad access to cluster resources. This tutorial replaces it with a least-privilege ClusterRole. Follow those steps for non-demo environments. ## Velero overview Velero is an open-source tool that backs up and restores Kubernetes cluster resources and persistent volumes. Unlike traditional backup solutions that require direct access to storage systems, Velero works through the Kubernetes API to discover and back up resources. This API-driven approach provides several advantages: * Kubernetes-native: Velero understands Kubernetes resources and their relationships * Flexible filtering: You can scope backups by namespace, resource type, or label * Cloud-agnostic: The same backup can be restored to different Kubernetes distributions * Snapshot integration: Velero integrates with cloud provider snapshot APIs for persistent volume backups An application-level backup in Amazon EKS targets two components: * Kubernetes objects and configurations stored in the EKS control plane * Application data stored in persistent volumes Refer to the Velero documentation for details on [resource filtering](https://velero.io/docs/main/resource-filtering/). **Backup and Restore Workflow** ![Image 1](https://d2908q01vomqb2.cloudfront.net/fe2ef495a1152561572949784c16bf23abb28057/2026/05/12/Velero.png) Velero uses a controller deployed as a Kubernetes Deployment to perform backup and restore tasks. A user submits a Backup manifest or Restore manifest (Custom Resource) to EKS, for the Velero controller to perform Backup or Restore. Velero documentation provides details on how they work [here](https://velero.io/docs/main/how-velero-works). ## Tutorial This tutorial uses Amazon EKS Auto Mode to simplify cluster management. Velero does not require Auto Mode and works on any Amazon EKS cluster. The walkthrough backs up an application in namespace `myprimary` and restores it to another namespace `myrestore` in the same cluster. ### Set up environment variables Substitute your cluster name and Region in the following exports. The tutorial references these variables in every subsequent step. ``` export CLUSTER_NAME=<> export AWS_REGION=<> export AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text --no-cli-pager) export BUCKET_NAME=velero-backups-$(date +%s) export POLICY_NAME=VeleroBackupPolicy export ROLE_NAME=VeleroBackupRole export AWS_PAGER="" ``` Shell ### Configure Amazon S3 and IAM First, provision the Amazon S3 bucket where Velero stores backup data. `aws s3 mb s3://${BUCKET_NAME} --region ${AWS_REGION}` Code Next, define an IAM policy granting Velero read/write access to the bucket and Amazon EBS snapshot permissions. ``` cat > velero-s3-policy.json < velero-trust-policy.json < velero-values.yaml < velero-cluster-role.yaml < snapshot-class.yaml < deployment-demo-app.yaml <> /data/out.txt; sleep 15; done"] env: - name: POD_NAMESPACE valueFrom: fieldRef: fieldPath: metadata.namespace resources: requests: cpu: "100m" volumeMounts: - name: persistent-storage mountPath: /data volumes: - name: persistent-storage persistentVolumeClaim: claimName: auto-ebs-claim EOF kubectl apply -f deployment-demo-app.yaml ``` PHP Verify the pod is running. Node provisioning by Amazon EKS might take a couple of minutes. ``` kubectl get po -n myprimary kubectl exec -n myprimary "$(kubectl get pods -n myprimary -l app=demo-stateful-app -o=jsonpath='{.items[0].metadata.name}')" -- cat /data/out.txt ``` CSS Define a Velero Backup custom resource for the myprimary namespace. This YAML scopes the backup to specific resource types and triggers Amazon EBS snapshots for persistent volumes. See the [Velero Backup API documentation](https://velero.io/docs/main/api-types/backup/) for filtering options. ``` cat > myprimary-backup.yaml < myprimary-restore.yaml <