Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

290
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda