CLI script to create temporary AWS credentials based on EKS IAM Roles for Service Accounts for tools which can't be easily migrated to a newer AWS SDK.
# set AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY and AWS_SESSION_TOKEN environment variable,
# based on the IAM Role referenced in the Kubernetes Service Account.
eval $(awstokengen)
./yourTool # now uses environment variables to authenticate against AWS.
Available CLI flags:
-exitNoEks (default=false)
if IAM Role for Service Accounts environment variables are not detected, exit without error-region (default=us-east-1)
AWS Region to make requests to-sessionName (default=new UUID())
if set will be used as role session name. Session Arn will be in format arn:aws:sts:::assumed-role/$AWS_ROLE_ARN/