EC2 / Client / replace_iam_instance_profile_association

replace_iam_instance_profile_association#

EC2.Client.replace_iam_instance_profile_association(**kwargs)#

Replaces an IAM instance profile for the specified running instance. You can use this action to change the IAM instance profile that’s associated with an instance without having to disassociate the existing IAM instance profile first.

Use DescribeIamInstanceProfileAssociations to get the association ID.

See also: AWS API Documentation

Request Syntax

response = client.replace_iam_instance_profile_association(
    IamInstanceProfile={
        'Arn': 'string',
        'Name': 'string'
    },
    AssociationId='string'
)
Parameters:
  • IamInstanceProfile (dict) –

    [REQUIRED]

    The IAM instance profile.

    • Arn (string) –

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

    • Name (string) –

      The name of the instance profile.

  • AssociationId (string) –

    [REQUIRED]

    The ID of the existing 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.