Volume attach fails with `AttachVolume.Attach failed for volume "pvc-..." : rpc error: code = Internal desc = Could not attach volume ... UnauthorizedOperation: You are not authorized to perform this operation`.
IntermediateTroubleshootingStorage and volumes
Answer
Likely causes → The CSI controller's IAM role lacks ec2:AttachVolume, the volume is encrypted with a KMS key the role cannot use (kms:CreateGrant), or an SCP denies the call.
Diagnose →
kubectl get sa ebs-csi-controller-sa -n kube-system -o jsonpath='{.metadata.annotations}'
aws sts decode-authorization-message --encoded-message <msg-from-error> | jq -r .DecodedMessage | jq
Fix → Attach AmazonEBSCSIDriverPolicy, plus a KMS policy statement allowing kms:CreateGrant, kms:Decrypt, kms:GenerateDataKeyWithoutPlaintext on the CMK for the role.
Prevent → Keep the CSI role policy in IaC next to the KMS key definition.
More on Storage and volumes
A PVC is `Pending` with `no persistent volumes available for this claim and no storage class is set`.BeginnerA PVC sits `Pending` with event `waiting for first consumer to be created before binding`. Is something broken?BeginnerA PVC is stuck with `waiting for a volume to be created, either by external provisioner "ebs.csi.aws.com" or manually created by system administrator`.IntermediateA Pod is stuck `ContainerCreating` with `Multi-Attach error for volume "pvc-3f1c..." Volume is already exclusively attached to one node and can't be attached to another`.IntermediateA Deployment with one replica and an RWO PVC gets `Multi-Attach error` on every rollout.BeginnerA Pod fails with `MountVolume.MountDevice failed for volume "pvc-..." : rpc error: code = Internal desc = ... mount failed: exit status 32 ... wrong fs type, bad option, bad superblock`.Advanced