#!/bin/sh -eu export AWS_PAGER="" aws ec2 describe-iam-instance-profile-associations --filters "Name=instance-id,Values=$1" \ | jq -r '.IamInstanceProfileAssociations[0].AssociationId' \ | xargs -n 1 aws ec2 disassociate-iam-instance-profile --association-id