Skip to content

describe_iam_instance_profile_associations

describe_iam_instance_profile_associations(
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    association_ids: Optional[AssociationIdList] = None,
    filters: Optional[FilterList] = None,
    max_results: Optional[DescribeIamInstanceProfileAssociationsMaxResults] = None,
    next_token: Optional[NextToken] = None,
) -> DescribeIamInstanceProfileAssociationsResult

Describes your IAM instance profile associations.

Parameters:

  • association_ids (Optional[AssociationIdList], default: None ) –

    The IAM instance profile associations.

  • filters (Optional[FilterList], default: None ) –

    The filters.

    • instance-id - The ID of the instance.

    • state - The state of the association (associating | associated | disassociating).

  • max_results (Optional[DescribeIamInstanceProfileAssociationsMaxResults], default: None ) –

    The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see Pagination.

  • next_token (Optional[NextToken], default: None ) –

    The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.

Raises:

Examples:

To describe an IAM instance profile association This example describes the specified IAM instance profile association.

>>> client.describe_iam_instance_profile_associations(association_ids=['iip-assoc-0db249b1f25fa24b8'])
Source code in docs_src/capo_ec2/_services/ec2.py
def describe_iam_instance_profile_associations(
    self,
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    association_ids: Optional[
        "capo_ec2.types.association_id_list.AssociationIdList"
    ] = None,
    filters: Optional["capo_ec2.types.filter_list.FilterList"] = None,
    max_results: Optional[
        "capo_ec2.types.describe_iam_instance_profile_associations_max_results.DescribeIamInstanceProfileAssociationsMaxResults"
    ] = None,
    next_token: Optional["capo_ec2.types.next_token.NextToken"] = None,
) -> "capo_ec2.types.describe_iam_instance_profile_associations_result.DescribeIamInstanceProfileAssociationsResult":
    """<p>Describes your IAM instance profile associations.</p>

    Args:
        association_ids: <p>The IAM instance profile associations.</p>
        filters: <p>The filters.</p> <ul> <li> <p> <code>instance-id</code> - The ID of the instance.</p> </li> <li> <p> <code>state</code> - The state of the association (<code>associating</code> | <code>associated</code> | <code>disassociating</code>).</p> </li> </ul>
        max_results: <p>The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html#api-pagination">Pagination</a>.</p>
        next_token: <p>The token returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.</p>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To describe an IAM instance profile association
        This example describes the specified IAM instance profile association.

        >>> client.describe_iam_instance_profile_associations(association_ids=['iip-assoc-0db249b1f25fa24b8'])
    """

    def _handler(
        req: "OperationRequest[capo_ec2.types.describe_iam_instance_profile_associations_request.DescribeIamInstanceProfileAssociationsRequest]",
    ) -> OperationResponse[
        "capo_ec2.types.describe_iam_instance_profile_associations_result.DescribeIamInstanceProfileAssociationsResult"
    ]:
        import capo_ec2._operations.amazon_ec2.describe_iam_instance_profile_associations

        output, http_response = (
            capo_ec2._operations.amazon_ec2.describe_iam_instance_profile_associations.describe_iam_instance_profile_associations(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DescribeIamInstanceProfileAssociations")
    )
    input_: capo_ec2.types.describe_iam_instance_profile_associations_request.DescribeIamInstanceProfileAssociationsRequest = {}
    if association_ids is not None:
        input_["association_ids"] = association_ids
    if filters is not None:
        input_["filters"] = filters
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output