Table: aws_msk_cluster - Query AWS MSK Clusters using SQL
The AWS Managed Streaming for Apache Kafka (MSK) is a fully managed service that makes it easy to build and run applications that use Apache Kafka to process streaming data. AWS MSK provides the control-plane operations, such as those for creating, updating, and deleting clusters. It also takes care of the maintenance and operations of the underlying infrastructure, so you can focus on building and running your applications.
Table Usage Guide
The aws_msk_cluster
table in Steampipe provides you with information about Managed Streaming for Apache Kafka (MSK) clusters within AWS. This table allows you, as a DevOps engineer, to query cluster-specific details, including the cluster ARN, creation time, and associated metadata. You can utilize this table to gather insights on clusters, such as the number of broker nodes, the version of Apache Kafka, the state of the cluster, and more. The schema outlines the various attributes of the MSK cluster for you, including the broker node group info, encryption info, open monitoring status, and associated tags.
Examples
Basic Info
Explore the status and details of your AWS MSK clusters to understand their configuration and operational state. This can be useful for auditing purposes, or to identify potential issues with cluster setup or version compatibility.
select arn, cluster_name, state, cluster_type, creation_time, current_version, region, tagsfrom aws_msk_cluster;
select arn, cluster_name, state, cluster_type, creation_time, current_version, region, tagsfrom aws_msk_cluster;
List inactive clusters
Identify instances where certain clusters within AWS MSK service are not in an active state. This could be useful for system administrators who need to manage resources or troubleshoot issues.
select arn, cluster_name, state, creation_timefrom aws_msk_clusterwhere state <> 'ACTIVE';
select arn, cluster_name, state, creation_timefrom aws_msk_clusterwhere state != 'ACTIVE';
List clusters that allow public access
Determine the areas in which public access is allowed for clusters. This is useful for identifying potential security risks and ensuring that access to sensitive data is appropriately restricted.
select arn, cluster_name, state, creation_timefrom aws_msk_clusterwhere provisioned -> 'BrokerNodeGroupInfo' -> 'ConnectivityInfo' -> 'PublicAccess' ->> 'Type' <> 'DISABLED';
select arn, cluster_name, state, creation_timefrom aws_msk_clusterwhere json_extract( provisioned, '$.BrokerNodeGroupInfo.ConnectivityInfo.PublicAccess.Type' ) <> 'DISABLED';
List clusters with encryption at rest disabled
Determine the areas in which encryption at rest is disabled for clusters, allowing you to address potential security vulnerabilities by identifying clusters without this added layer of data protection.
select arn, cluster_name, state, creation_timefrom aws_msk_clusterwhere provisioned -> 'EncryptionInfo' -> 'EncryptionAtRest' is null;
select arn, cluster_name, state, creation_timefrom aws_msk_clusterwhere json_extract(provisioned, '$.EncryptionInfo.EncryptionAtRest') is null;
List clusters with encryption in transit disabled
Determine the areas in which encryption in transit is disabled for clusters. This can be useful for identifying potential security vulnerabilities and ensuring data safety.
select arn, cluster_name, state, creation_timefrom aws_msk_clusterwhere provisioned -> 'EncryptionInfo' -> 'EncryptionInTransit' is null;
select arn, cluster_name, state, creation_timefrom aws_msk_clusterwhere json_extract( provisioned, '$.EncryptionInfo.EncryptionInTransit' ) is null;
List clusters with logging disabled
Discover the segments that consist of clusters with logging disabled, allowing you to identify potential areas for enhancing security measures and ensuring compliance with logging policies.
select arn, cluster_name, state, creation_timefrom aws_msk_clusterwhere provisioned -> 'LoggingInfo' is null;
select arn, cluster_name, state, creation_timefrom aws_msk_clusterwhere json_extract(provisioned, '$.LoggingInfo') is null;
Get total storage used by all the clusters
Determine the total storage utilized by all clusters to manage resources efficiently and optimize cost. This can help in understanding the overall storage usage and planning for future scaling needs.
select sum( ( provisioned -> 'BrokerNodeGroupInfo' -> 'StorageInfo' -> 'EbsStorageInfo' ->> 'VolumeSize' ) :: int ) as total_storagefrom aws_msk_cluster;
select sum( json_extract( provisioned, '$.BrokerNodeGroupInfo.StorageInfo.EbsStorageInfo.VolumeSize' ) ) as total_storagefrom aws_msk_cluster;
Control examples
Schema for aws_msk_cluster
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
account_id | text | =, !=, ~~, ~~*, !~~, !~~* | The AWS Account ID in which the resource is located. |
active_operation_arn | text | Arn of active cluster operation. | |
akas | jsonb | Array of globally unique identifier strings (also known as) for the resource. | |
arn | text | = | The Amazon Resource Name (ARN) that uniquely identifies the Cluster. |
cluster_configuration | jsonb | Description of this MSK configuration. | |
cluster_name | text | The name of the cluster. | |
cluster_operation | jsonb | Description of this MSK operation. | |
cluster_type | text | The type of the cluster. | |
creation_time | timestamp with time zone | The time when the cluster was created. | |
current_version | text | The current version of the MSK cluster. | |
partition | text | The AWS partition in which the resource is located (aws, aws-cn, or aws-us-gov). | |
provisioned | jsonb | Information about the provisioned cluster. | |
region | text | The AWS Region in which the resource is located. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
state | text | Settings for open monitoring using Prometheus. | |
state_info | jsonb | State Info for the Amazon MSK cluster. | |
tags | jsonb | A list of tags attached to the Cluster. | |
title | text | Title of the resource. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- aws
You can pass the configuration to the command with the --config
argument:
steampipe_export_aws --config '<your_config>' aws_msk_cluster