What it installs

One IAM role. Read it line by line.

The only thing AccessLens ever creates in an AWS account is an IAM role named AccessLensReadOnly, with one inline read-only policy, and only if you ask it to. Here's that role exactly as the app generates it, why it needs each permission, and how to remove it.

Shown exactly as AccessLens 0.1.0 generates it (synced from the app at commit d0ab936 on ). The account IDs are AWS's documentation examples: the hub is 111122223333 and the target 444455556666.

  • 1IAM role, AccessLensReadOnly
  • 1inline policy, AccessLensReadOnlyPolicy
  • 187read actions, each listed
  • 0wildcard actions
  • 0other resources created
Who can use the role

Trust policy

In the app, the wizard fills in your hub account, the permission set you signed in with, your organization ID and a fresh ExternalId for each account (or, if you opt in for a StackSet, one ExternalId for the organization). This example uses fictitious values.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AccessLensHub",
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::111122223333:root"
      },
      "Action": "sts:AssumeRole",
      "Condition": {
        "ArnLike": {
          "aws:PrincipalArn": "arn:aws:iam::111122223333:role/aws-reserved/sso.amazonaws.com/*AWSReservedSSO_Security_Audit_*"
        },
        "StringEquals": {
          "aws:PrincipalOrgID": "o-exampleorg",
          "sts:ExternalId": "0123456789abcdef0123456789abcdef"
        }
      }
    }
  ]
}
  • Who: only principals in the hub account whose ARN matches the IAM Identity Center role of the permission set you signed in with. Identity Center roles have a random suffix and are recreated when a permission set is reprovisioned, so the policy trusts the hub account and narrows it with aws:PrincipalArn rather than naming the role directly, as AWS recommends.
  • ExternalId: 32 random hex characters per account, from the operating system's secure random generator, stored locally and shown in the wizard. You can regenerate it, after which the trust policy needs updating.
  • Organization: when your organization is visible to the hub, aws:PrincipalOrgID is added.
  • Sessions: the role session is named accesslens, so it's easy to find in the target account's CloudTrail, and lasts one hour. The role's maximum session duration is also one hour.
What the role can do

Permissions policy

One statement listing every action explicitly: 187 read actions, no wildcards, and none of the AWS-managed ReadOnlyAccess or SecurityAudit policies. It's generated from the app's collector registry, the same list that drives its read-only guard, so it always matches what AccessLens actually calls. It's an inline policy because a managed policy would be a second resource.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AccessLensReadOnly",
      "Effect": "Allow",
      "Action": [
        "access-analyzer:ListAnalyzers",
        "access-analyzer:ListFindings",
        "account:GetAlternateContact",
        "acm-pca:GetPolicy",
        "acm-pca:ListCertificateAuthorities",
        "acm:ListCertificates",
        "airflow:GetEnvironment",
        "airflow:ListEnvironments",
        "apigateway:GET",
        "appsync:ListGraphqlApis",
        "athena:GetWorkGroup",
        "athena:ListWorkGroups",
        "backup:GetBackupVaultAccessPolicy",
        "backup:ListBackupPlans",
        "backup:ListBackupVaults",
        "bedrock:GetCustomModel",
        "bedrock:GetModelInvocationLoggingConfiguration",
        "bedrock:ListAgents",
        "bedrock:ListCustomModels",
        "cloudfront:GetDistributionConfig",
        "cloudfront:ListDistributions",
        "cloudhsm:DescribeClusters",
        "cloudtrail:DescribeTrails",
        "cloudtrail:GetTrailStatus",
        "cloudtrail:LookupEvents",
        "cloudwatch:DescribeAlarms",
        "cognito-identity:DescribeIdentityPool",
        "cognito-identity:GetIdentityPoolRoles",
        "cognito-identity:ListIdentityPools",
        "cognito-idp:DescribeUserPool",
        "cognito-idp:ListUserPools",
        "config:DescribeConfigurationRecorderStatus",
        "config:DescribeConfigurationRecorders",
        "dax:DescribeClusters",
        "ds:DescribeDirectories",
        "ds:DescribeLDAPSSettings",
        "ds:ListLogSubscriptions",
        "dynamodb:DescribeContinuousBackups",
        "dynamodb:DescribeTable",
        "dynamodb:GetResourcePolicy",
        "dynamodb:ListTables",
        "ec2:DescribeFlowLogs",
        "ec2:DescribeImages",
        "ec2:DescribeInstances",
        "ec2:DescribeNetworkAcls",
        "ec2:DescribeRegions",
        "ec2:DescribeSecurityGroups",
        "ec2:DescribeSnapshots",
        "ec2:DescribeTransitGateways",
        "ec2:DescribeVolumes",
        "ec2:DescribeVpcEndpoints",
        "ec2:DescribeVpcs",
        "ec2:GetEbsEncryptionByDefault",
        "ecr:DescribeRepositories",
        "ecr:GetRegistryScanningConfiguration",
        "ecr:GetRepositoryPolicy",
        "ecs:DescribeClusters",
        "ecs:DescribeTaskDefinition",
        "ecs:ListClusters",
        "ecs:ListTaskDefinitionFamilies",
        "eks:DescribeCluster",
        "eks:ListClusters",
        "elasticache:DescribeReplicationGroups",
        "elasticfilesystem:DescribeFileSystemPolicy",
        "elasticfilesystem:DescribeFileSystems",
        "elasticloadbalancing:DescribeListeners",
        "elasticloadbalancing:DescribeLoadBalancerAttributes",
        "elasticloadbalancing:DescribeLoadBalancers",
        "elasticmapreduce:DescribeCluster",
        "elasticmapreduce:GetBlockPublicAccessConfiguration",
        "elasticmapreduce:ListClusters",
        "es:DescribeDomains",
        "es:ListDomainNames",
        "events:ListEventBuses",
        "firehose:DescribeDeliveryStream",
        "firehose:ListDeliveryStreams",
        "glue:GetDataCatalogEncryptionSettings",
        "glue:GetJobs",
        "guardduty:GetDetector",
        "guardduty:ListDetectors",
        "iam:GenerateCredentialReport",
        "iam:GenerateServiceLastAccessedDetails",
        "iam:GetAccountAuthorizationDetails",
        "iam:GetAccountPasswordPolicy",
        "iam:GetAccountSummary",
        "iam:GetCredentialReport",
        "iam:GetOpenIDConnectProvider",
        "iam:GetServiceLastAccessedDetails",
        "iam:ListOpenIDConnectProviders",
        "iam:ListOrganizationsFeatures",
        "iam:ListSAMLProviders",
        "iam:ListServerCertificates",
        "iam:ListServiceSpecificCredentials",
        "iam:ListVirtualMFADevices",
        "kafka:ListClustersV2",
        "kinesis:DescribeStreamSummary",
        "kinesis:ListStreams",
        "kms:DescribeKey",
        "kms:GetKeyPolicy",
        "kms:GetKeyRotationStatus",
        "kms:ListKeys",
        "lambda:GetPolicy",
        "lambda:ListFunctionUrlConfigs",
        "lambda:ListFunctions",
        "logs:DescribeLogGroups",
        "logs:DescribeMetricFilters",
        "macie2:GetMacieSession",
        "memorydb:DescribeClusters",
        "memorydb:DescribeUsers",
        "network-firewall:DescribeFirewall",
        "network-firewall:DescribeFirewallPolicy",
        "network-firewall:DescribeLoggingConfiguration",
        "network-firewall:ListFirewalls",
        "oam:GetSinkPolicy",
        "oam:ListLinks",
        "oam:ListSinks",
        "organizations:DescribeOrganization",
        "organizations:DescribePolicy",
        "organizations:ListAccounts",
        "organizations:ListAccountsForParent",
        "organizations:ListOrganizationalUnitsForParent",
        "organizations:ListPolicies",
        "organizations:ListRoots",
        "organizations:ListTargetsForPolicy",
        "rds:DescribeDBClusterSnapshotAttributes",
        "rds:DescribeDBClusterSnapshots",
        "rds:DescribeDBClusters",
        "rds:DescribeDBInstances",
        "rds:DescribeDBProxies",
        "rds:DescribeDBSnapshotAttributes",
        "rds:DescribeDBSnapshots",
        "redshift-serverless:ListNamespaces",
        "redshift-serverless:ListWorkgroups",
        "redshift:DescribeClusters",
        "redshift:DescribeLoggingStatus",
        "rolesanywhere:ListProfiles",
        "rolesanywhere:ListTrustAnchors",
        "route53:GetDNSSEC",
        "route53:ListHostedZones",
        "route53:ListQueryLoggingConfigs",
        "route53resolver:ListResolverDnssecConfigs",
        "s3:GetAccessPointPolicy",
        "s3:GetAccessPointPolicyStatus",
        "s3:GetAccountPublicAccessBlock",
        "s3:GetBucketAcl",
        "s3:GetBucketLocation",
        "s3:GetBucketLogging",
        "s3:GetBucketPolicy",
        "s3:GetBucketPolicyStatus",
        "s3:GetBucketPublicAccessBlock",
        "s3:GetBucketVersioning",
        "s3:GetEncryptionConfiguration",
        "s3:ListAccessPoints",
        "s3:ListAllMyBuckets",
        "s3express:GetBucketPolicy",
        "s3express:ListAllMyDirectoryBuckets",
        "sagemaker:DescribeNotebookInstance",
        "sagemaker:ListNotebookInstances",
        "secretsmanager:GetResourcePolicy",
        "secretsmanager:ListSecrets",
        "securityhub:DescribeHub",
        "securityhub:GetFindings",
        "shield:DescribeSubscription",
        "sns:GetTopicAttributes",
        "sns:ListTopics",
        "sqs:GetQueueAttributes",
        "sqs:ListQueues",
        "ssm:DescribeDocumentPermission",
        "ssm:DescribeParameters",
        "ssm:GetDocument",
        "ssm:ListDocuments",
        "sso:DescribePermissionSet",
        "sso:GetInlinePolicyForPermissionSet",
        "sso:ListAccountAssignments",
        "sso:ListInstances",
        "sso:ListManagedPoliciesInPermissionSet",
        "sso:ListPermissionSets",
        "sso:ListPermissionSetsProvisionedToAccount",
        "states:DescribeStateMachine",
        "states:ListStateMachines",
        "support:DescribeTrustedAdvisorCheckResult",
        "transfer:ListServers",
        "transfer:ListUsers",
        "wafv2:GetLoggingConfiguration",
        "wafv2:GetWebACL",
        "wafv2:ListWebACLs",
        "workspaces:DescribeWorkspaces"
      ],
      "Resource": "*"
    }
  ]
}
Why each permission

47 permission groups, explained

The setup wizard's Why these permissions? tab shows the same explanations. Its verify step makes one cheap read per group and reports which ones work.

Permission groups: what each is for, why it's needed, and its IAM actions
GroupWhyActions
IAM users, groups, roles and policiesiam-inventoryReads every IAM principal, attached and inline policy, permissions boundary and role trust policy in one paginated call (GetAccountAuthorizationDetails). Nearly every analyzer depends on this.
  • iam:GetAccountAuthorizationDetails
  • iam:GetAccountSummary
  • iam:GetOpenIDConnectProvider
  • iam:ListOpenIDConnectProviders
  • iam:ListSAMLProviders
IAM credential report and password policyiam-credentialsThe credential report gives MFA status, password age and access-key age and usage for every user (including root) without listing them one by one. Generating the report is a read-only job; it changes nothing in the account.
  • iam:GenerateCredentialReport
  • iam:GetAccountPasswordPolicy
  • iam:GetCredentialReport
IAM last-accessed dataiam-last-accessedShows which services and actions each user and role has used, and when (IAM's access advisor), to find permissions nobody uses. Generating the report is a read-only job inside IAM; it changes nothing in the account.
  • iam:GenerateServiceLastAccessedDetails
  • iam:GetServiceLastAccessedDetails
Exposed access keys (Trusted Advisor)trusted-advisorReads the result of Trusted Advisor's Exposed Access Keys check: keys AWS found in public code repositories, which only AWS can detect. Needs AWS Business Support or higher; with a lower support plan AccessLens reports the check as unavailable.
  • support:DescribeTrustedAdvisorCheckResult
AWS OrganizationsorganizationsIdentifies the organization so trusts to accounts outside it can be flagged. From a management or delegated-admin account it also lists member accounts (for import), service control policies and where they're attached, so SCPs are evaluated on each account's escalation paths.
  • organizations:DescribeOrganization
  • organizations:DescribePolicy
  • organizations:ListAccounts
  • organizations:ListAccountsForParent
  • organizations:ListOrganizationalUnitsForParent
  • organizations:ListPolicies
  • organizations:ListRoots
  • organizations:ListTargetsForPolicy
IAM Identity Center (read-only)identity-centerReviews permission sets (session duration, admin policies, inline wildcards) and which ones are assigned in this account. Only works where Identity Center is managed.
  • sso:DescribePermissionSet
  • sso:GetInlinePolicyForPermissionSet
  • sso:ListAccountAssignments
  • sso:ListInstances
  • sso:ListManagedPoliciesInPermissionSet
  • sso:ListPermissionSets
  • sso:ListPermissionSetsProvisionedToAccount
Enabled regionsregionsFinds which regions are enabled so regional resources are scanned only where they can exist.
  • ec2:DescribeRegions
IAM Access Analyzer (existing analyzers only)access-analyzerImports findings from Access Analyzers you already run. AccessLens never creates an analyzer; if none exists, this group finds nothing.
  • access-analyzer:ListAnalyzers
  • access-analyzer:ListFindings
Root MFA type, server certificates, service credentials and contactsiam-settingsChecks whether the root user's MFA is a virtual device rather than a hardware key, finds expired server certificates stored in IAM, lists service-specific credentials (long-term Amazon Bedrock API keys, CodeCommit and Keyspaces credentials) without reading their secrets, checks whether root credentials are managed centrally for the organization, and whether a security contact is registered. Contact names, email addresses and phone numbers are discarded on receipt.
  • account:GetAlternateContact
  • iam:ListOrganizationsFeatures
  • iam:ListServerCertificates
  • iam:ListServiceSpecificCredentials
  • iam:ListVirtualMFADevices
IAM Roles Anywhere and CloudWatch cross-account observabilityroles-anywhere-oamLists Roles Anywhere trust anchors and profiles, so roles that certificates from an outside certificate authority can assume appear in the trust graph, and CloudWatch Observability Access Manager sinks and links, to find sink policies that let any account or an account outside your organization link in, and links that send this account's telemetry outside it.
  • oam:GetSinkPolicy
  • oam:ListLinks
  • oam:ListSinks
  • rolesanywhere:ListProfiles
  • rolesanywhere:ListTrustAnchors
S3 bucket access and data-protection settingss3Checks bucket policies (including S3 Express One Zone directory buckets), ACLs, Block Public Access (bucket and account level) and AWS's own public-policy evaluation, plus versioning, MFA delete, default encryption and access logging. AccessLens never reads object data: s3:GetObject is not requested.
  • s3:GetAccountPublicAccessBlock
  • s3:GetBucketAcl
  • s3:GetBucketLocation
  • s3:GetBucketLogging
  • s3:GetBucketPolicy
  • s3:GetBucketPolicyStatus
  • s3:GetBucketPublicAccessBlock
  • s3:GetBucketVersioning
  • s3:GetEncryptionConfiguration
  • s3:ListAllMyBuckets
  • s3express:GetBucketPolicy
  • s3express:ListAllMyDirectoryBuckets
KMS key policies and rotationkmsReads key policies of customer-managed keys to find public or cross-account grants, and whether automatic key rotation is on. Key material and grants for decryption are never used.
  • kms:DescribeKey
  • kms:GetKeyPolicy
  • kms:GetKeyRotationStatus
  • kms:ListKeys
Lambda resource policieslambdaReads function resource policies and function URL auth settings to find public or cross-account invoke permissions, and each function's runtime to find deprecated ones. Environment variables returned by ListFunctions are discarded immediately and never stored.
  • lambda:GetPolicy
  • lambda:ListFunctionUrlConfigs
  • lambda:ListFunctions
SQS queue policiessqsReads queue access policies to find public or cross-account send/receive permissions, and whether server-side encryption is on. Messages are never read.
  • sqs:GetQueueAttributes
  • sqs:ListQueues
SNS topic policiessnsReads topic access policies to find public publish or subscribe permissions, and whether topics are encrypted with KMS. For the topics CIS monitoring alarms notify, it reads the number of confirmed subscriptions, never who they are.
  • sns:GetTopicAttributes
  • sns:ListTopics
Secrets Manager resource policiessecretsmanagerReads secret resource policies to find cross-account or public access, and whether rotation is on and when each secret was last used. Secret values are never read: secretsmanager:GetSecretValue is not requested.
  • secretsmanager:GetResourcePolicy
  • secretsmanager:ListSecrets
S3 access pointss3-access-pointsChecks access point policies and network origin (SaaS rule AWS::S3::AccessPoint).
  • s3:GetAccessPointPolicy
  • s3:GetAccessPointPolicyStatus
  • s3:ListAccessPoints
EventBridge event bus policieseventsReads event bus resource policies to find public or cross-account PutEvents permissions.
  • events:ListEventBuses
AWS Backup vault access policiesbackupReads backup vault access policies to find public or cross-account access and vaults with no protective policy, and whether any backup plan exists where databases and file systems do.
  • backup:GetBackupVaultAccessPolicy
  • backup:ListBackupPlans
  • backup:ListBackupVaults
API Gateway REST, HTTP and WebSocket APIsapigatewayLists REST API methods to find ones with no authorization, reads API resource policies, and checks that every stage writes access logs. API Gateway uses one read action (apigateway:GET) for all of its read calls.
  • apigateway:GET
Amazon Cognito user and identity poolscognitoChecks user pool MFA, password policy, threat protection and account recovery, and whether identity pools allow unauthenticated access. Never reads user data or app client secrets.
  • cognito-identity:DescribeIdentityPool
  • cognito-identity:GetIdentityPoolRoles
  • cognito-identity:ListIdentityPools
  • cognito-idp:DescribeUserPool
  • cognito-idp:ListUserPools
AWS AppSync APIsappsyncChecks which authentication modes each GraphQL API accepts (API keys in particular).
  • appsync:ListGraphqlApis
ElastiCache and MemoryDB authentication and encryptioncachesChecks whether Redis/Valkey replication groups require an auth token or RBAC and encrypt data at rest and in transit, and whether MemoryDB clusters use the open-access ACL or password-less users.
  • elasticache:DescribeReplicationGroups
  • memorydb:DescribeClusters
  • memorydb:DescribeUsers
AWS Transfer Family userstransferChecks that every Transfer Family user has an IAM role scoping its access.
  • transfer:ListServers
  • transfer:ListUsers
VPC endpoint policiesvpc-endpointsFinds interface and gateway endpoints that still use the default full-access policy.
  • ec2:DescribeVpcEndpoints
CloudTrail trails and event historycloudtrailChecks that a multi-region trail is logging, with log file validation and KMS encryption, and polls the free 90-day management-event history (LookupEvents) for high-risk IAM changes while the app is running. No trail, rule or stream is created.
  • cloudtrail:DescribeTrails
  • cloudtrail:GetTrailStatus
  • cloudtrail:LookupEvents
VPC security groups, network ACLs, flow logs and transit gatewaysec2-networkFinds security groups and network ACLs open to the internet on administration and other high-risk ports, default security groups that allow traffic, VPCs without flow logs, and transit gateways that accept attachments automatically.
  • ec2:DescribeFlowLogs
  • ec2:DescribeNetworkAcls
  • ec2:DescribeSecurityGroups
  • ec2:DescribeTransitGateways
  • ec2:DescribeVpcs
EC2 instances, EBS volumes, snapshots and AMIsec2-computeChecks that instances require IMDSv2 and have an IAM role, that EBS volumes and the account default are encrypted, and that no EBS snapshot or AMI you own is public. Instance user data and volume contents are never read.
  • ec2:DescribeImages
  • ec2:DescribeInstances
  • ec2:DescribeSnapshots
  • ec2:DescribeVolumes
  • ec2:GetEbsEncryptionByDefault
RDS, Aurora, DocumentDB and NeptunerdsChecks database instances and clusters for public accessibility, storage encryption, backup retention, deletion protection, minor-version upgrades and Multi-AZ, finds manual snapshots shared publicly, and checks that RDS proxies require TLS. No database is connected to and no data is read.
  • rds:DescribeDBClusterSnapshotAttributes
  • rds:DescribeDBClusterSnapshots
  • rds:DescribeDBClusters
  • rds:DescribeDBInstances
  • rds:DescribeDBProxies
  • rds:DescribeDBSnapshotAttributes
  • rds:DescribeDBSnapshots
DynamoDB tablesdynamodbChecks point-in-time recovery and deletion protection on each table. Items are never read: dynamodb:GetItem, Query and Scan are not requested.
  • dynamodb:DescribeContinuousBackups
  • dynamodb:DescribeTable
  • dynamodb:GetResourcePolicy
  • dynamodb:ListTables
Amazon Redshift clustersredshiftChecks clusters for public accessibility, encryption and audit logging. No query is run.
  • redshift:DescribeClusters
  • redshift:DescribeLoggingStatus
OpenSearch Service domainsopensearchChecks domains for encryption at rest and between nodes, HTTPS enforcement, and public endpoints with open access policies. Indexes and documents are never read.
  • es:DescribeDomains
  • es:ListDomainNames
EFS file systems and Kinesis data streamsstorageChecks that EFS file systems and Kinesis data streams are encrypted at rest. File and record contents are never read.
  • elasticfilesystem:DescribeFileSystemPolicy
  • elasticfilesystem:DescribeFileSystems
  • kinesis:DescribeStreamSummary
  • kinesis:ListStreams
ECR repositories, ECS and EKS clusterscontainersChecks that ECR scans images on push and keeps tags immutable; that ECS task definitions don't run privileged containers, log their output and don't put secret-looking values in plain environment variables (only the variable names are kept; values are discarded on receipt); and that EKS clusters restrict their public API endpoint, log audit events and encrypt Kubernetes secrets with KMS. Images and cluster workloads are never read.
  • ecr:DescribeRepositories
  • ecr:GetRegistryScanningConfiguration
  • ecr:GetRepositoryPolicy
  • ecs:DescribeClusters
  • ecs:DescribeTaskDefinition
  • ecs:ListClusters
  • ecs:ListTaskDefinitionFamilies
  • eks:DescribeCluster
  • eks:ListClusters
CloudWatch Logs log groups, metric filters and alarmscloudwatch-logsChecks log group retention and KMS encryption, and whether the CIS monitoring alarms exist: a metric filter on the CloudTrail log group for each high-risk event (root use, IAM policy changes, console sign-in without MFA, ...) with an alarm that notifies someone. Log events are never read: logs:GetLogEvents and FilterLogEvents are not requested.
  • cloudwatch:DescribeAlarms
  • logs:DescribeLogGroups
  • logs:DescribeMetricFilters
AWS Config, GuardDuty, Security Hub and Macie statussecurity-servicesChecks, region by region, whether AWS Config is recording and whether GuardDuty, Security Hub and Macie are turned on, and imports Security Hub's active findings where it's on. AccessLens never turns any of them on and never writes findings back.
  • config:DescribeConfigurationRecorderStatus
  • config:DescribeConfigurationRecorders
  • guardduty:GetDetector
  • guardduty:ListDetectors
  • macie2:GetMacieSession
  • securityhub:DescribeHub
  • securityhub:GetFindings
Elastic Load Balancingload-balancersChecks Application, Network and Classic Load Balancers for plain-HTTP listeners that don't redirect, outdated TLS policies and missing access logs.
  • elasticloadbalancing:DescribeListeners
  • elasticloadbalancing:DescribeLoadBalancerAttributes
  • elasticloadbalancing:DescribeLoadBalancers
CloudFront distributionscloudfrontChecks that distributions require HTTPS with a current TLS policy, reach origins over HTTPS, log requests and use AWS WAF.
  • cloudfront:GetDistributionConfig
  • cloudfront:ListDistributions
ACM certificates and private certificate authoritiescertificatesFinds certificates that are expiring or use weak keys, private CAs without revocation, and CA resource policies open to anyone. Private keys are never exported.
  • acm-pca:GetPolicy
  • acm-pca:ListCertificateAuthorities
  • acm:ListCertificates
Route 53 hosted zones and Resolver DNSSECdnsChecks public hosted zones for DNSSEC signing and query logging, and VPCs for Resolver DNSSEC validation. DNS records are never listed.
  • route53:GetDNSSEC
  • route53:ListHostedZones
  • route53:ListQueryLoggingConfigs
  • route53resolver:ListResolverDnssecConfigs
Network Firewall, AWS WAF and Shieldnetwork-securityChecks Network Firewall logging, default actions and deletion protection, AWS WAF web ACLs for rules and logging, and whether Shield Advanced protects internet-facing resources.
  • network-firewall:DescribeFirewall
  • network-firewall:DescribeFirewallPolicy
  • network-firewall:DescribeLoggingConfiguration
  • network-firewall:ListFirewalls
  • shield:DescribeSubscription
  • wafv2:GetLoggingConfiguration
  • wafv2:GetWebACL
  • wafv2:ListWebACLs
Data Firehose and Amazon MSKstreamingChecks Firehose streams for server-side encryption, and MSK clusters for encryption in transit, unauthenticated or public access and broker logging. Records and messages are never read.
  • firehose:DescribeDeliveryStream
  • firehose:ListDeliveryStreams
  • kafka:ListClustersV2
Systems Manager parameters, documents and Session Managersystems-managerFinds parameters whose names suggest secrets but are stored as plain String, documents shared publicly, and Session Manager preferences without logging or encryption. Parameter values are never read: ssm:GetParameter is not requested.
  • ssm:DescribeDocumentPermission
  • ssm:DescribeParameters
  • ssm:GetDocument
  • ssm:ListDocuments
DAX, Redshift Serverless and CloudHSMdata-servicesChecks DAX clusters for encryption at rest and TLS, Redshift Serverless for public access and audit logging, and CloudHSM clusters for a single point of failure.
  • cloudhsm:DescribeClusters
  • dax:DescribeClusters
  • redshift-serverless:ListNamespaces
  • redshift-serverless:ListWorkgroups
Glue, Athena, EMR, MWAA, SageMaker and Step FunctionsanalyticsChecks Glue jobs and the Data Catalog for encryption, Athena workgroups for result encryption, EMR block public access and security configurations, MWAA public web servers, SageMaker notebooks with direct internet or root access, and Step Functions logging. Job arguments, Airflow options and state machine definitions are discarded on receipt; no data is queried.
  • airflow:GetEnvironment
  • airflow:ListEnvironments
  • athena:GetWorkGroup
  • athena:ListWorkGroups
  • elasticmapreduce:DescribeCluster
  • elasticmapreduce:GetBlockPublicAccessConfiguration
  • elasticmapreduce:ListClusters
  • glue:GetDataCatalogEncryptionSettings
  • glue:GetJobs
  • sagemaker:DescribeNotebookInstance
  • sagemaker:ListNotebookInstances
  • states:DescribeStateMachine
  • states:ListStateMachines
WorkSpaces and Directory Serviceend-user-computingChecks WorkSpaces volumes for encryption, and Managed Microsoft AD directories for LDAPS and log forwarding.
  • ds:DescribeDirectories
  • ds:DescribeLDAPSSettings
  • ds:ListLogSubscriptions
  • workspaces:DescribeWorkspaces
Amazon BedrockbedrockChecks whether model invocation logging is on, whether custom models are encrypted with your own KMS key, and whether agents have a guardrail. Prompts, responses, agent instructions and training data are never read.
  • bedrock:GetCustomModel
  • bedrock:GetModelInvocationLoggingConfiguration
  • bedrock:ListAgents
  • bedrock:ListCustomModels
Never requested

Actions AccessLens deliberately never asks for

Reading your data, as opposed to your configuration, is out of scope, even when the action is a "Get". The app has a test that fails if any of these 34 actions is declared:

  • securityhub:BatchImportFindings
  • securityhub:BatchUpdateFindings
  • securityhub:EnableSecurityHub
  • s3:GetObject
  • s3:GetObjectAcl
  • secretsmanager:GetSecretValue
  • ssm:GetParameter
  • ssm:GetParameters
  • kms:Decrypt
  • lambda:GetFunction
  • sqs:ReceiveMessage
  • dynamodb:GetItem
  • dynamodb:Query
  • dynamodb:Scan
  • logs:GetLogEvents
  • logs:FilterLogEvents
  • ec2:DescribeInstanceAttribute
  • ec2:GetPasswordData
  • ecr:BatchGetImage
  • ecr:GetDownloadUrlForLayer
  • eks:DescribeAccessEntry
  • ssm:GetParametersByPath
  • ssm:GetParameterHistory
  • glue:GetConnection
  • glue:GetConnections
  • athena:GetQueryResults
  • states:GetExecutionHistory
  • firehose:PutRecord
  • kafka:GetBootstrapBrokers
  • bedrock:GetAgent
  • bedrock:InvokeModel
  • bedrock:GetPrompt
  • sns:ListSubscriptionsByTopic
  • account:GetContactInformation

Configuration that comes back with secret values in it is dropped when it's received: Lambda environment variables, for example, are discarded before anything is stored or logged.

Option 1

Deploy it yourself

Prefer that AccessLens never writes to AWS at all? The wizard gives you the same role three ways. Each creates exactly one IAM role with its inline policy.

CloudFormation

Deploy the YAML as a stack in the target account (suggested stack name accesslens-readonly-role).

AWSTemplateFormatVersion: "2010-09-09"
Description: "AccessLens read-only role for account 444455556666. Creates exactly one IAM role with an inline read-only policy."
Resources:
  AccessLensReadOnlyRole:
    Type: "AWS::IAM::Role"
    Properties:
      RoleName: "AccessLensReadOnly"
      Description: "Read-only access for AccessLens. Created by AccessLens; safe to delete."
      MaxSessionDuration: 3600
      AssumeRolePolicyDocument:
        "Version": "2012-10-17"
        "Statement":
          - "Sid": "AccessLensHub"
            "Effect": "Allow"
            "Principal":
              "AWS": "arn:aws:iam::111122223333:root"
            "Action": "sts:AssumeRole"
            "Condition":
              "ArnLike":
                "aws:PrincipalArn": "arn:aws:iam::111122223333:role/aws-reserved/sso.amazonaws.com/*AWSReservedSSO_Security_Audit_*"
              "StringEquals":
                "aws:PrincipalOrgID": "o-exampleorg"
                "sts:ExternalId": "0123456789abcdef0123456789abcdef"
      Policies:
        - PolicyName: "AccessLensReadOnlyPolicy"
          PolicyDocument:
            "Version": "2012-10-17"
            "Statement":
              - "Sid": "AccessLensReadOnly"
                "Effect": "Allow"
                "Action":
                  - "access-analyzer:ListAnalyzers"
                  - "access-analyzer:ListFindings"
                  - "account:GetAlternateContact"
                  - "acm-pca:GetPolicy"
                  - "acm-pca:ListCertificateAuthorities"
                  - "acm:ListCertificates"
                  - "airflow:GetEnvironment"
                  - "airflow:ListEnvironments"
                  - "apigateway:GET"
                  - "appsync:ListGraphqlApis"
                  - "athena:GetWorkGroup"
                  - "athena:ListWorkGroups"
                  - "backup:GetBackupVaultAccessPolicy"
                  - "backup:ListBackupPlans"
                  - "backup:ListBackupVaults"
                  - "bedrock:GetCustomModel"
                  - "bedrock:GetModelInvocationLoggingConfiguration"
                  - "bedrock:ListAgents"
                  - "bedrock:ListCustomModels"
                  - "cloudfront:GetDistributionConfig"
                  - "cloudfront:ListDistributions"
                  - "cloudhsm:DescribeClusters"
                  - "cloudtrail:DescribeTrails"
                  - "cloudtrail:GetTrailStatus"
                  - "cloudtrail:LookupEvents"
                  - "cloudwatch:DescribeAlarms"
                  - "cognito-identity:DescribeIdentityPool"
                  - "cognito-identity:GetIdentityPoolRoles"
                  - "cognito-identity:ListIdentityPools"
                  - "cognito-idp:DescribeUserPool"
                  - "cognito-idp:ListUserPools"
                  - "config:DescribeConfigurationRecorderStatus"
                  - "config:DescribeConfigurationRecorders"
                  - "dax:DescribeClusters"
                  - "ds:DescribeDirectories"
                  - "ds:DescribeLDAPSSettings"
                  - "ds:ListLogSubscriptions"
                  - "dynamodb:DescribeContinuousBackups"
                  - "dynamodb:DescribeTable"
                  - "dynamodb:GetResourcePolicy"
                  - "dynamodb:ListTables"
                  - "ec2:DescribeFlowLogs"
                  - "ec2:DescribeImages"
                  - "ec2:DescribeInstances"
                  - "ec2:DescribeNetworkAcls"
                  - "ec2:DescribeRegions"
                  - "ec2:DescribeSecurityGroups"
                  - "ec2:DescribeSnapshots"
                  - "ec2:DescribeTransitGateways"
                  - "ec2:DescribeVolumes"
                  - "ec2:DescribeVpcEndpoints"
                  - "ec2:DescribeVpcs"
                  - "ec2:GetEbsEncryptionByDefault"
                  - "ecr:DescribeRepositories"
                  - "ecr:GetRegistryScanningConfiguration"
                  - "ecr:GetRepositoryPolicy"
                  - "ecs:DescribeClusters"
                  - "ecs:DescribeTaskDefinition"
                  - "ecs:ListClusters"
                  - "ecs:ListTaskDefinitionFamilies"
                  - "eks:DescribeCluster"
                  - "eks:ListClusters"
                  - "elasticache:DescribeReplicationGroups"
                  - "elasticfilesystem:DescribeFileSystemPolicy"
                  - "elasticfilesystem:DescribeFileSystems"
                  - "elasticloadbalancing:DescribeListeners"
                  - "elasticloadbalancing:DescribeLoadBalancerAttributes"
                  - "elasticloadbalancing:DescribeLoadBalancers"
                  - "elasticmapreduce:DescribeCluster"
                  - "elasticmapreduce:GetBlockPublicAccessConfiguration"
                  - "elasticmapreduce:ListClusters"
                  - "es:DescribeDomains"
                  - "es:ListDomainNames"
                  - "events:ListEventBuses"
                  - "firehose:DescribeDeliveryStream"
                  - "firehose:ListDeliveryStreams"
                  - "glue:GetDataCatalogEncryptionSettings"
                  - "glue:GetJobs"
                  - "guardduty:GetDetector"
                  - "guardduty:ListDetectors"
                  - "iam:GenerateCredentialReport"
                  - "iam:GenerateServiceLastAccessedDetails"
                  - "iam:GetAccountAuthorizationDetails"
                  - "iam:GetAccountPasswordPolicy"
                  - "iam:GetAccountSummary"
                  - "iam:GetCredentialReport"
                  - "iam:GetOpenIDConnectProvider"
                  - "iam:GetServiceLastAccessedDetails"
                  - "iam:ListOpenIDConnectProviders"
                  - "iam:ListOrganizationsFeatures"
                  - "iam:ListSAMLProviders"
                  - "iam:ListServerCertificates"
                  - "iam:ListServiceSpecificCredentials"
                  - "iam:ListVirtualMFADevices"
                  - "kafka:ListClustersV2"
                  - "kinesis:DescribeStreamSummary"
                  - "kinesis:ListStreams"
                  - "kms:DescribeKey"
                  - "kms:GetKeyPolicy"
                  - "kms:GetKeyRotationStatus"
                  - "kms:ListKeys"
                  - "lambda:GetPolicy"
                  - "lambda:ListFunctionUrlConfigs"
                  - "lambda:ListFunctions"
                  - "logs:DescribeLogGroups"
                  - "logs:DescribeMetricFilters"
                  - "macie2:GetMacieSession"
                  - "memorydb:DescribeClusters"
                  - "memorydb:DescribeUsers"
                  - "network-firewall:DescribeFirewall"
                  - "network-firewall:DescribeFirewallPolicy"
                  - "network-firewall:DescribeLoggingConfiguration"
                  - "network-firewall:ListFirewalls"
                  - "oam:GetSinkPolicy"
                  - "oam:ListLinks"
                  - "oam:ListSinks"
                  - "organizations:DescribeOrganization"
                  - "organizations:DescribePolicy"
                  - "organizations:ListAccounts"
                  - "organizations:ListAccountsForParent"
                  - "organizations:ListOrganizationalUnitsForParent"
                  - "organizations:ListPolicies"
                  - "organizations:ListRoots"
                  - "organizations:ListTargetsForPolicy"
                  - "rds:DescribeDBClusterSnapshotAttributes"
                  - "rds:DescribeDBClusterSnapshots"
                  - "rds:DescribeDBClusters"
                  - "rds:DescribeDBInstances"
                  - "rds:DescribeDBProxies"
                  - "rds:DescribeDBSnapshotAttributes"
                  - "rds:DescribeDBSnapshots"
                  - "redshift-serverless:ListNamespaces"
                  - "redshift-serverless:ListWorkgroups"
                  - "redshift:DescribeClusters"
                  - "redshift:DescribeLoggingStatus"
                  - "rolesanywhere:ListProfiles"
                  - "rolesanywhere:ListTrustAnchors"
                  - "route53:GetDNSSEC"
                  - "route53:ListHostedZones"
                  - "route53:ListQueryLoggingConfigs"
                  - "route53resolver:ListResolverDnssecConfigs"
                  - "s3:GetAccessPointPolicy"
                  - "s3:GetAccessPointPolicyStatus"
                  - "s3:GetAccountPublicAccessBlock"
                  - "s3:GetBucketAcl"
                  - "s3:GetBucketLocation"
                  - "s3:GetBucketLogging"
                  - "s3:GetBucketPolicy"
                  - "s3:GetBucketPolicyStatus"
                  - "s3:GetBucketPublicAccessBlock"
                  - "s3:GetBucketVersioning"
                  - "s3:GetEncryptionConfiguration"
                  - "s3:ListAccessPoints"
                  - "s3:ListAllMyBuckets"
                  - "s3express:GetBucketPolicy"
                  - "s3express:ListAllMyDirectoryBuckets"
                  - "sagemaker:DescribeNotebookInstance"
                  - "sagemaker:ListNotebookInstances"
                  - "secretsmanager:GetResourcePolicy"
                  - "secretsmanager:ListSecrets"
                  - "securityhub:DescribeHub"
                  - "securityhub:GetFindings"
                  - "shield:DescribeSubscription"
                  - "sns:GetTopicAttributes"
                  - "sns:ListTopics"
                  - "sqs:GetQueueAttributes"
                  - "sqs:ListQueues"
                  - "ssm:DescribeDocumentPermission"
                  - "ssm:DescribeParameters"
                  - "ssm:GetDocument"
                  - "ssm:ListDocuments"
                  - "sso:DescribePermissionSet"
                  - "sso:GetInlinePolicyForPermissionSet"
                  - "sso:ListAccountAssignments"
                  - "sso:ListInstances"
                  - "sso:ListManagedPoliciesInPermissionSet"
                  - "sso:ListPermissionSets"
                  - "sso:ListPermissionSetsProvisionedToAccount"
                  - "states:DescribeStateMachine"
                  - "states:ListStateMachines"
                  - "support:DescribeTrustedAdvisorCheckResult"
                  - "transfer:ListServers"
                  - "transfer:ListUsers"
                  - "wafv2:GetLoggingConfiguration"
                  - "wafv2:GetWebACL"
                  - "wafv2:ListWebACLs"
                  - "workspaces:DescribeWorkspaces"
                "Resource": "*"
Outputs:
  RoleArn:
    Description: "Paste this into AccessLens if you used a non-default role name."
    Value: !GetAtt AccessLensReadOnlyRole.Arn

Terraform

An aws_iam_role and an aws_iam_role_policy, with the policies as heredocs.

# AccessLens read-only role for account 444455556666.
# Creates exactly one IAM role with an inline read-only policy.

resource "aws_iam_role" "accesslens_readonly" {
  name                 = "AccessLensReadOnly"
  description          = "Read-only access for AccessLens. Created by AccessLens; safe to delete."
  max_session_duration = 3600
  assume_role_policy   = <<-EOT
    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Sid": "AccessLensHub",
          "Effect": "Allow",
          "Principal": {
            "AWS": "arn:aws:iam::111122223333:root"
          },
          "Action": "sts:AssumeRole",
          "Condition": {
            "ArnLike": {
              "aws:PrincipalArn": "arn:aws:iam::111122223333:role/aws-reserved/sso.amazonaws.com/*AWSReservedSSO_Security_Audit_*"
            },
            "StringEquals": {
              "aws:PrincipalOrgID": "o-exampleorg",
              "sts:ExternalId": "0123456789abcdef0123456789abcdef"
            }
          }
        }
      ]
    }
  EOT
}

resource "aws_iam_role_policy" "accesslens_readonly" {
  name   = "AccessLensReadOnlyPolicy"
  role   = aws_iam_role.accesslens_readonly.id
  policy = <<-EOT
    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Sid": "AccessLensReadOnly",
          "Effect": "Allow",
          "Action": [
            "access-analyzer:ListAnalyzers",
            "access-analyzer:ListFindings",
            "account:GetAlternateContact",
            "acm-pca:GetPolicy",
            "acm-pca:ListCertificateAuthorities",
            "acm:ListCertificates",
            "airflow:GetEnvironment",
            "airflow:ListEnvironments",
            "apigateway:GET",
            "appsync:ListGraphqlApis",
            "athena:GetWorkGroup",
            "athena:ListWorkGroups",
            "backup:GetBackupVaultAccessPolicy",
            "backup:ListBackupPlans",
            "backup:ListBackupVaults",
            "bedrock:GetCustomModel",
            "bedrock:GetModelInvocationLoggingConfiguration",
            "bedrock:ListAgents",
            "bedrock:ListCustomModels",
            "cloudfront:GetDistributionConfig",
            "cloudfront:ListDistributions",
            "cloudhsm:DescribeClusters",
            "cloudtrail:DescribeTrails",
            "cloudtrail:GetTrailStatus",
            "cloudtrail:LookupEvents",
            "cloudwatch:DescribeAlarms",
            "cognito-identity:DescribeIdentityPool",
            "cognito-identity:GetIdentityPoolRoles",
            "cognito-identity:ListIdentityPools",
            "cognito-idp:DescribeUserPool",
            "cognito-idp:ListUserPools",
            "config:DescribeConfigurationRecorderStatus",
            "config:DescribeConfigurationRecorders",
            "dax:DescribeClusters",
            "ds:DescribeDirectories",
            "ds:DescribeLDAPSSettings",
            "ds:ListLogSubscriptions",
            "dynamodb:DescribeContinuousBackups",
            "dynamodb:DescribeTable",
            "dynamodb:GetResourcePolicy",
            "dynamodb:ListTables",
            "ec2:DescribeFlowLogs",
            "ec2:DescribeImages",
            "ec2:DescribeInstances",
            "ec2:DescribeNetworkAcls",
            "ec2:DescribeRegions",
            "ec2:DescribeSecurityGroups",
            "ec2:DescribeSnapshots",
            "ec2:DescribeTransitGateways",
            "ec2:DescribeVolumes",
            "ec2:DescribeVpcEndpoints",
            "ec2:DescribeVpcs",
            "ec2:GetEbsEncryptionByDefault",
            "ecr:DescribeRepositories",
            "ecr:GetRegistryScanningConfiguration",
            "ecr:GetRepositoryPolicy",
            "ecs:DescribeClusters",
            "ecs:DescribeTaskDefinition",
            "ecs:ListClusters",
            "ecs:ListTaskDefinitionFamilies",
            "eks:DescribeCluster",
            "eks:ListClusters",
            "elasticache:DescribeReplicationGroups",
            "elasticfilesystem:DescribeFileSystemPolicy",
            "elasticfilesystem:DescribeFileSystems",
            "elasticloadbalancing:DescribeListeners",
            "elasticloadbalancing:DescribeLoadBalancerAttributes",
            "elasticloadbalancing:DescribeLoadBalancers",
            "elasticmapreduce:DescribeCluster",
            "elasticmapreduce:GetBlockPublicAccessConfiguration",
            "elasticmapreduce:ListClusters",
            "es:DescribeDomains",
            "es:ListDomainNames",
            "events:ListEventBuses",
            "firehose:DescribeDeliveryStream",
            "firehose:ListDeliveryStreams",
            "glue:GetDataCatalogEncryptionSettings",
            "glue:GetJobs",
            "guardduty:GetDetector",
            "guardduty:ListDetectors",
            "iam:GenerateCredentialReport",
            "iam:GenerateServiceLastAccessedDetails",
            "iam:GetAccountAuthorizationDetails",
            "iam:GetAccountPasswordPolicy",
            "iam:GetAccountSummary",
            "iam:GetCredentialReport",
            "iam:GetOpenIDConnectProvider",
            "iam:GetServiceLastAccessedDetails",
            "iam:ListOpenIDConnectProviders",
            "iam:ListOrganizationsFeatures",
            "iam:ListSAMLProviders",
            "iam:ListServerCertificates",
            "iam:ListServiceSpecificCredentials",
            "iam:ListVirtualMFADevices",
            "kafka:ListClustersV2",
            "kinesis:DescribeStreamSummary",
            "kinesis:ListStreams",
            "kms:DescribeKey",
            "kms:GetKeyPolicy",
            "kms:GetKeyRotationStatus",
            "kms:ListKeys",
            "lambda:GetPolicy",
            "lambda:ListFunctionUrlConfigs",
            "lambda:ListFunctions",
            "logs:DescribeLogGroups",
            "logs:DescribeMetricFilters",
            "macie2:GetMacieSession",
            "memorydb:DescribeClusters",
            "memorydb:DescribeUsers",
            "network-firewall:DescribeFirewall",
            "network-firewall:DescribeFirewallPolicy",
            "network-firewall:DescribeLoggingConfiguration",
            "network-firewall:ListFirewalls",
            "oam:GetSinkPolicy",
            "oam:ListLinks",
            "oam:ListSinks",
            "organizations:DescribeOrganization",
            "organizations:DescribePolicy",
            "organizations:ListAccounts",
            "organizations:ListAccountsForParent",
            "organizations:ListOrganizationalUnitsForParent",
            "organizations:ListPolicies",
            "organizations:ListRoots",
            "organizations:ListTargetsForPolicy",
            "rds:DescribeDBClusterSnapshotAttributes",
            "rds:DescribeDBClusterSnapshots",
            "rds:DescribeDBClusters",
            "rds:DescribeDBInstances",
            "rds:DescribeDBProxies",
            "rds:DescribeDBSnapshotAttributes",
            "rds:DescribeDBSnapshots",
            "redshift-serverless:ListNamespaces",
            "redshift-serverless:ListWorkgroups",
            "redshift:DescribeClusters",
            "redshift:DescribeLoggingStatus",
            "rolesanywhere:ListProfiles",
            "rolesanywhere:ListTrustAnchors",
            "route53:GetDNSSEC",
            "route53:ListHostedZones",
            "route53:ListQueryLoggingConfigs",
            "route53resolver:ListResolverDnssecConfigs",
            "s3:GetAccessPointPolicy",
            "s3:GetAccessPointPolicyStatus",
            "s3:GetAccountPublicAccessBlock",
            "s3:GetBucketAcl",
            "s3:GetBucketLocation",
            "s3:GetBucketLogging",
            "s3:GetBucketPolicy",
            "s3:GetBucketPolicyStatus",
            "s3:GetBucketPublicAccessBlock",
            "s3:GetBucketVersioning",
            "s3:GetEncryptionConfiguration",
            "s3:ListAccessPoints",
            "s3:ListAllMyBuckets",
            "s3express:GetBucketPolicy",
            "s3express:ListAllMyDirectoryBuckets",
            "sagemaker:DescribeNotebookInstance",
            "sagemaker:ListNotebookInstances",
            "secretsmanager:GetResourcePolicy",
            "secretsmanager:ListSecrets",
            "securityhub:DescribeHub",
            "securityhub:GetFindings",
            "shield:DescribeSubscription",
            "sns:GetTopicAttributes",
            "sns:ListTopics",
            "sqs:GetQueueAttributes",
            "sqs:ListQueues",
            "ssm:DescribeDocumentPermission",
            "ssm:DescribeParameters",
            "ssm:GetDocument",
            "ssm:ListDocuments",
            "sso:DescribePermissionSet",
            "sso:GetInlinePolicyForPermissionSet",
            "sso:ListAccountAssignments",
            "sso:ListInstances",
            "sso:ListManagedPoliciesInPermissionSet",
            "sso:ListPermissionSets",
            "sso:ListPermissionSetsProvisionedToAccount",
            "states:DescribeStateMachine",
            "states:ListStateMachines",
            "support:DescribeTrustedAdvisorCheckResult",
            "transfer:ListServers",
            "transfer:ListUsers",
            "wafv2:GetLoggingConfiguration",
            "wafv2:GetWebACL",
            "wafv2:ListWebACLs",
            "workspaces:DescribeWorkspaces"
          ],
          "Resource": "*"
        }
      ]
    }
  EOT
}

output "accesslens_role_arn" {
  value = aws_iam_role.accesslens_readonly.arn
}

AWS CLI

A bash script that runs create-role and put-role-policy. Run it with credentials for the target account.

#!/usr/bin/env bash
# AccessLens read-only role for account 444455556666.
# Run with credentials for account 444455556666 that can create IAM roles
# (for example: AWS_PROFILE=<admin-profile-for-444455556666> bash create-accesslens-role.sh).
# Creates exactly one IAM role with an inline read-only policy.
set -euo pipefail

ROLE_NAME="AccessLensReadOnly"
POLICY_NAME="AccessLensReadOnlyPolicy"

TRUST_POLICY=$(cat <<'JSON'
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AccessLensHub",
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::111122223333:root"
      },
      "Action": "sts:AssumeRole",
      "Condition": {
        "ArnLike": {
          "aws:PrincipalArn": "arn:aws:iam::111122223333:role/aws-reserved/sso.amazonaws.com/*AWSReservedSSO_Security_Audit_*"
        },
        "StringEquals": {
          "aws:PrincipalOrgID": "o-exampleorg",
          "sts:ExternalId": "0123456789abcdef0123456789abcdef"
        }
      }
    }
  ]
}
JSON
)

PERMISSIONS_POLICY=$(cat <<'JSON'
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AccessLensReadOnly",
      "Effect": "Allow",
      "Action": [
        "access-analyzer:ListAnalyzers",
        "access-analyzer:ListFindings",
        "account:GetAlternateContact",
        "acm-pca:GetPolicy",
        "acm-pca:ListCertificateAuthorities",
        "acm:ListCertificates",
        "airflow:GetEnvironment",
        "airflow:ListEnvironments",
        "apigateway:GET",
        "appsync:ListGraphqlApis",
        "athena:GetWorkGroup",
        "athena:ListWorkGroups",
        "backup:GetBackupVaultAccessPolicy",
        "backup:ListBackupPlans",
        "backup:ListBackupVaults",
        "bedrock:GetCustomModel",
        "bedrock:GetModelInvocationLoggingConfiguration",
        "bedrock:ListAgents",
        "bedrock:ListCustomModels",
        "cloudfront:GetDistributionConfig",
        "cloudfront:ListDistributions",
        "cloudhsm:DescribeClusters",
        "cloudtrail:DescribeTrails",
        "cloudtrail:GetTrailStatus",
        "cloudtrail:LookupEvents",
        "cloudwatch:DescribeAlarms",
        "cognito-identity:DescribeIdentityPool",
        "cognito-identity:GetIdentityPoolRoles",
        "cognito-identity:ListIdentityPools",
        "cognito-idp:DescribeUserPool",
        "cognito-idp:ListUserPools",
        "config:DescribeConfigurationRecorderStatus",
        "config:DescribeConfigurationRecorders",
        "dax:DescribeClusters",
        "ds:DescribeDirectories",
        "ds:DescribeLDAPSSettings",
        "ds:ListLogSubscriptions",
        "dynamodb:DescribeContinuousBackups",
        "dynamodb:DescribeTable",
        "dynamodb:GetResourcePolicy",
        "dynamodb:ListTables",
        "ec2:DescribeFlowLogs",
        "ec2:DescribeImages",
        "ec2:DescribeInstances",
        "ec2:DescribeNetworkAcls",
        "ec2:DescribeRegions",
        "ec2:DescribeSecurityGroups",
        "ec2:DescribeSnapshots",
        "ec2:DescribeTransitGateways",
        "ec2:DescribeVolumes",
        "ec2:DescribeVpcEndpoints",
        "ec2:DescribeVpcs",
        "ec2:GetEbsEncryptionByDefault",
        "ecr:DescribeRepositories",
        "ecr:GetRegistryScanningConfiguration",
        "ecr:GetRepositoryPolicy",
        "ecs:DescribeClusters",
        "ecs:DescribeTaskDefinition",
        "ecs:ListClusters",
        "ecs:ListTaskDefinitionFamilies",
        "eks:DescribeCluster",
        "eks:ListClusters",
        "elasticache:DescribeReplicationGroups",
        "elasticfilesystem:DescribeFileSystemPolicy",
        "elasticfilesystem:DescribeFileSystems",
        "elasticloadbalancing:DescribeListeners",
        "elasticloadbalancing:DescribeLoadBalancerAttributes",
        "elasticloadbalancing:DescribeLoadBalancers",
        "elasticmapreduce:DescribeCluster",
        "elasticmapreduce:GetBlockPublicAccessConfiguration",
        "elasticmapreduce:ListClusters",
        "es:DescribeDomains",
        "es:ListDomainNames",
        "events:ListEventBuses",
        "firehose:DescribeDeliveryStream",
        "firehose:ListDeliveryStreams",
        "glue:GetDataCatalogEncryptionSettings",
        "glue:GetJobs",
        "guardduty:GetDetector",
        "guardduty:ListDetectors",
        "iam:GenerateCredentialReport",
        "iam:GenerateServiceLastAccessedDetails",
        "iam:GetAccountAuthorizationDetails",
        "iam:GetAccountPasswordPolicy",
        "iam:GetAccountSummary",
        "iam:GetCredentialReport",
        "iam:GetOpenIDConnectProvider",
        "iam:GetServiceLastAccessedDetails",
        "iam:ListOpenIDConnectProviders",
        "iam:ListOrganizationsFeatures",
        "iam:ListSAMLProviders",
        "iam:ListServerCertificates",
        "iam:ListServiceSpecificCredentials",
        "iam:ListVirtualMFADevices",
        "kafka:ListClustersV2",
        "kinesis:DescribeStreamSummary",
        "kinesis:ListStreams",
        "kms:DescribeKey",
        "kms:GetKeyPolicy",
        "kms:GetKeyRotationStatus",
        "kms:ListKeys",
        "lambda:GetPolicy",
        "lambda:ListFunctionUrlConfigs",
        "lambda:ListFunctions",
        "logs:DescribeLogGroups",
        "logs:DescribeMetricFilters",
        "macie2:GetMacieSession",
        "memorydb:DescribeClusters",
        "memorydb:DescribeUsers",
        "network-firewall:DescribeFirewall",
        "network-firewall:DescribeFirewallPolicy",
        "network-firewall:DescribeLoggingConfiguration",
        "network-firewall:ListFirewalls",
        "oam:GetSinkPolicy",
        "oam:ListLinks",
        "oam:ListSinks",
        "organizations:DescribeOrganization",
        "organizations:DescribePolicy",
        "organizations:ListAccounts",
        "organizations:ListAccountsForParent",
        "organizations:ListOrganizationalUnitsForParent",
        "organizations:ListPolicies",
        "organizations:ListRoots",
        "organizations:ListTargetsForPolicy",
        "rds:DescribeDBClusterSnapshotAttributes",
        "rds:DescribeDBClusterSnapshots",
        "rds:DescribeDBClusters",
        "rds:DescribeDBInstances",
        "rds:DescribeDBProxies",
        "rds:DescribeDBSnapshotAttributes",
        "rds:DescribeDBSnapshots",
        "redshift-serverless:ListNamespaces",
        "redshift-serverless:ListWorkgroups",
        "redshift:DescribeClusters",
        "redshift:DescribeLoggingStatus",
        "rolesanywhere:ListProfiles",
        "rolesanywhere:ListTrustAnchors",
        "route53:GetDNSSEC",
        "route53:ListHostedZones",
        "route53:ListQueryLoggingConfigs",
        "route53resolver:ListResolverDnssecConfigs",
        "s3:GetAccessPointPolicy",
        "s3:GetAccessPointPolicyStatus",
        "s3:GetAccountPublicAccessBlock",
        "s3:GetBucketAcl",
        "s3:GetBucketLocation",
        "s3:GetBucketLogging",
        "s3:GetBucketPolicy",
        "s3:GetBucketPolicyStatus",
        "s3:GetBucketPublicAccessBlock",
        "s3:GetBucketVersioning",
        "s3:GetEncryptionConfiguration",
        "s3:ListAccessPoints",
        "s3:ListAllMyBuckets",
        "s3express:GetBucketPolicy",
        "s3express:ListAllMyDirectoryBuckets",
        "sagemaker:DescribeNotebookInstance",
        "sagemaker:ListNotebookInstances",
        "secretsmanager:GetResourcePolicy",
        "secretsmanager:ListSecrets",
        "securityhub:DescribeHub",
        "securityhub:GetFindings",
        "shield:DescribeSubscription",
        "sns:GetTopicAttributes",
        "sns:ListTopics",
        "sqs:GetQueueAttributes",
        "sqs:ListQueues",
        "ssm:DescribeDocumentPermission",
        "ssm:DescribeParameters",
        "ssm:GetDocument",
        "ssm:ListDocuments",
        "sso:DescribePermissionSet",
        "sso:GetInlinePolicyForPermissionSet",
        "sso:ListAccountAssignments",
        "sso:ListInstances",
        "sso:ListManagedPoliciesInPermissionSet",
        "sso:ListPermissionSets",
        "sso:ListPermissionSetsProvisionedToAccount",
        "states:DescribeStateMachine",
        "states:ListStateMachines",
        "support:DescribeTrustedAdvisorCheckResult",
        "transfer:ListServers",
        "transfer:ListUsers",
        "wafv2:GetLoggingConfiguration",
        "wafv2:GetWebACL",
        "wafv2:ListWebACLs",
        "workspaces:DescribeWorkspaces"
      ],
      "Resource": "*"
    }
  ]
}
JSON
)

aws iam create-role \
  --role-name "$ROLE_NAME" \
  --description "Read-only access for AccessLens. Created by AccessLens; safe to delete." \
  --max-session-duration 3600 \
  --assume-role-policy-document "$TRUST_POLICY"

aws iam put-role-policy \
  --role-name "$ROLE_NAME" \
  --policy-name "$POLICY_NAME" \
  --policy-document "$PERMISSIONS_POLICY"

echo "Created arn:aws:iam::444455556666:role/AccessLensReadOnly"

Many accounts: a CloudFormation StackSet

For a whole organization, the app generates a template for a service-managed StackSet that creates the same role in every account of the OUs you choose, and the commands to deploy it from the management account. You run them; AccessLens doesn't. A StackSet uses one template everywhere, so it needs one organization-wide ExternalId, which is off until you turn it on in the app; the app explains the trade-off first. Service-managed StackSets don't deploy to the management account itself. See Many accounts: a StackSet.

AWSTemplateFormatVersion: "2010-09-09"
Description: "AccessLens read-only role, for a service-managed StackSet. Creates exactly one IAM role with an inline read-only policy in each target account. Every account uses the organization-wide ExternalId."
Resources:
  AccessLensReadOnlyRole:
    Type: "AWS::IAM::Role"
    Properties:
      RoleName: "AccessLensReadOnly"
      Description: "Read-only access for AccessLens. Created by AccessLens; safe to delete."
      MaxSessionDuration: 3600
      AssumeRolePolicyDocument:
        "Version": "2012-10-17"
        "Statement":
          - "Sid": "AccessLensHub"
            "Effect": "Allow"
            "Principal":
              "AWS": "arn:aws:iam::111122223333:root"
            "Action": "sts:AssumeRole"
            "Condition":
              "ArnLike":
                "aws:PrincipalArn": "arn:aws:iam::111122223333:role/aws-reserved/sso.amazonaws.com/*AWSReservedSSO_Security_Audit_*"
              "StringEquals":
                "aws:PrincipalOrgID": "o-exampleorg"
                "sts:ExternalId": "0123456789abcdef0123456789abcdef"
      Policies:
        - PolicyName: "AccessLensReadOnlyPolicy"
          PolicyDocument:
            "Version": "2012-10-17"
            "Statement":
              - "Sid": "AccessLensReadOnly"
                "Effect": "Allow"
                "Action":
                  - "access-analyzer:ListAnalyzers"
                  - "access-analyzer:ListFindings"
                  - "account:GetAlternateContact"
                  - "acm-pca:GetPolicy"
                  - "acm-pca:ListCertificateAuthorities"
                  - "acm:ListCertificates"
                  - "airflow:GetEnvironment"
                  - "airflow:ListEnvironments"
                  - "apigateway:GET"
                  - "appsync:ListGraphqlApis"
                  - "athena:GetWorkGroup"
                  - "athena:ListWorkGroups"
                  - "backup:GetBackupVaultAccessPolicy"
                  - "backup:ListBackupPlans"
                  - "backup:ListBackupVaults"
                  - "bedrock:GetCustomModel"
                  - "bedrock:GetModelInvocationLoggingConfiguration"
                  - "bedrock:ListAgents"
                  - "bedrock:ListCustomModels"
                  - "cloudfront:GetDistributionConfig"
                  - "cloudfront:ListDistributions"
                  - "cloudhsm:DescribeClusters"
                  - "cloudtrail:DescribeTrails"
                  - "cloudtrail:GetTrailStatus"
                  - "cloudtrail:LookupEvents"
                  - "cloudwatch:DescribeAlarms"
                  - "cognito-identity:DescribeIdentityPool"
                  - "cognito-identity:GetIdentityPoolRoles"
                  - "cognito-identity:ListIdentityPools"
                  - "cognito-idp:DescribeUserPool"
                  - "cognito-idp:ListUserPools"
                  - "config:DescribeConfigurationRecorderStatus"
                  - "config:DescribeConfigurationRecorders"
                  - "dax:DescribeClusters"
                  - "ds:DescribeDirectories"
                  - "ds:DescribeLDAPSSettings"
                  - "ds:ListLogSubscriptions"
                  - "dynamodb:DescribeContinuousBackups"
                  - "dynamodb:DescribeTable"
                  - "dynamodb:GetResourcePolicy"
                  - "dynamodb:ListTables"
                  - "ec2:DescribeFlowLogs"
                  - "ec2:DescribeImages"
                  - "ec2:DescribeInstances"
                  - "ec2:DescribeNetworkAcls"
                  - "ec2:DescribeRegions"
                  - "ec2:DescribeSecurityGroups"
                  - "ec2:DescribeSnapshots"
                  - "ec2:DescribeTransitGateways"
                  - "ec2:DescribeVolumes"
                  - "ec2:DescribeVpcEndpoints"
                  - "ec2:DescribeVpcs"
                  - "ec2:GetEbsEncryptionByDefault"
                  - "ecr:DescribeRepositories"
                  - "ecr:GetRegistryScanningConfiguration"
                  - "ecr:GetRepositoryPolicy"
                  - "ecs:DescribeClusters"
                  - "ecs:DescribeTaskDefinition"
                  - "ecs:ListClusters"
                  - "ecs:ListTaskDefinitionFamilies"
                  - "eks:DescribeCluster"
                  - "eks:ListClusters"
                  - "elasticache:DescribeReplicationGroups"
                  - "elasticfilesystem:DescribeFileSystemPolicy"
                  - "elasticfilesystem:DescribeFileSystems"
                  - "elasticloadbalancing:DescribeListeners"
                  - "elasticloadbalancing:DescribeLoadBalancerAttributes"
                  - "elasticloadbalancing:DescribeLoadBalancers"
                  - "elasticmapreduce:DescribeCluster"
                  - "elasticmapreduce:GetBlockPublicAccessConfiguration"
                  - "elasticmapreduce:ListClusters"
                  - "es:DescribeDomains"
                  - "es:ListDomainNames"
                  - "events:ListEventBuses"
                  - "firehose:DescribeDeliveryStream"
                  - "firehose:ListDeliveryStreams"
                  - "glue:GetDataCatalogEncryptionSettings"
                  - "glue:GetJobs"
                  - "guardduty:GetDetector"
                  - "guardduty:ListDetectors"
                  - "iam:GenerateCredentialReport"
                  - "iam:GenerateServiceLastAccessedDetails"
                  - "iam:GetAccountAuthorizationDetails"
                  - "iam:GetAccountPasswordPolicy"
                  - "iam:GetAccountSummary"
                  - "iam:GetCredentialReport"
                  - "iam:GetOpenIDConnectProvider"
                  - "iam:GetServiceLastAccessedDetails"
                  - "iam:ListOpenIDConnectProviders"
                  - "iam:ListOrganizationsFeatures"
                  - "iam:ListSAMLProviders"
                  - "iam:ListServerCertificates"
                  - "iam:ListServiceSpecificCredentials"
                  - "iam:ListVirtualMFADevices"
                  - "kafka:ListClustersV2"
                  - "kinesis:DescribeStreamSummary"
                  - "kinesis:ListStreams"
                  - "kms:DescribeKey"
                  - "kms:GetKeyPolicy"
                  - "kms:GetKeyRotationStatus"
                  - "kms:ListKeys"
                  - "lambda:GetPolicy"
                  - "lambda:ListFunctionUrlConfigs"
                  - "lambda:ListFunctions"
                  - "logs:DescribeLogGroups"
                  - "logs:DescribeMetricFilters"
                  - "macie2:GetMacieSession"
                  - "memorydb:DescribeClusters"
                  - "memorydb:DescribeUsers"
                  - "network-firewall:DescribeFirewall"
                  - "network-firewall:DescribeFirewallPolicy"
                  - "network-firewall:DescribeLoggingConfiguration"
                  - "network-firewall:ListFirewalls"
                  - "oam:GetSinkPolicy"
                  - "oam:ListLinks"
                  - "oam:ListSinks"
                  - "organizations:DescribeOrganization"
                  - "organizations:DescribePolicy"
                  - "organizations:ListAccounts"
                  - "organizations:ListAccountsForParent"
                  - "organizations:ListOrganizationalUnitsForParent"
                  - "organizations:ListPolicies"
                  - "organizations:ListRoots"
                  - "organizations:ListTargetsForPolicy"
                  - "rds:DescribeDBClusterSnapshotAttributes"
                  - "rds:DescribeDBClusterSnapshots"
                  - "rds:DescribeDBClusters"
                  - "rds:DescribeDBInstances"
                  - "rds:DescribeDBProxies"
                  - "rds:DescribeDBSnapshotAttributes"
                  - "rds:DescribeDBSnapshots"
                  - "redshift-serverless:ListNamespaces"
                  - "redshift-serverless:ListWorkgroups"
                  - "redshift:DescribeClusters"
                  - "redshift:DescribeLoggingStatus"
                  - "rolesanywhere:ListProfiles"
                  - "rolesanywhere:ListTrustAnchors"
                  - "route53:GetDNSSEC"
                  - "route53:ListHostedZones"
                  - "route53:ListQueryLoggingConfigs"
                  - "route53resolver:ListResolverDnssecConfigs"
                  - "s3:GetAccessPointPolicy"
                  - "s3:GetAccessPointPolicyStatus"
                  - "s3:GetAccountPublicAccessBlock"
                  - "s3:GetBucketAcl"
                  - "s3:GetBucketLocation"
                  - "s3:GetBucketLogging"
                  - "s3:GetBucketPolicy"
                  - "s3:GetBucketPolicyStatus"
                  - "s3:GetBucketPublicAccessBlock"
                  - "s3:GetBucketVersioning"
                  - "s3:GetEncryptionConfiguration"
                  - "s3:ListAccessPoints"
                  - "s3:ListAllMyBuckets"
                  - "s3express:GetBucketPolicy"
                  - "s3express:ListAllMyDirectoryBuckets"
                  - "sagemaker:DescribeNotebookInstance"
                  - "sagemaker:ListNotebookInstances"
                  - "secretsmanager:GetResourcePolicy"
                  - "secretsmanager:ListSecrets"
                  - "securityhub:DescribeHub"
                  - "securityhub:GetFindings"
                  - "shield:DescribeSubscription"
                  - "sns:GetTopicAttributes"
                  - "sns:ListTopics"
                  - "sqs:GetQueueAttributes"
                  - "sqs:ListQueues"
                  - "ssm:DescribeDocumentPermission"
                  - "ssm:DescribeParameters"
                  - "ssm:GetDocument"
                  - "ssm:ListDocuments"
                  - "sso:DescribePermissionSet"
                  - "sso:GetInlinePolicyForPermissionSet"
                  - "sso:ListAccountAssignments"
                  - "sso:ListInstances"
                  - "sso:ListManagedPoliciesInPermissionSet"
                  - "sso:ListPermissionSets"
                  - "sso:ListPermissionSetsProvisionedToAccount"
                  - "states:DescribeStateMachine"
                  - "states:ListStateMachines"
                  - "support:DescribeTrustedAdvisorCheckResult"
                  - "transfer:ListServers"
                  - "transfer:ListUsers"
                  - "wafv2:GetLoggingConfiguration"
                  - "wafv2:GetWebACL"
                  - "wafv2:ListWebACLs"
                  - "workspaces:DescribeWorkspaces"
                "Resource": "*"
Outputs:
  RoleArn:
    Value: !GetAtt AccessLensReadOnlyRole.Arn
# Run in the organization's management account, or add --call-as DELEGATED_ADMIN
# in a CloudFormation delegated administrator account. Trusted access for
# CloudFormation StackSets must be on in AWS Organizations.
# Save the template as accesslens-stackset.yaml first.

aws cloudformation create-stack-set   --stack-set-name accesslens-readonly-role   --template-body file://accesslens-stackset.yaml   --permission-model SERVICE_MANAGED   --auto-deployment Enabled=true,RetainStacksOnAccountRemoval=false   --capabilities CAPABILITY_NAMED_IAM

# Deploy to your OUs (replace the IDs). The role is global, so one region is enough.
# With auto-deployment on, accounts added to these OUs later get the role too.
aws cloudformation create-stack-instances   --stack-set-name accesslens-readonly-role   --deployment-targets OrganizationalUnitIds=ou-abcd-11111111,ou-abcd-22222222   --regions us-east-1   --operation-preferences FailureTolerancePercentage=0,MaxConcurrentPercentage=25

# Service-managed StackSets never deploy to the management account itself.
# Set that account up from Accounts like any other.
Option 2

One-click create: the only write AccessLens makes

If one of your permission sets in the target account can call iam:CreateRole and iam:PutRolePolicy, AccessLens can create the role for you. You review the role name, both policies and the API calls it will make, choose that permission set, tick the confirmation and type the account ID. Then the app checks:

  • that the plan's SHA-256 digest matches what you previewed, so nothing can change in between;
  • that the account ID you typed is the target;
  • that sts:GetCallerIdentity confirms the credentials belong to that account.

It's idempotent: an existing role with the same trust policy is reused, and the inline policy is written only if it's missing or different. A role with the same name and a different trust policy is never modified or deleted; the wizard lets you pick another name or shows a script to delete it yourself. AccessLens attaches no managed policies, creates no policy objects, adds no tags and deletes nothing.

Verify

Verify assumes the role with the account's ExternalId and makes one read per permission group, reporting each as works, denied, not applicable or error. A role created moments ago is retried for up to 20 seconds while IAM makes it usable.

Uninstall

Remove it

AccessLens created nothing else, so deleting the role removes it completely. Removing an account inside the app only deletes local data; it never calls AWS. Use the method that matches how you created the role.

CloudFormation

# If you created the role with the CloudFormation template (stack name shown is the suggested one):
aws cloudformation delete-stack --stack-name accesslens-readonly-role
aws cloudformation wait stack-delete-complete --stack-name accesslens-readonly-role
# This deletes arn:aws:iam::444455556666:role/AccessLensReadOnly and nothing else.

Terraform

terraform destroy -target=aws_iam_role_policy.accesslens_readonly -target=aws_iam_role.accesslens_readonly

AWS CLI

#!/usr/bin/env bash
# Removes the AccessLens role from account 444455556666. Run with credentials for that account.
set -euo pipefail
aws iam delete-role-policy --role-name "AccessLensReadOnly" --policy-name "AccessLensReadOnlyPolicy"
aws iam delete-role --role-name "AccessLensReadOnly"
echo "Removed arn:aws:iam::444455556666:role/AccessLensReadOnly. AccessLens created nothing else in this account."

StackSet

# Remove the role from the OUs, then delete the StackSet (management account).
aws cloudformation delete-stack-instances   --stack-set-name accesslens-readonly-role   --deployment-targets OrganizationalUnitIds=ou-abcd-11111111,ou-abcd-22222222   --regions us-east-1   --no-retain-stacks
aws cloudformation delete-stack-set --stack-set-name accesslens-readonly-role

Can't create a role at all? An account can be scanned with an Identity Center permission set's own credentials instead, if that permission set grants the reads AccessLens needs. The app labels these accounts as a fallback, and missing permissions show up as skipped checks.