AWS006 - AWS Refused the Agent's Web Identity
Uploading.Agent error code #AWS006 indicates that the integration uses the agent's own AWS identity, the agent found a web identity token (EKS IRSA), and AWS refused to exchange it for the role. The token was presented, so this is not #AWS005 (no identity at all).. It is also not a permissions problem on the role (#AWS002): AWS never got as far as the role's EC2 policy.
AWS reports this as AccessDenied, InvalidIdentityToken or ExpiredTokenException on the AssumeRoleWithWebIdentity call, which is worth knowing if you are correlating against CloudTrail.
Common causes include:
aud condition is not sts.amazonaws.com
The projected service account token has expired and the kubelet stopped refreshing it
Steps to Resolve
Check the Trust Policy
eks.amazonaws.com/role-arn annotation
Open Trust relationships
Confirm the Federated principal is the cluster's OIDC provider (oidc.eks.<region>.amazonaws.com/id/<id>)
Confirm the sub condition is system:serviceaccount:<namespace>:<service account> for the agent's pod, and aud is sts.amazonaws.com
Confirm the OIDC Provider Exists
aws eks describe-cluster --name <cluster> --query cluster.identity.oidc.issuer to get the issuer URL
In IAM > Identity providers, confirm a provider with that URL is listed. If it is not, create it
Verify From the Agent Pod
kubectl exec -n <namespace> <agent pod> -- aws sts get-caller-identity
A working setup prints the role's ARN. An AssumeRoleWithWebIdentity error is this fault, and its message says which check failed.