Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

298
Vistas
How do I list tags for all roles using AWS CLI

I would like to list tags for all of my roles within IAM.

aws iam list-role-tags --role-name role123 will only list tags for single role.

aws iam list-roles will list all the roles.

How do I concatenate these two cli commands to list all the tags in all roles?

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

You can do this with the following shell script:

# Get all role names as text
roles=$(aws iam list-roles \
        --query 'Roles[*].RoleName' \
        --output text)

# Loop through role names and get tags
for role in $roles
do
    aws iam list-role-tags --role-name $role
done

If the respective role's tag lists were too long and got truncated you would have to do some extra work. But I think this is a good starting point.

over 4 years ago · Santiago Trujillo Denunciar

0

Or if you just want to grab Tags and single-line command then try this

for rolename in $(aws iam list-roles --query 'Roles[*].RoleName' --output text);do aws iam list-role-tags --role-name $rolename --query "Tags";done

Output

[
    {
        "Key": "Name",
        "Value": "test"
    }
]
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda