Skip to content

aws.macie2.get_bucket_statistics

Example SQL Queries

SELECT * FROM
aws.macie2.get_bucket_statistics;

Description

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

Table Definition

Column NameColumn Data Type
account_id Input Column

The unique identifier for the Amazon Web Services account.

VARCHAR
_aws_profile Input Column

The AWS profile defines the AWS identity used. It can be defined via credentials or by assuming a IAM role.

STRUCT(
"type" VARCHAR,
"name" VARCHAR,
"account_id" VARCHAR,
"via_profile_name" VARCHAR,
"assumed_role_arn" VARCHAR,
"organization" STRUCT(
"account_name" VARCHAR,
"id" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[],
"master_account" STRUCT(
"id" VARCHAR,
"email" VARCHAR
),
"parents" STRUCT(
"type" VARCHAR,
"id" VARCHAR,
"name" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[]
)[]
)
)
Show child fields
_aws_profile.account_id

The AWS account id

_aws_profile.assumed_role_arn

The ARN of the assumed role

_aws_profile.name

The unique name of the profile.

_aws_profile.organization

Information about this profile's membership in the AWS organization.

Show child fields
_aws_profile.organization.account_name

The name of account speciifed by the organization

_aws_profile.organization.id

The organization id

_aws_profile.organization.master_account
Show child fields
_aws_profile.organization.master_account.email

The organization master account email address

_aws_profile.organization.master_account.id

The organization master account id

_aws_profile.organization.parents[]
Show child fields
_aws_profile.organization.parents[].id

The id of the parent

_aws_profile.organization.parents[].name

The name of the parent

_aws_profile.organization.parents[].tags[]
Show child fields
_aws_profile.organization.parents[].tags[].key
_aws_profile.organization.parents[].tags[].value
_aws_profile.organization.parents[].type

The type of parent can be an organization unit or a root

_aws_profile.organization.tags[]
Show child fields
_aws_profile.organization.tags[].key
_aws_profile.organization.tags[].value
_aws_profile.type

The type of profile, either 'credentials' or 'assumed_role'

_aws_profile.via_profile_name

This IAM role for this profile is assumed by first utilizing another profile with this name to obtain credentials.

_aws_region Input Column

The AWS region to use.

VARCHAR
bucket_count

The total number of buckets.

BIGINT
bucket_count_by_effective_permission

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

STRUCT(
"publicly_accessible" BIGINT,
"publicly_readable" BIGINT,
"publicly_writable" BIGINT,
"unknown" BIGINT
)
Show child fields
bucket_count_by_effective_permission.publicly_accessible

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

bucket_count_by_effective_permission.publicly_readable

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

bucket_count_by_effective_permission.publicly_writable

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

bucket_count_by_effective_permission.unknown

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.

bucket_count_by_encryption_type

The total number of buckets whose settings do or don't specify default server-side encryption behavior for objects that are added to the buckets.

STRUCT(
"kms_managed" BIGINT,
"s3_managed" BIGINT,
"unencrypted" BIGINT,
"unknown" BIGINT
)
Show child fields
bucket_count_by_encryption_type.kms_managed

The total number of buckets whose default encryption settings are configured to encrypt new objects with an KMS key, either an Amazon Web Services managed key or a customer managed key. By default, these buckets encrypt new objects automatically using DSSE-KMS or SSE-KMS encryption.

bucket_count_by_encryption_type.s3_managed

The total number of buckets whose default encryption settings are configured to encrypt new objects with an Amazon S3 managed key. By default, these buckets encrypt new objects automatically using SSE-S3 encryption.

bucket_count_by_encryption_type.unencrypted

The total number of buckets that don't specify default server-side encryption behavior for new objects. Default encryption settings aren't configured for these buckets.

bucket_count_by_encryption_type.unknown

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.

bucket_count_by_object_encryption_requirement

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

STRUCT(
"allows_unencrypted_object_uploads" BIGINT,
"denies_unencrypted_object_uploads" BIGINT,
"unknown" BIGINT
)
Show child fields
bucket_count_by_object_encryption_requirement.allows_unencrypted_object_uploads

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.

bucket_count_by_object_encryption_requirement.denies_unencrypted_object_uploads

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.

bucket_count_by_object_encryption_requirement.unknown

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.

bucket_count_by_shared_access_type

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

STRUCT(
"external" BIGINT,
"internal" BIGINT,
"not_shared" BIGINT,
"unknown" BIGINT
)
Show child fields
bucket_count_by_shared_access_type.external

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

bucket_count_by_shared_access_type.internal

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.

bucket_count_by_shared_access_type.not_shared

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

bucket_count_by_shared_access_type.unknown

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.

bucket_statistics_by_sensitivity

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.

STRUCT(
"classification_error" STRUCT(
"classifiable_size_in_bytes" BIGINT,
"publicly_accessible_count" BIGINT,
"total_count" BIGINT,
"total_size_in_bytes" BIGINT
),
"not_classified" STRUCT(
"classifiable_size_in_bytes" BIGINT,
"publicly_accessible_count" BIGINT,
"total_count" BIGINT,
"total_size_in_bytes" BIGINT
),
"not_sensitive" STRUCT(
"classifiable_size_in_bytes" BIGINT,
"publicly_accessible_count" BIGINT,
"total_count" BIGINT,
"total_size_in_bytes" BIGINT
),
"sensitive" STRUCT(
"classifiable_size_in_bytes" BIGINT,
"publicly_accessible_count" BIGINT,
"total_count" BIGINT,
"total_size_in_bytes" BIGINT
)
)
Show child fields
bucket_statistics_by_sensitivity.classification_error

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

Show child fields
bucket_statistics_by_sensitivity.classification_error.classifiable_size_in_bytes

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.

bucket_statistics_by_sensitivity.classification_error.publicly_accessible_count

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

bucket_statistics_by_sensitivity.classification_error.total_count

The total number of buckets.

bucket_statistics_by_sensitivity.classification_error.total_size_in_bytes

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.

bucket_statistics_by_sensitivity.not_classified

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

Show child fields
bucket_statistics_by_sensitivity.not_classified.classifiable_size_in_bytes

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.

bucket_statistics_by_sensitivity.not_classified.publicly_accessible_count

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

bucket_statistics_by_sensitivity.not_classified.total_count

The total number of buckets.

bucket_statistics_by_sensitivity.not_classified.total_size_in_bytes

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.

bucket_statistics_by_sensitivity.not_sensitive

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

Show child fields
bucket_statistics_by_sensitivity.not_sensitive.classifiable_size_in_bytes

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.

bucket_statistics_by_sensitivity.not_sensitive.publicly_accessible_count

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

bucket_statistics_by_sensitivity.not_sensitive.total_count

The total number of buckets.

bucket_statistics_by_sensitivity.not_sensitive.total_size_in_bytes

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.

bucket_statistics_by_sensitivity.sensitive

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

Show child fields
bucket_statistics_by_sensitivity.sensitive.classifiable_size_in_bytes

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.

bucket_statistics_by_sensitivity.sensitive.publicly_accessible_count

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

bucket_statistics_by_sensitivity.sensitive.total_count

The total number of buckets.

bucket_statistics_by_sensitivity.sensitive.total_size_in_bytes

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.

classifiable_object_count

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.

BIGINT
classifiable_size_in_bytes

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.

BIGINT
last_updated

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.

TIMESTAMP_S
object_count

The total number of objects in the buckets.

BIGINT
size_in_bytes

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.

BIGINT
size_in_bytes_compressed

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.

BIGINT
unclassifiable_object_count

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.

STRUCT(
"file_type" BIGINT,
"storage_class" BIGINT,
"total" BIGINT
)
Show child fields
unclassifiable_object_count.file_type

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.

unclassifiable_object_count.storage_class

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

unclassifiable_object_count.total

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.

unclassifiable_object_size_in_bytes

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.

STRUCT(
"file_type" BIGINT,
"storage_class" BIGINT,
"total" BIGINT
)
Show child fields
unclassifiable_object_size_in_bytes.file_type

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.

unclassifiable_object_size_in_bytes.storage_class

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

unclassifiable_object_size_in_bytes.total

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.