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

The following ``list-findings-v2`` 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-v2 \
        --analyzer-arn arn:aws:access-analyzer:us-west-2:111122223333:analyzer/ConsoleAnalyzer-account \
        --filter '{"resource": {"contains": ["Cognito"]}, "resourceType": {"eq": ["AWS::IAM::Role"]}}'

Output::

    {
        "findings": [
            {
                "analyzedAt": "2024-02-16T18:17:47.888000+00:00",
                "createdAt": "2021-02-26T21:17:24.710000+00:00",
                "id": "597f3bc2-3adc-4c18-9879-5c4b23485e46",
                "resource": "arn:aws:iam::111122223333:role/Cognito_testpoolUnauth_Role",
                "resourceType": "AWS::IAM::Role",
                "resourceOwnerAccount": "111122223333",
                "status": "ACTIVE",
                "updatedAt": "2021-02-26T21:17:24.710000+00:00",
                "findingType": "ExternalAccess"
            },
            {
                "analyzedAt": "2024-02-16T18:17:47.888000+00:00",
                "createdAt": "2021-02-26T21:17:50.905000+00:00",
                "id": "ce0e221a-85b9-4d52-91ff-d7678075442f",
                "resource": "arn:aws:iam::111122223333:role/Cognito_testpoolAuth_Role",
                "resourceType": "AWS::IAM::Role",
                "resourceOwnerAccount": "111122223333",
                "status": "ACTIVE",
                "updatedAt": "2021-02-26T21:17:50.905000+00:00",
                "findingType": "ExternalAccess"
            }
        ]
    }

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*.