I'm receiving the following error message on my Amazon Elastic Compute Cloud (Amazon EC2) instance while updating the instance profile:
"The association iip-assoc-xxxxxxxx is not the active association"
How do I resolve this error?
This error usually occurs when you attempt to update the instance profile while a previous disassociation is still unfulfilled by the API. You can use the AWS Command Line Interface (AWS CLI) to identify if an unfulfilled disassociation is causing the error, and to correct the issue.
Note: If you receive errors when running AWS CLI commands, make sure that you’re using the most recent version of the AWS CLI.
1. Run the following command to identify the instance profile associations for the instance:
aws ec2 describe-iam-instance-profile-associations --filters "Name=instance-id,Values=i-xxxxxxxxxxxxxxxxx"
The command output has multiple associations, each with a unique association ID (AssociationID) and status (State). Some of the associations are in the associating state and some are in the disassociating state, as shown in the following example output:
2. Run the following command to disassociate all the association IDs, including those in associating and disassociating states. Replace iip-assoc-xxxxxxxxxxxxxxxxxx with the appropriate association-id.
aws ec2 disassociate-iam-instance-profile --association-id iip-assoc-xxxxxxxxxxxxxxxxxx
3. After disassociating all association IDs, try updating the instance profile again.
Note: If the error persists after following the resolution steps, stop and start the instance. Then, run the disassociate-iam-instance-profile command again. Be aware that data stored in instance store volumes is lost when you stop the instance. Before stopping the instance, review the list of the effects of stopping an instance.
Using instance profiles
How do I attach or replace an instance profile on an Amazon EC2 instance?