how to add iam role to running ec2 instance code example
Example: aws cli ec2 how to change IAM role
$aws ec2 replace-iam-instance-profile-association --association-id YourCurrentAssociation-id --iam-instance-profile Name=YourReplacementRole-Instance-Profile