packerlabs/lab0/disassociate_role.sh

9 lines
263 B
Bash
Executable File

#!/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