Skip to content

Instantly share code, notes, and snippets.

@amlana21
amlana21 / aws-auth-config-map-utility.py
Created June 28, 2022 04:44 — forked from si3mshady/aws-auth-config-map-utility.py
generate aws auth configmap manifest that grants IAM users AWS Roles access to Kubernetes Cluster
import yaml, subprocess, json, re, sys
FILE_NAME = 'auth_config.yaml'
KUBERNETES_GROUP = 'system:masters'
cmd = f'kubectl get configmap aws-auth -n kube-system -o yaml > {FILE_NAME}'
MASTER_PARSER = '({["rolearn":"arn]+[:a-z0-9\/\w-]+"[,"\w\/-:{{{]*[-\w}}",:\[]*[\]]*})' #regex101