Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aws
GitHub Repository: aws/aws-cli
Path: blob/develop/awscli/examples/accessanalyzer/list-findings.rst
1567 views
**To retrieve a list of findings generated by the specified analyzer**

The following ``list-findings`` example retrieves a list of findings generated by the specified analyzer in your AWS account. This example filters the results to include only IAM roles whose name contains ``Cognito``. ::

    aws accessanalyzer list-findings \
        --analyzer-arn arn:aws:access-analyzer:us-west-2:111122223333:analyzer/ConsoleAnalyzer-account \
        --filter '{"resource": {"contains": ["Cognito"]}, "resourceType": {"eq": ["AWS::IAM::Role"]}}'

Output::

    {
        "findings": [
            {
                "id": "597f3bc2-3adc-4c18-9879-5c4b23485e46",
                "principal": {
                    "Federated": "cognito-identity.amazonaws.com"
                },
                "action": [
                    "sts:AssumeRoleWithWebIdentity"
                ],
                "resource": "arn:aws:iam::111122223333:role/Cognito_testpoolUnauth_Role",
                "isPublic": false,
                "resourceType": "AWS::IAM::Role",
                "condition": {
                    "cognito-identity.amazonaws.com:aud": "us-west-2:EXAMPLE0-0000-0000-0000-000000000000"
                },
                "createdAt": "2021-02-26T21:17:24.710000+00:00",
                "analyzedAt": "2024-02-16T18:17:47.888000+00:00",
                "updatedAt": "2021-02-26T21:17:24.710000+00:00",
                "status": "ACTIVE",
                "resourceOwnerAccount": "111122223333"
            },
            {
                "id": "ce0e221a-85b9-4d52-91ff-d7678075442f",
                "principal": {
                    "Federated": "cognito-identity.amazonaws.com"
                },
                "action": [
                    "sts:AssumeRoleWithWebIdentity"
                ],
                "resource": "arn:aws:iam::111122223333:role/Cognito_testpoolAuth_Role",
                "isPublic": false,
                "resourceType": "AWS::IAM::Role",
                "condition": {
                    "cognito-identity.amazonaws.com:aud": "us-west-2:EXAMPLE0-0000-0000-0000-000000000000"
                },
                "createdAt": "2021-02-26T21:17:50.905000+00:00",
                "analyzedAt": "2024-02-16T18:17:47.888000+00:00",
                "updatedAt": "2021-02-26T21:17:50.905000+00:00",
                "status": "ACTIVE",
                "resourceOwnerAccount": "111122223333"
            }
        ]
    }

For more information, see `Using AWS Identity and Access Management Access Analyzer <https://docs.aws.amazon.com/IAM/latest/UserGuide/what-is-access-analyzer.html>`__ in the *AWS IAM User Guide*.