2023/11/27 - Access Analyzer - 4 new3 updated api methods
Changes IAM Access Analyzer now continuously monitors IAM roles and users in your AWS account or organization to generate findings for unused access. Additionally, IAM Access Analyzer now provides custom policy checks to validate that IAM policies adhere to your security standards ahead of deployments.
Retrieves a list of findings generated by the specified analyzer.
To learn about filter keys that you can use to retrieve a list of findings, see IAM Access Analyzer filter keys in the IAM User Guide.
See also: AWS API Documentation
Request Syntax
client.list_findings_v2( analyzerArn='string', filter={ 'string': { 'eq': [ 'string', ], 'neq': [ 'string', ], 'contains': [ 'string', ], 'exists': True|False } }, maxResults=123, nextToken='string', sort={ 'attributeName': 'string', 'orderBy': 'ASC'|'DESC' } )
string
[REQUIRED]
The ARN of the analyzer to retrieve findings from.
dict
A filter to match for the findings to return.
(string) --
(dict) --
The criteria to use in the filter that defines the archive rule. For more information on available filter keys, see IAM Access Analyzer filter keys.
eq (list) --
An "equals" operator to match for the filter used to create the rule.
(string) --
neq (list) --
A "not equals" operator to match for the filter used to create the rule.
(string) --
contains (list) --
A "contains" operator to match for the filter used to create the rule.
(string) --
exists (boolean) --
An "exists" operator to match for the filter used to create the rule.
integer
The maximum number of results to return in the response.
string
A token used for pagination of results returned.
dict
The criteria used to sort.
attributeName (string) --
The name of the attribute to sort on.
orderBy (string) --
The sort order, ascending or descending.
dict
Response Syntax
{ 'findings': [ { 'analyzedAt': datetime(2015, 1, 1), 'createdAt': datetime(2015, 1, 1), 'error': 'string', 'id': 'string', 'resource': 'string', 'resourceType': 'AWS::S3::Bucket'|'AWS::IAM::Role'|'AWS::SQS::Queue'|'AWS::Lambda::Function'|'AWS::Lambda::LayerVersion'|'AWS::KMS::Key'|'AWS::SecretsManager::Secret'|'AWS::EFS::FileSystem'|'AWS::EC2::Snapshot'|'AWS::ECR::Repository'|'AWS::RDS::DBSnapshot'|'AWS::RDS::DBClusterSnapshot'|'AWS::SNS::Topic', 'resourceOwnerAccount': 'string', 'status': 'ACTIVE'|'ARCHIVED'|'RESOLVED', 'updatedAt': datetime(2015, 1, 1), 'findingType': 'ExternalAccess'|'UnusedIAMRole'|'UnusedIAMUserAccessKey'|'UnusedIAMUserPassword'|'UnusedPermission' }, ], 'nextToken': 'string' }
Response Structure
(dict) --
findings (list) --
A list of findings retrieved from the analyzer that match the filter criteria specified, if any.
(dict) --
Contains information about a finding.
analyzedAt (datetime) --
The time at which the resource-based policy or IAM entity that generated the finding was analyzed.
createdAt (datetime) --
The time at which the finding was created.
error (string) --
The error that resulted in an Error finding.
id (string) --
The ID of the finding.
resource (string) --
The resource that the external principal has access to.
resourceType (string) --
The type of the resource that the external principal has access to.
resourceOwnerAccount (string) --
The Amazon Web Services account ID that owns the resource.
status (string) --
The status of the finding.
updatedAt (datetime) --
The time at which the finding was most recently updated.
findingType (string) --
The type of the external access or unused access finding.
nextToken (string) --
A token used for pagination of results returned.
Retrieves information about the specified finding.
See also: AWS API Documentation
Request Syntax
client.get_finding_v2( analyzerArn='string', id='string', maxResults=123, nextToken='string' )
string
[REQUIRED]
The ARN of the analyzer that generated the finding.
string
[REQUIRED]
The ID of the finding to retrieve.
integer
The maximum number of results to return in the response.
string
A token used for pagination of results returned.
dict
Response Syntax
{ 'analyzedAt': datetime(2015, 1, 1), 'createdAt': datetime(2015, 1, 1), 'error': 'string', 'id': 'string', 'nextToken': 'string', 'resource': 'string', 'resourceType': 'AWS::S3::Bucket'|'AWS::IAM::Role'|'AWS::SQS::Queue'|'AWS::Lambda::Function'|'AWS::Lambda::LayerVersion'|'AWS::KMS::Key'|'AWS::SecretsManager::Secret'|'AWS::EFS::FileSystem'|'AWS::EC2::Snapshot'|'AWS::ECR::Repository'|'AWS::RDS::DBSnapshot'|'AWS::RDS::DBClusterSnapshot'|'AWS::SNS::Topic', 'resourceOwnerAccount': 'string', 'status': 'ACTIVE'|'ARCHIVED'|'RESOLVED', 'updatedAt': datetime(2015, 1, 1), 'findingDetails': [ { 'externalAccessDetails': { 'action': [ 'string', ], 'condition': { 'string': 'string' }, 'isPublic': True|False, 'principal': { 'string': 'string' }, 'sources': [ { 'type': 'POLICY'|'BUCKET_ACL'|'S3_ACCESS_POINT'|'S3_ACCESS_POINT_ACCOUNT', 'detail': { 'accessPointArn': 'string', 'accessPointAccount': 'string' } }, ] }, 'unusedPermissionDetails': { 'actions': [ { 'action': 'string', 'lastAccessed': datetime(2015, 1, 1) }, ], 'serviceNamespace': 'string', 'lastAccessed': datetime(2015, 1, 1) }, 'unusedIamUserAccessKeyDetails': { 'accessKeyId': 'string', 'lastAccessed': datetime(2015, 1, 1) }, 'unusedIamRoleDetails': { 'lastAccessed': datetime(2015, 1, 1) }, 'unusedIamUserPasswordDetails': { 'lastAccessed': datetime(2015, 1, 1) } }, ], 'findingType': 'ExternalAccess'|'UnusedIAMRole'|'UnusedIAMUserAccessKey'|'UnusedIAMUserPassword'|'UnusedPermission' }
Response Structure
(dict) --
analyzedAt (datetime) --
The time at which the resource-based policy or IAM entity that generated the finding was analyzed.
createdAt (datetime) --
The time at which the finding was created.
error (string) --
An error.
id (string) --
The ID of the finding to retrieve.
nextToken (string) --
A token used for pagination of results returned.
resource (string) --
The resource that generated the finding.
resourceType (string) --
The type of the resource identified in the finding.
resourceOwnerAccount (string) --
Tye Amazon Web Services account ID that owns the resource.
status (string) --
The status of the finding.
updatedAt (datetime) --
The time at which the finding was updated.
findingDetails (list) --
A localized message that explains the finding and provides guidance on how to address it.
(dict) --
Contains information about an external access or unused access finding. Only one parameter can be used in a FindingDetails object.
externalAccessDetails (dict) --
The details for an external access analyzer finding.
action (list) --
The action in the analyzed policy statement that an external principal has permission to use.
(string) --
condition (dict) --
The condition in the analyzed policy statement that resulted in an external access finding.
(string) --
(string) --
isPublic (boolean) --
Specifies whether the external access finding is public.
principal (dict) --
The external principal that has access to a resource within the zone of trust.
(string) --
(string) --
sources (list) --
The sources of the external access finding. This indicates how the access that generated the finding is granted. It is populated for Amazon S3 bucket findings.
(dict) --
The source of the finding. This indicates how the access that generated the finding is granted. It is populated for Amazon S3 bucket findings.
type (string) --
Indicates the type of access that generated the finding.
detail (dict) --
Includes details about how the access that generated the finding is granted. This is populated for Amazon S3 bucket findings.
accessPointArn (string) --
The ARN of the access point that generated the finding. The ARN format depends on whether the ARN represents an access point or a multi-region access point.
accessPointAccount (string) --
The account of the cross-account access point that generated the finding.
unusedPermissionDetails (dict) --
The details for an unused access analyzer finding with an unused permission finding type.
actions (list) --
A list of unused actions for which the unused access finding was generated.
(dict) --
Contains information about an unused access finding for an action. IAM Access Analyzer charges for unused access analysis based on the number of IAM roles and users analyzed per month. For more details on pricing, see IAM Access Analyzer pricing.
action (string) --
The action for which the unused access finding was generated.
lastAccessed (datetime) --
The time at which the action was last accessed.
serviceNamespace (string) --
The namespace of the Amazon Web Services service that contains the unused actions.
lastAccessed (datetime) --
The time at which the permission last accessed.
unusedIamUserAccessKeyDetails (dict) --
The details for an unused access analyzer finding with an unused IAM user access key finding type.
accessKeyId (string) --
The ID of the access key for which the unused access finding was generated.
lastAccessed (datetime) --
The time at which the access key was last accessed.
unusedIamRoleDetails (dict) --
The details for an unused access analyzer finding with an unused IAM role finding type.
lastAccessed (datetime) --
The time at which the role was last accessed.
unusedIamUserPasswordDetails (dict) --
The details for an unused access analyzer finding with an unused IAM user password finding type.
lastAccessed (datetime) --
The time at which the password was last accessed.
findingType (string) --
The type of the finding. For external access analyzers, the type is ExternalAccess. For unused access analyzers, the type can be UnusedIAMRole, UnusedIAMUserAccessKey, UnusedIAMUserPassword, or UnusedPermission.
Checks whether new access is allowed for an updated policy when compared to the existing policy.
You can find examples for reference policies and learn how to set up and run a custom policy check for new access in the IAM Access Analyzer custom policy checks samples repository on GitHub. The reference policies in this repository are meant to be passed to the existingPolicyDocument request parameter.
See also: AWS API Documentation
Request Syntax
client.check_no_new_access( newPolicyDocument='string', existingPolicyDocument='string', policyType='IDENTITY_POLICY'|'RESOURCE_POLICY' )
string
[REQUIRED]
The JSON policy document to use as the content for the updated policy.
string
[REQUIRED]
The JSON policy document to use as the content for the existing policy.
string
[REQUIRED]
The type of policy to compare. Identity policies grant permissions to IAM principals. Identity policies include managed and inline policies for IAM roles, users, and groups.
Resource policies grant permissions on Amazon Web Services resources. Resource policies include trust policies for IAM roles and bucket policies for Amazon S3 buckets. You can provide a generic input such as identity policy or resource policy or a specific input such as managed policy or Amazon S3 bucket policy.
dict
Response Syntax
{ 'result': 'PASS'|'FAIL', 'message': 'string', 'reasons': [ { 'description': 'string', 'statementIndex': 123, 'statementId': 'string' }, ] }
Response Structure
(dict) --
result (string) --
The result of the check for new access. If the result is PASS, no new access is allowed by the updated policy. If the result is FAIL, the updated policy might allow new access.
message (string) --
The message indicating whether the updated policy allows new access.
reasons (list) --
A description of the reasoning of the result.
(dict) --
Contains information about the reasoning why a check for access passed or failed.
description (string) --
A description of the reasoning of a result of checking for access.
statementIndex (integer) --
The index number of the reason statement.
statementId (string) --
The identifier for the reason statement.
Checks whether the specified access isn't allowed by a policy.
See also: AWS API Documentation
Request Syntax
client.check_access_not_granted( policyDocument='string', access=[ { 'actions': [ 'string', ] }, ], policyType='IDENTITY_POLICY'|'RESOURCE_POLICY' )
string
[REQUIRED]
The JSON policy document to use as the content for the policy.
list
[REQUIRED]
An access object containing the permissions that shouldn't be granted by the specified policy.
(dict) --
Contains information about actions that define permissions to check against a policy.
actions (list) -- [REQUIRED]
A list of actions for the access permissions.
(string) --
string
[REQUIRED]
The type of policy. Identity policies grant permissions to IAM principals. Identity policies include managed and inline policies for IAM roles, users, and groups.
Resource policies grant permissions on Amazon Web Services resources. Resource policies include trust policies for IAM roles and bucket policies for Amazon S3 buckets. You can provide a generic input such as identity policy or resource policy or a specific input such as managed policy or Amazon S3 bucket policy.
dict
Response Syntax
{ 'result': 'PASS'|'FAIL', 'message': 'string', 'reasons': [ { 'description': 'string', 'statementIndex': 123, 'statementId': 'string' }, ] }
Response Structure
(dict) --
result (string) --
The result of the check for whether the access is allowed. If the result is PASS, the specified policy doesn't allow any of the specified permissions in the access object. If the result is FAIL, the specified policy might allow some or all of the permissions in the access object.
message (string) --
The message indicating whether the specified access is allowed.
reasons (list) --
A description of the reasoning of the result.
(dict) --
Contains information about the reasoning why a check for access passed or failed.
description (string) --
A description of the reasoning of a result of checking for access.
statementIndex (integer) --
The index number of the reason statement.
statementId (string) --
The identifier for the reason statement.
{'configuration': {'unusedAccess': {'unusedAccessAge': 'integer'}}, 'type': {'ACCOUNT_UNUSED_ACCESS', 'ORGANIZATION_UNUSED_ACCESS'}}
Creates an analyzer for your account.
See also: AWS API Documentation
Request Syntax
client.create_analyzer( analyzerName='string', type='ACCOUNT'|'ORGANIZATION'|'ACCOUNT_UNUSED_ACCESS'|'ORGANIZATION_UNUSED_ACCESS', archiveRules=[ { 'ruleName': 'string', 'filter': { 'string': { 'eq': [ 'string', ], 'neq': [ 'string', ], 'contains': [ 'string', ], 'exists': True|False } } }, ], tags={ 'string': 'string' }, clientToken='string', configuration={ 'unusedAccess': { 'unusedAccessAge': 123 } } )
string
[REQUIRED]
The name of the analyzer to create.
string
[REQUIRED]
The type of analyzer to create. Only ACCOUNT, ORGANIZATION, ACCOUNT_UNUSED_ACCESS, and ORGANIZTAION_UNUSED_ACCESS analyzers are supported. You can create only one analyzer per account per Region. You can create up to 5 analyzers per organization per Region.
list
Specifies the archive rules to add for the analyzer. Archive rules automatically archive findings that meet the criteria you define for the rule.
(dict) --
An criterion statement in an archive rule. Each archive rule may have multiple criteria.
ruleName (string) -- [REQUIRED]
The name of the rule.
filter (dict) -- [REQUIRED]
The condition and values for a criterion.
(string) --
(dict) --
The criteria to use in the filter that defines the archive rule. For more information on available filter keys, see IAM Access Analyzer filter keys.
eq (list) --
An "equals" operator to match for the filter used to create the rule.
(string) --
neq (list) --
A "not equals" operator to match for the filter used to create the rule.
(string) --
contains (list) --
A "contains" operator to match for the filter used to create the rule.
(string) --
exists (boolean) --
An "exists" operator to match for the filter used to create the rule.
dict
An array of key-value pairs to apply to the analyzer.
(string) --
(string) --
string
A client token.
This field is autopopulated if not provided.
dict
Specifies the configuration of the analyzer. If the analyzer is an unused access analyzer, the specified scope of unused access is used for the configuration. If the analyzer is an external access analyzer, this field is not used.
unusedAccess (dict) --
Specifies the configuration of an unused access analyzer for an Amazon Web Services organization or account. External access analyzers do not support any configuration.
unusedAccessAge (integer) --
The specified access age in days for which to generate findings for unused access. For example, if you specify 90 days, the analyzer will generate findings for IAM entities within the accounts of the selected organization for any access that hasn't been used in 90 or more days since the analyzer's last scan. You can choose a value between 1 and 180 days.
dict
Response Syntax
{ 'arn': 'string' }
Response Structure
(dict) --
The response to the request to create an analyzer.
arn (string) --
The ARN of the analyzer that was created by the request.
{'analyzer': {'configuration': {'unusedAccess': {'unusedAccessAge': 'integer'}}, 'type': {'ACCOUNT_UNUSED_ACCESS', 'ORGANIZATION_UNUSED_ACCESS'}}}
Retrieves information about the specified analyzer.
See also: AWS API Documentation
Request Syntax
client.get_analyzer( analyzerName='string' )
string
[REQUIRED]
The name of the analyzer retrieved.
dict
Response Syntax
{ 'analyzer': { 'arn': 'string', 'name': 'string', 'type': 'ACCOUNT'|'ORGANIZATION'|'ACCOUNT_UNUSED_ACCESS'|'ORGANIZATION_UNUSED_ACCESS', 'createdAt': datetime(2015, 1, 1), 'lastResourceAnalyzed': 'string', 'lastResourceAnalyzedAt': datetime(2015, 1, 1), 'tags': { 'string': 'string' }, 'status': 'ACTIVE'|'CREATING'|'DISABLED'|'FAILED', 'statusReason': { 'code': 'AWS_SERVICE_ACCESS_DISABLED'|'DELEGATED_ADMINISTRATOR_DEREGISTERED'|'ORGANIZATION_DELETED'|'SERVICE_LINKED_ROLE_CREATION_FAILED' }, 'configuration': { 'unusedAccess': { 'unusedAccessAge': 123 } } } }
Response Structure
(dict) --
The response to the request.
analyzer (dict) --
An AnalyzerSummary object that contains information about the analyzer.
arn (string) --
The ARN of the analyzer.
name (string) --
The name of the analyzer.
type (string) --
The type of analyzer, which corresponds to the zone of trust chosen for the analyzer.
createdAt (datetime) --
A timestamp for the time at which the analyzer was created.
lastResourceAnalyzed (string) --
The resource that was most recently analyzed by the analyzer.
lastResourceAnalyzedAt (datetime) --
The time at which the most recently analyzed resource was analyzed.
tags (dict) --
The tags added to the analyzer.
(string) --
(string) --
status (string) --
The status of the analyzer. An Active analyzer successfully monitors supported resources and generates new findings. The analyzer is Disabled when a user action, such as removing trusted access for Identity and Access Management Access Analyzer from Organizations, causes the analyzer to stop generating new findings. The status is Creating when the analyzer creation is in progress and Failed when the analyzer creation has failed.
statusReason (dict) --
The statusReason provides more details about the current status of the analyzer. For example, if the creation for the analyzer fails, a Failed status is returned. For an analyzer with organization as the type, this failure can be due to an issue with creating the service-linked roles required in the member accounts of the Amazon Web Services organization.
code (string) --
The reason code for the current status of the analyzer.
configuration (dict) --
Specifies whether the analyzer is an external access or unused access analyzer.
unusedAccess (dict) --
Specifies the configuration of an unused access analyzer for an Amazon Web Services organization or account. External access analyzers do not support any configuration.
unusedAccessAge (integer) --
The specified access age in days for which to generate findings for unused access. For example, if you specify 90 days, the analyzer will generate findings for IAM entities within the accounts of the selected organization for any access that hasn't been used in 90 or more days since the analyzer's last scan. You can choose a value between 1 and 180 days.
{'type': {'ACCOUNT_UNUSED_ACCESS', 'ORGANIZATION_UNUSED_ACCESS'}}Response
{'analyzers': {'configuration': {'unusedAccess': {'unusedAccessAge': 'integer'}}, 'type': {'ACCOUNT_UNUSED_ACCESS', 'ORGANIZATION_UNUSED_ACCESS'}}}
Retrieves a list of analyzers.
See also: AWS API Documentation
Request Syntax
client.list_analyzers( nextToken='string', maxResults=123, type='ACCOUNT'|'ORGANIZATION'|'ACCOUNT_UNUSED_ACCESS'|'ORGANIZATION_UNUSED_ACCESS' )
string
A token used for pagination of results returned.
integer
The maximum number of results to return in the response.
string
The type of analyzer.
dict
Response Syntax
{ 'analyzers': [ { 'arn': 'string', 'name': 'string', 'type': 'ACCOUNT'|'ORGANIZATION'|'ACCOUNT_UNUSED_ACCESS'|'ORGANIZATION_UNUSED_ACCESS', 'createdAt': datetime(2015, 1, 1), 'lastResourceAnalyzed': 'string', 'lastResourceAnalyzedAt': datetime(2015, 1, 1), 'tags': { 'string': 'string' }, 'status': 'ACTIVE'|'CREATING'|'DISABLED'|'FAILED', 'statusReason': { 'code': 'AWS_SERVICE_ACCESS_DISABLED'|'DELEGATED_ADMINISTRATOR_DEREGISTERED'|'ORGANIZATION_DELETED'|'SERVICE_LINKED_ROLE_CREATION_FAILED' }, 'configuration': { 'unusedAccess': { 'unusedAccessAge': 123 } } }, ], 'nextToken': 'string' }
Response Structure
(dict) --
The response to the request.
analyzers (list) --
The analyzers retrieved.
(dict) --
Contains information about the analyzer.
arn (string) --
The ARN of the analyzer.
name (string) --
The name of the analyzer.
type (string) --
The type of analyzer, which corresponds to the zone of trust chosen for the analyzer.
createdAt (datetime) --
A timestamp for the time at which the analyzer was created.
lastResourceAnalyzed (string) --
The resource that was most recently analyzed by the analyzer.
lastResourceAnalyzedAt (datetime) --
The time at which the most recently analyzed resource was analyzed.
tags (dict) --
The tags added to the analyzer.
(string) --
(string) --
status (string) --
The status of the analyzer. An Active analyzer successfully monitors supported resources and generates new findings. The analyzer is Disabled when a user action, such as removing trusted access for Identity and Access Management Access Analyzer from Organizations, causes the analyzer to stop generating new findings. The status is Creating when the analyzer creation is in progress and Failed when the analyzer creation has failed.
statusReason (dict) --
The statusReason provides more details about the current status of the analyzer. For example, if the creation for the analyzer fails, a Failed status is returned. For an analyzer with organization as the type, this failure can be due to an issue with creating the service-linked roles required in the member accounts of the Amazon Web Services organization.
code (string) --
The reason code for the current status of the analyzer.
configuration (dict) --
Specifies whether the analyzer is an external access or unused access analyzer.
unusedAccess (dict) --
Specifies the configuration of an unused access analyzer for an Amazon Web Services organization or account. External access analyzers do not support any configuration.
unusedAccessAge (integer) --
The specified access age in days for which to generate findings for unused access. For example, if you specify 90 days, the analyzer will generate findings for IAM entities within the accounts of the selected organization for any access that hasn't been used in 90 or more days since the analyzer's last scan. You can choose a value between 1 and 180 days.
nextToken (string) --
A token used for pagination of results returned.