Batch change passwords on multiple AWS accounts

for profile in $(grep "[" ~/.aws/credentials | tr -d '[|]'); \
do echo $profile; \
aws --profile $profile iam update-login-profile \
--user-name {{ user.name }} --no-password-reset-required \
--password "{{ password }}"; done
Actually it takes all profiles (accounts) from ~/.aws/credentials and changes the password on all of them one by one.
Replace {{ user.name }} and {{ password }} with your values.