Skip to content

aws.macie2.search_resources

Example SQL Queries

SELECT * FROM
aws.macie2.search_resources;

Description

Retrieves (queries) statistical data and other information about Amazon Web Services resources that Amazon Macie monitors and analyzes.

Table Definition

Column NameColumn Data Type
bucket_criteria Input Column

The filter conditions that determine which S3 buckets to include or exclude from the query results.

STRUCT(
"excludes" STRUCT(
"and" STRUCT(
"simple_criterion" STRUCT(
"comparator" VARCHAR,
"key" VARCHAR,
"values" VARCHAR[]
),
"tag_criterion" STRUCT(
"comparator" VARCHAR,
"tag_values" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[]
)
)[]
),
"includes" STRUCT(
"and" STRUCT(
"simple_criterion" STRUCT(
"comparator" VARCHAR,
"key" VARCHAR,
"values" VARCHAR[]
),
"tag_criterion" STRUCT(
"comparator" VARCHAR,
"tag_values" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[]
)
)[]
)
)
Show child fields
bucket_criteria.excludes

The property- and tag-based conditions that determine which buckets to exclude from the results.

Show child fields
bucket_criteria.excludes.and[]
Show child fields
bucket_criteria.excludes.and[].simple_criterion

A property-based condition that defines a property, operator, and one or more values for including or excluding resources from the results.

Show child fields
bucket_criteria.excludes.and[].simple_criterion.comparator

The operator to use in the condition. Valid values are EQ (equals) and NE (not equals).

bucket_criteria.excludes.and[].simple_criterion.key

The property to use in the condition.

bucket_criteria.excludes.and[].simple_criterion.values[]
bucket_criteria.excludes.and[].tag_criterion

A tag-based condition that defines an operator and tag keys, tag values, or tag key and value pairs for including or excluding resources from the results.

Show child fields
bucket_criteria.excludes.and[].tag_criterion.comparator

The operator to use in the condition. Valid values are EQ (equals) and NE (not equals).

bucket_criteria.excludes.and[].tag_criterion.tag_values[]
Show child fields
bucket_criteria.excludes.and[].tag_criterion.tag_values[].key

The value for the tag key to use in the condition.

bucket_criteria.excludes.and[].tag_criterion.tag_values[].value

The tag value to use in the condition.

bucket_criteria.includes

The property- and tag-based conditions that determine which buckets to include in the results.

Show child fields
bucket_criteria.includes.and[]
Show child fields
bucket_criteria.includes.and[].simple_criterion

A property-based condition that defines a property, operator, and one or more values for including or excluding resources from the results.

Show child fields
bucket_criteria.includes.and[].simple_criterion.comparator

The operator to use in the condition. Valid values are EQ (equals) and NE (not equals).

bucket_criteria.includes.and[].simple_criterion.key

The property to use in the condition.

bucket_criteria.includes.and[].simple_criterion.values[]
bucket_criteria.includes.and[].tag_criterion

A tag-based condition that defines an operator and tag keys, tag values, or tag key and value pairs for including or excluding resources from the results.

Show child fields
bucket_criteria.includes.and[].tag_criterion.comparator

The operator to use in the condition. Valid values are EQ (equals) and NE (not equals).

bucket_criteria.includes.and[].tag_criterion.tag_values[]
Show child fields
bucket_criteria.includes.and[].tag_criterion.tag_values[].key

The value for the tag key to use in the condition.

bucket_criteria.includes.and[].tag_criterion.tag_values[].value

The tag value to use in the condition.

sort_criteria Input Column

The criteria to use to sort the results.

STRUCT(
"attribute_name" VARCHAR,
"order_by" VARCHAR
)
Show child fields
sort_criteria.attribute_name

The property to sort the results by.

sort_criteria.order_by

The sort order to apply to the results, based on the value for the property specified by the attributeName property. Valid values are: ASC, sort the results in ascending order; and, DESC, sort the results in descending order.

_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
matching_bucket

The details of an S3 bucket that Amazon Macie monitors and analyzes.

STRUCT(
"account_id" VARCHAR,
"automated_discovery_monitoring_status" VARCHAR,
"bucket_name" VARCHAR,
"classifiable_object_count" BIGINT,
"classifiable_size_in_bytes" BIGINT,
"error_code" VARCHAR,
"error_message" VARCHAR,
"job_details" STRUCT(
"is_defined_in_job" VARCHAR,
"is_monitored_by_job" VARCHAR,
"last_job_id" VARCHAR,
"last_job_run_time" TIMESTAMP_S
),
"last_automated_discovery_time" TIMESTAMP_S,
"object_count" BIGINT,
"object_count_by_encryption_type" STRUCT(
"customer_managed" BIGINT,
"kms_managed" BIGINT,
"s3_managed" BIGINT,
"unencrypted" BIGINT,
"unknown" BIGINT
),
"sensitivity_score" BIGINT,
"size_in_bytes" BIGINT,
"size_in_bytes_compressed" BIGINT,
"unclassifiable_object_count" STRUCT(
"file_type" BIGINT,
"storage_class" BIGINT,
"total" BIGINT
),
"unclassifiable_object_size_in_bytes" STRUCT(
"file_type" BIGINT,
"storage_class" BIGINT,
"total" BIGINT
)
)
Show child fields
matching_bucket.account_id

The unique identifier for the Amazon Web Services account that owns the bucket.

matching_bucket.automated_discovery_monitoring_status

Specifies whether automated sensitive data discovery is currently configured to analyze objects in the bucket. Possible values are: MONITORED, the bucket is included in analyses; and, NOT_MONITORED, the bucket is excluded from analyses. If automated sensitive data discovery is disabled for your account, this value is NOT_MONITORED.

matching_bucket.bucket_name

The name of the bucket.

matching_bucket.classifiable_object_count

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

matching_bucket.classifiable_size_in_bytes

The total storage size, in bytes, of the objects that Amazon Macie can analyze in the bucket. 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 the bucket, Macie calculates this value based on the size of the latest version of each applicable object in the bucket. This value doesn't reflect the storage size of all versions of each applicable object in the bucket.

matching_bucket.error_code

The error code for an error that prevented Amazon Macie from retrieving and processing information about the bucket and the bucket's objects. If this value is ACCESS_DENIED, Macie doesn't have permission to retrieve the information. For example, the bucket has a restrictive bucket policy and Amazon S3 denied the request. If this value is null, Macie was able to retrieve and process the information.

matching_bucket.error_message

A brief description of the error (errorCode) that prevented Amazon Macie from retrieving and processing information about the bucket and the bucket's objects. This value is null if Macie was able to retrieve and process the information.

matching_bucket.job_details

Specifies whether any one-time or recurring classification jobs are configured to analyze objects in the bucket, and, if so, the details of the job that ran most recently.

Show child fields
matching_bucket.job_details.is_defined_in_job

Specifies whether any one-time or recurring jobs are configured to analyze objects in the bucket. Possible values are:

  • TRUE - The bucket is explicitly included in the bucket definition (S3BucketDefinitionForJob) for one or more jobs and at least one of those jobs has a status other than CANCELLED. Or the bucket matched the bucket criteria (S3BucketCriteriaForJob) for at least one job that previously ran.

  • FALSE - The bucket isn't explicitly included in the bucket definition (S3BucketDefinitionForJob) for any jobs, all the jobs that explicitly include the bucket in their bucket definitions have a status of CANCELLED, or the bucket didn't match the bucket criteria (S3BucketCriteriaForJob) for any jobs that previously ran.

  • UNKNOWN - An exception occurred when Amazon Macie attempted to retrieve job data for the bucket.

matching_bucket.job_details.is_monitored_by_job

Specifies whether any recurring jobs are configured to analyze objects in the bucket. Possible values are:

  • TRUE - The bucket is explicitly included in the bucket definition (S3BucketDefinitionForJob) for one or more recurring jobs or the bucket matches the bucket criteria (S3BucketCriteriaForJob) for one or more recurring jobs. At least one of those jobs has a status other than CANCELLED.

  • FALSE - The bucket isn't explicitly included in the bucket definition (S3BucketDefinitionForJob) for any recurring jobs, the bucket doesn't match the bucket criteria (S3BucketCriteriaForJob) for any recurring jobs, or all the recurring jobs that are configured to analyze data in the bucket have a status of CANCELLED.

  • UNKNOWN - An exception occurred when Amazon Macie attempted to retrieve job data for the bucket.

matching_bucket.job_details.last_job_id

The unique identifier for the job that ran most recently and is configured to analyze objects in the bucket, either the latest run of a recurring job or the only run of a one-time job.

This value is typically null if the value for the isDefinedInJob property is FALSE or UNKNOWN.

matching_bucket.job_details.last_job_run_time

The date and time, in UTC and extended ISO 8601 format, when the job (lastJobId) started. If the job is a recurring job, this value indicates when the most recent run started.

This value is typically null if the value for the isDefinedInJob property is FALSE or UNKNOWN.

matching_bucket.last_automated_discovery_time

The date and time, in UTC and extended ISO 8601 format, when Amazon Macie most recently analyzed objects in the bucket while performing automated sensitive data discovery. This value is null if automated sensitive data discovery is disabled for your account.

matching_bucket.object_count

The total number of objects in the bucket.

matching_bucket.object_count_by_encryption_type

The total number of objects in the bucket, grouped by server-side encryption type. This includes a grouping that reports the total number of objects that aren't encrypted or use client-side encryption.

Show child fields
matching_bucket.object_count_by_encryption_type.customer_managed

The total number of objects that are encrypted with customer-provided keys. The objects use server-side encryption with customer-provided keys (SSE-C).

matching_bucket.object_count_by_encryption_type.kms_managed

The total number of objects that are encrypted with KMS keys, either Amazon Web Services managed keys or customer managed keys. The objects use dual-layer server-side encryption or server-side encryption with KMS keys (DSSE-KMS or SSE-KMS).

matching_bucket.object_count_by_encryption_type.s3_managed

The total number of objects that are encrypted with Amazon S3 managed keys. The objects use server-side encryption with Amazon S3 managed keys (SSE-S3).

matching_bucket.object_count_by_encryption_type.unencrypted

The total number of objects that use client-side encryption or aren't encrypted.

matching_bucket.object_count_by_encryption_type.unknown

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

matching_bucket.sensitivity_score

The sensitivity score for the bucket, ranging from -1 (classification error) to 100 (sensitive).

If automated sensitive data discovery has never been enabled for your account or it’s been disabled for your organization or your standalone account for more than 30 days, possible values are: 1, the bucket is empty; or, 50, the bucket stores objects but it’s been excluded from recent analyses.

matching_bucket.size_in_bytes

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

If versioning is enabled for the bucket, Amazon Macie calculates this value based on the size of the latest version of each object in the bucket. This value doesn't reflect the storage size of all versions of each object in the bucket.

matching_bucket.size_in_bytes_compressed

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

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

matching_bucket.unclassifiable_object_count

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

Show child fields
matching_bucket.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.

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

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

matching_bucket.unclassifiable_object_size_in_bytes

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

Show child fields
matching_bucket.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.

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

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