get_bucket_statistics

get_bucket_statistics(**kwargs)

Retrieves (queries) aggregated statistical data about all the S3 buckets that Amazon Macie monitors and analyzes for an account.

See also: AWS API Documentation

Request Syntax

response = client.get_bucket_statistics(
    accountId='string'
)
Parameters
accountId (string) -- The unique identifier for the Amazon Web Services account.
Return type
dict
Returns
Response Syntax
{
    'bucketCount': 123,
    'bucketCountByEffectivePermission': {
        'publiclyAccessible': 123,
        'publiclyReadable': 123,
        'publiclyWritable': 123,
        'unknown': 123
    },
    'bucketCountByEncryptionType': {
        'kmsManaged': 123,
        's3Managed': 123,
        'unencrypted': 123,
        'unknown': 123
    },
    'bucketCountByObjectEncryptionRequirement': {
        'allowsUnencryptedObjectUploads': 123,
        'deniesUnencryptedObjectUploads': 123,
        'unknown': 123
    },
    'bucketCountBySharedAccessType': {
        'external': 123,
        'internal': 123,
        'notShared': 123,
        'unknown': 123
    },
    'bucketStatisticsBySensitivity': {
        'classificationError': {
            'classifiableSizeInBytes': 123,
            'publiclyAccessibleCount': 123,
            'totalCount': 123,
            'totalSizeInBytes': 123
        },
        'notClassified': {
            'classifiableSizeInBytes': 123,
            'publiclyAccessibleCount': 123,
            'totalCount': 123,
            'totalSizeInBytes': 123
        },
        'notSensitive': {
            'classifiableSizeInBytes': 123,
            'publiclyAccessibleCount': 123,
            'totalCount': 123,
            'totalSizeInBytes': 123
        },
        'sensitive': {
            'classifiableSizeInBytes': 123,
            'publiclyAccessibleCount': 123,
            'totalCount': 123,
            'totalSizeInBytes': 123
        }
    },
    'classifiableObjectCount': 123,
    'classifiableSizeInBytes': 123,
    'lastUpdated': datetime(2015, 1, 1),
    'objectCount': 123,
    'sizeInBytes': 123,
    'sizeInBytesCompressed': 123,
    'unclassifiableObjectCount': {
        'fileType': 123,
        'storageClass': 123,
        'total': 123
    },
    'unclassifiableObjectSizeInBytes': {
        'fileType': 123,
        'storageClass': 123,
        'total': 123
    }
}

Response Structure

  • (dict) --

    The request succeeded.

    • bucketCount (integer) --

      The total number of buckets.

    • bucketCountByEffectivePermission (dict) --

      The total number of buckets that are publicly accessible due to a combination of permissions settings for each bucket.

      • publiclyAccessible (integer) --

        The total number of buckets that allow the general public to have read or write access to the bucket.

      • publiclyReadable (integer) --

        The total number of buckets that allow the general public to have read access to the bucket.

      • publiclyWritable (integer) --

        The total number of buckets that allow the general public to have write access to the bucket.

      • unknown (integer) --

        The total number of buckets that Amazon Macie wasn't able to evaluate permissions settings for. Macie can't determine whether these buckets are publicly accessible.

    • bucketCountByEncryptionType (dict) --

      The total number of buckets that use certain types of server-side encryption to encrypt new objects by default. This object also reports the total number of buckets that don't encrypt new objects by default.

      • kmsManaged (integer) --

        The total number of buckets that use an KMS key to encrypt new objects by default, either an Amazon Web Services managed key or a customer managed key. These buckets use KMS encryption (SSE-KMS) by default.

      • s3Managed (integer) --

        The total number of buckets that use an Amazon S3 managed key to encrypt new objects by default. These buckets use Amazon S3 managed encryption (SSE-S3) by default.

      • unencrypted (integer) --

        The total number of buckets that don't encrypt new objects by default. Default encryption is disabled for these buckets.

      • unknown (integer) --

        The total number of buckets that Amazon Macie doesn't have current encryption metadata for. Macie can't provide current data about the default encryption settings for these buckets.

    • bucketCountByObjectEncryptionRequirement (dict) --

      The total number of buckets whose bucket policies do or don't require server-side encryption of objects when objects are uploaded to the buckets.

      • allowsUnencryptedObjectUploads (integer) --

        The total number of buckets that don't have a bucket policy or have a bucket policy that doesn't require server-side encryption of new objects. If a bucket policy exists, the policy doesn't require PutObject requests to include a valid server-side encryption header: the x-amz-server-side-encryption header with a value of AES256 or aws:kms, or the x-amz-server-side-encryption-customer-algorithm header with a value of AES256.

      • deniesUnencryptedObjectUploads (integer) --

        The total number of buckets whose bucket policies require server-side encryption of new objects. PutObject requests for these buckets must include a valid server-side encryption header: the x-amz-server-side-encryption header with a value of AES256 or aws:kms, or the x-amz-server-side-encryption-customer-algorithm header with a value of AES256.

      • unknown (integer) --

        The total number of buckets that Amazon Macie wasn't able to evaluate server-side encryption requirements for. Macie can't determine whether the bucket policies for these buckets require server-side encryption of new objects.

    • bucketCountBySharedAccessType (dict) --

      The total number of buckets that are or aren't shared with other Amazon Web Services accounts, Amazon CloudFront origin access identities (OAIs), or CloudFront origin access controls (OACs).

      • external (integer) --

        The total number of buckets that are shared with one or more of the following or any combination of the following: an Amazon Web Services account that isn't in the same Amazon Macie organization, an Amazon CloudFront OAI, or a CloudFront OAC.

      • internal (integer) --

        The total number of buckets that are shared with one or more Amazon Web Services accounts in the same Amazon Macie organization. These buckets aren't shared with Amazon CloudFront OAIs or OACs.

      • notShared (integer) --

        The total number of buckets that aren't shared with other Amazon Web Services accounts, Amazon CloudFront OAIs, or CloudFront OACs.

      • unknown (integer) --

        The total number of buckets that Amazon Macie wasn't able to evaluate shared access settings for. Macie can't determine whether these buckets are shared with other Amazon Web Services accounts, Amazon CloudFront OAIs, or CloudFront OACs.

    • bucketStatisticsBySensitivity (dict) --

      The aggregated sensitive data discovery statistics for the buckets. If automated sensitive data discovery is currently disabled for your account, the value for each statistic is 0.

      • classificationError (dict) --

        The aggregated statistical data for all buckets that have a sensitivity score of -1.

        • classifiableSizeInBytes (integer) --

          The total storage size, in bytes, of all the objects that Amazon Macie can analyze in the buckets. These objects use a supported storage class and have a file name extension for a supported file or storage format.

          If versioning is enabled for any of the buckets, this value is based on the size of the latest version of each applicable object in the buckets. This value doesn't reflect the storage size of all versions of all applicable objects in the buckets.

        • publiclyAccessibleCount (integer) --

          The total number of buckets that are publicly accessible due to a combination of permissions settings for each bucket.

        • totalCount (integer) --

          The total number of buckets.

        • totalSizeInBytes (integer) --

          The total storage size, in bytes, of the buckets.

          If versioning is enabled for any of the buckets, this value is based on the size of the latest version of each object in the buckets. This value doesn't reflect the storage size of all versions of the objects in the buckets.

      • notClassified (dict) --

        The aggregated statistical data for all buckets that have a sensitivity score of 50.

        • classifiableSizeInBytes (integer) --

          The total storage size, in bytes, of all the objects that Amazon Macie can analyze in the buckets. These objects use a supported storage class and have a file name extension for a supported file or storage format.

          If versioning is enabled for any of the buckets, this value is based on the size of the latest version of each applicable object in the buckets. This value doesn't reflect the storage size of all versions of all applicable objects in the buckets.

        • publiclyAccessibleCount (integer) --

          The total number of buckets that are publicly accessible due to a combination of permissions settings for each bucket.

        • totalCount (integer) --

          The total number of buckets.

        • totalSizeInBytes (integer) --

          The total storage size, in bytes, of the buckets.

          If versioning is enabled for any of the buckets, this value is based on the size of the latest version of each object in the buckets. This value doesn't reflect the storage size of all versions of the objects in the buckets.

      • notSensitive (dict) --

        The aggregated statistical data for all buckets that have a sensitivity score of 1-49.

        • classifiableSizeInBytes (integer) --

          The total storage size, in bytes, of all the objects that Amazon Macie can analyze in the buckets. These objects use a supported storage class and have a file name extension for a supported file or storage format.

          If versioning is enabled for any of the buckets, this value is based on the size of the latest version of each applicable object in the buckets. This value doesn't reflect the storage size of all versions of all applicable objects in the buckets.

        • publiclyAccessibleCount (integer) --

          The total number of buckets that are publicly accessible due to a combination of permissions settings for each bucket.

        • totalCount (integer) --

          The total number of buckets.

        • totalSizeInBytes (integer) --

          The total storage size, in bytes, of the buckets.

          If versioning is enabled for any of the buckets, this value is based on the size of the latest version of each object in the buckets. This value doesn't reflect the storage size of all versions of the objects in the buckets.

      • sensitive (dict) --

        The aggregated statistical data for all buckets that have a sensitivity score of 51-100.

        • classifiableSizeInBytes (integer) --

          The total storage size, in bytes, of all the objects that Amazon Macie can analyze in the buckets. These objects use a supported storage class and have a file name extension for a supported file or storage format.

          If versioning is enabled for any of the buckets, this value is based on the size of the latest version of each applicable object in the buckets. This value doesn't reflect the storage size of all versions of all applicable objects in the buckets.

        • publiclyAccessibleCount (integer) --

          The total number of buckets that are publicly accessible due to a combination of permissions settings for each bucket.

        • totalCount (integer) --

          The total number of buckets.

        • totalSizeInBytes (integer) --

          The total storage size, in bytes, of the buckets.

          If versioning is enabled for any of the buckets, this value is based on the size of the latest version of each object in the buckets. This value doesn't reflect the storage size of all versions of the objects in the buckets.

    • classifiableObjectCount (integer) --

      The total number of objects that Amazon Macie can analyze in the buckets. These objects use a supported storage class and have a file name extension for a supported file or storage format.

    • classifiableSizeInBytes (integer) --

      The total storage size, in bytes, of all the objects that Amazon Macie can analyze in the buckets. These objects use a supported storage class and have a file name extension for a supported file or storage format.

      If versioning is enabled for any of the buckets, this value is based on the size of the latest version of each applicable object in the buckets. This value doesn't reflect the storage size of all versions of all applicable objects in the buckets.

    • lastUpdated (datetime) --

      The date and time, in UTC and extended ISO 8601 format, when Amazon Macie most recently retrieved bucket or object metadata from Amazon S3 for the buckets.

    • objectCount (integer) --

      The total number of objects in the buckets.

    • sizeInBytes (integer) --

      The total storage size, in bytes, of the buckets.

      If versioning is enabled for any of the buckets, this value is based on the size of the latest version of each object in the buckets. This value doesn't reflect the storage size of all versions of the objects in the buckets.

    • sizeInBytesCompressed (integer) --

      The total storage size, in bytes, of the objects that are compressed (.gz, .gzip, .zip) files in the buckets.

      If versioning is enabled for any of the buckets, this value is based on the size of the latest version of each applicable object in the buckets. This value doesn't reflect the storage size of all versions of the applicable objects in the buckets.

    • unclassifiableObjectCount (dict) --

      The total number of objects that Amazon Macie can't analyze in the buckets. These objects don't use a supported storage class or don't have a file name extension for a supported file or storage format.

      • fileType (integer) --

        The total storage size (in bytes) or number of objects that Amazon Macie can't analyze because the objects don't have a file name extension for a supported file or storage format.

      • storageClass (integer) --

        The total storage size (in bytes) or number of objects that Amazon Macie can't analyze because the objects use an unsupported storage class.

      • total (integer) --

        The total storage size (in bytes) or number of objects that Amazon Macie can't analyze because the objects use an unsupported storage class or don't have a file name extension for a supported file or storage format.

    • unclassifiableObjectSizeInBytes (dict) --

      The total storage size, in bytes, of the objects that Amazon Macie can't analyze in the buckets. These objects don't use a supported storage class or don't have a file name extension for a supported file or storage format.

      • fileType (integer) --

        The total storage size (in bytes) or number of objects that Amazon Macie can't analyze because the objects don't have a file name extension for a supported file or storage format.

      • storageClass (integer) --

        The total storage size (in bytes) or number of objects that Amazon Macie can't analyze because the objects use an unsupported storage class.

      • total (integer) --

        The total storage size (in bytes) or number of objects that Amazon Macie can't analyze because the objects use an unsupported storage class or don't have a file name extension for a supported file or storage format.

Exceptions

  • Macie2.Client.exceptions.ValidationException
  • Macie2.Client.exceptions.InternalServerException
  • Macie2.Client.exceptions.ServiceQuotaExceededException
  • Macie2.Client.exceptions.AccessDeniedException
  • Macie2.Client.exceptions.ResourceNotFoundException
  • Macie2.Client.exceptions.ThrottlingException
  • Macie2.Client.exceptions.ConflictException