by Samyak Kathane, Raja Pamuluri, and Venkat Penmetsa – 01 OCT 2025
Categories: Amazon EFS, Amazon EKS, Expert (400), Technical How-to | Permalink | Comments
Organizations increasingly adopt multi-account AWS strategies for stronger security, governance, and operational efficiency. With Amazon EFS you can flexibly share POSIX files across accounts and mount the same file system to multiple Amazon EKS clusters. This guide shows how to set up cross-account mounts for one EFS file system in a shared services account and attach it to an EKS cluster in another account.
use1-az1) instead of AZ names (us-east-1a) to point to the same physical location across accounts.111111111111, File System ID: fs-0c492f870b90c1c9a.222222222222, cluster EKS-cross-account-cluster.EKS-cross-account-cluster and the appropriate Region.111111111111.us-west-1). VPC accepter: paste the EFS VPC ID (Step 2).111111111111, navigate to VPC > Peering connections.222222222222/sg-<cluster-sg-id> (Owner ID of the EKS account + the EKS cluster SG from Step 3).<availability-zone-id>.<file-system-id>.efs.<region>.amazonaws.comus-west-1 with AZ IDs usw1-az3 and usw1-az1:usw1-az3.fs-0c492f870b90c1c9a.efs.us-west-1.amazonaws.com → IP of mount target in usw1-az3usw1-az1.fs-0c492f870b90c1c9a.efs.us-west-1.amazonaws.com → IP of mount target in usw1-az1export EKS_ACCOUNT_ID=222222222222
export EFS_ACCOUNT_ID=111111111111
EFSCrossAccountAccessRole allowing the EKS account to assume it:cat > efs-cross-account-trust-policy.json <<'EOF'
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": { "AWS": "arn:aws:iam::222222222222:root" },
"Action": "sts:AssumeRole"
}
]
}
EOF
aws iam create-role \
--role-name EFSCrossAccountAccessRole \
--assume-role-policy-document file://efs-cross-account-trust-policy.json
curl -s https://raw.githubusercontent.com/kubernetes-sigs/aws-efs-csi-driver/master/examples/kubernetes/cross_account_mount/iam-policy-examples/describe-mount-target-example.json -o describe_mt.json
FS_ARN=$(aws efs describe-file-systems --file-system-id fs-0c492f870b90c1c9a --query 'FileSystems[].FileSystemArn' --output text)
sed -i "s#\"Resource\" : \"\\*\"#\"Resource\" : \"${FS_ARN}\"#g" describe_mt.json
aws iam create-policy --policy-name EFSDescribeMountTargetIAMPolicy --policy-document file://describe_mt.json
aws iam attach-role-policy \
--role-name EFSCrossAccountAccessRole \
--policy-arn arn:aws:iam::111111111111:policy/EFSDescribeMountTargetIAMPolicy
curl -sLO https://github.com/eksctl-io/eksctl/releases/latest/download/eksctl_Linux_amd64.tar.gz
tar -xzf eksctl_Linux_amd64.tar.gz -C /tmp
sudo mv /tmp/eksctl /usr/local/bin
aws eks update-kubeconfig --name EKS-cross-account-cluster --region us-west-1
eksctl utils associate-iam-oidc-provider \
--region us-west-1 \
--cluster EKS-cross-account-cluster \
--approve
export ROLE=AmazonEKS_EFS_CSI_DriverRole
eksctl create iamserviceaccount \
--name efs-csi-controller-sa \
--namespace kube-system \
--cluster EKS-cross-account-cluster \
--role-name $ROLE \
--attach-policy-arn arn:aws:iam::aws:policy/service-role/AmazonEFSCSIDriverPolicy \
--approve
aws iam attach-role-policy \
--role-name $ROLE \
--policy-arn arn:aws:iam::aws:policy/AmazonElasticFileSystemClientFullAccess
cat > allow-cross-account-assume-policy.json <<'EOF'
{
"Version": "2012-10-17",
"Statement": {
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Resource": "arn:aws:iam::111111111111:role/EFSCrossAccountAccessRole"
}
}
EOF
aws iam create-policy \
--policy-name AssumeCrossAccountEFSRole \
--policy-document file://allow-cross-account-assume-policy.json
aws iam attach-role-policy \
--role-name $ROLE \
--policy-arn arn:aws:iam::222222222222:policy/AssumeCrossAccountEFSRole
kubectl create secret generic x-account \
--namespace kube-system \
--from-literal=awsRoleArn="arn:aws:iam::111111111111:role/EFSCrossAccountAccessRole" \
--from-literal=crossaccount="true"
eksctl create addon \
--cluster EKS-cross-account-cluster \
--name aws-efs-csi-driver \
--service-account-role-arn arn:aws:iam::222222222222:role/${ROLE}
sc.yaml – StorageClass with cross-account mount enabled:apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: efs-sc
provisioner: efs.csi.aws.com
mountOptions:
- tls
- iam
- crossaccount # Enable cross-account mount
parameters:
provisioningMode: efs-ap
fileSystemId: fs-0c492f870b90c1c9a
directoryPerms: "700"
csi.storage.k8s.io/provisioner-secret-name: x-account
csi.storage.k8s.io/provisioner-secret-namespace: kube-system
app.yaml – sample PVC and Pod:apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: efs-claim
namespace: efs-demo
spec:
accessModes:
- ReadWriteMany
storageClassName: efs-sc
resources:
requests:
storage: 5Gi
---
apiVersion: v1
kind: Pod
metadata:
name: efs-app
namespace: efs-demo
spec:
containers:
- name: app
image: centos:7
command: ["/bin/sh"]
args: ["-c", "while true; do echo $(date -u) >> /data/out; sleep 5; done"]
volumeMounts:
- name: persistent-storage
mountPath: /data
volumes:
- name: persistent-storage
persistentVolumeClaim:
claimName: efs-claim
kubectl create namespace efs-demo
kubectl apply -f sc.yaml
kubectl apply -f app.yaml
kubectl get sc
kubectl get pvc -n efs-demo
kubectl get pv
kubectl get pod -n efs-demo
kubectl exec -it efs-app -n efs-demo -- cat /data/out
Cross-account mounting for Amazon EFS lets you share data safely across AWS accounts, maintaining isolation while collaborating effectively. With correct VPC peering, route tables, security groups, Route 53 DNS, IAM permissions, and the EFS CSI Driver, Amazon EKS clusters can access a shared EFS file system without duplicating data, optimizing cost and operations.
Samyak Kathane – Senior Solutions Architect specializing in AWS storage (Amazon EFS), helping customers build reliable, high-performance, cost-optimized systems.
Raja Pamuluri – Senior Storage Solutions Architect focused on the Energy sector, helping customers design and deploy large-scale cloud storage solutions.
Venkat Penmetsa – Senior Technical Account Manager specializing in Amazon EKS, helping customers operate and optimize Kubernetes on AWS.