disassociate_iam_instance_profile

disassociate_iam_instance_profile(**kwargs)

Disassociates an IAM instance profile from a running or stopped instance.

Use DescribeIamInstanceProfileAssociations to get the association ID.

See also: AWS API Documentation

Request Syntax

response = client.disassociate_iam_instance_profile(
    AssociationId='string'
)
Parameters
AssociationId (string) --

[REQUIRED]

The ID of the IAM instance profile association.

Return type
dict
Returns
Response Syntax
{
    'IamInstanceProfileAssociation': {
        'AssociationId': 'string',
        'InstanceId': 'string',
        'IamInstanceProfile': {
            'Arn': 'string',
            'Id': 'string'
        },
        'State': 'associating'|'associated'|'disassociating'|'disassociated',
        'Timestamp': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --
    • IamInstanceProfileAssociation (dict) --

      Information about the IAM instance profile association.

      • AssociationId (string) --

        The ID of the association.

      • InstanceId (string) --

        The ID of the instance.

      • IamInstanceProfile (dict) --

        The IAM instance profile.

        • Arn (string) --

          The Amazon Resource Name (ARN) of the instance profile.

        • Id (string) --

          The ID of the instance profile.

      • State (string) --

        The state of the association.

      • Timestamp (datetime) --

        The time the IAM instance profile was associated with the instance.

Examples

This example disassociates the specified IAM instance profile from an instance.

response = client.disassociate_iam_instance_profile(
    AssociationId='iip-assoc-05020b59952902f5f',
)

print(response)

Expected Output:

{
    'IamInstanceProfileAssociation': {
        'AssociationId': 'iip-assoc-05020b59952902f5f',
        'IamInstanceProfile': {
            'Arn': 'arn:aws:iam::123456789012:instance-profile/admin-role',
            'Id': 'AIPAI5IVIHMFFYY2DKV5Y',
        },
        'InstanceId': 'i-123456789abcde123',
        'State': 'disassociating',
    },
    'ResponseMetadata': {
        '...': '...',
    },
}