turbot/gcp

steampipe plugin install gcpsteampipe plugin install gcp
gcp_audit_policygcp_bigquery_datasetgcp_bigquery_jobgcp_bigquery_tablegcp_bigtable_instancegcp_cloudfunctions_functiongcp_compute_addressgcp_compute_backend_bucketgcp_compute_backend_servicegcp_compute_diskgcp_compute_disk_metric_read_opsgcp_compute_disk_metric_read_ops_dailygcp_compute_disk_metric_read_ops_hourlygcp_compute_disk_metric_write_opsgcp_compute_disk_metric_write_ops_dailygcp_compute_disk_metric_write_ops_hourlygcp_compute_firewallgcp_compute_forwarding_rulegcp_compute_global_addressgcp_compute_global_forwarding_rulegcp_compute_imagegcp_compute_instancegcp_compute_instance_metric_cpu_utilizationgcp_compute_instance_metric_cpu_utilization_dailygcp_compute_instance_metric_cpu_utilization_hourlygcp_compute_instance_templategcp_compute_machine_typegcp_compute_networkgcp_compute_node_groupgcp_compute_node_templategcp_compute_project_metadatagcp_compute_regiongcp_compute_resource_policygcp_compute_routergcp_compute_snapshotgcp_compute_ssl_policygcp_compute_subnetworkgcp_compute_target_https_proxygcp_compute_target_poolgcp_compute_target_ssl_proxygcp_compute_target_vpn_gatewaygcp_compute_url_mapgcp_compute_vpn_tunnelgcp_compute_zonegcp_dns_managed_zonegcp_dns_policygcp_dns_record_setgcp_iam_policygcp_iam_rolegcp_kms_keygcp_kms_key_ringgcp_logging_bucketgcp_logging_exclusiongcp_logging_metricgcp_logging_sinkgcp_monitoring_alert_policygcp_monitoring_groupgcp_monitoring_notification_channelgcp_organizationgcp_projectgcp_project_organization_policygcp_project_servicegcp_pubsub_snapshotgcp_pubsub_subscriptiongcp_pubsub_topicgcp_service_accountgcp_service_account_keygcp_sql_backupgcp_sql_databasegcp_sql_database_instancegcp_sql_database_instance_metric_connectionsgcp_sql_database_instance_metric_connections_dailygcp_sql_database_instance_metric_connections_hourlygcp_sql_database_instance_metric_cpu_utilizationgcp_sql_database_instance_metric_cpu_utilization_dailygcp_sql_database_instance_metric_cpu_utilization_hourlygcp_storage_bucket

Table: gcp_sql_database_instance

Cloud SQL instance is a database running in the cloud. It is used to store, replicate, and protect databases.

Examples

Basic info

select
name,
state,
instance_type,
database_version,
machine_type,
location
from
gcp_sql_database_instance;

List of users in the specified Cloud SQL instance.

select
name,
instance_users
from
gcp_sql_database_instance
where
name='my-sql-instance';

List of replica databases and their master instances

select
name,
master_instance_name,
replication_type,
gce_zone as replica_database_zone
from
gcp_sql_database_instance
where
database_replication_enabled;

List of assigned IP addresses to the database instances

select
name,
ip ->> 'ipAddress' as ip_address,
ip ->> 'type' as type
from
gcp_sql_database_instance,
jsonb_array_elements(ip_addresses) as ip;

List of external networks that can connect to the database instance

select
name as instance_name,
i ->> 'name' as authorized_network_name,
i ->> 'value' as authorized_network_value,
ip_configuration ->> 'ipv4Enabled' as ipv4_enabled
from
gcp_sql_database_instance,
jsonb_array_elements(ip_configuration -> 'authorizedNetworks') as i;

List of database instances without application tag key

select
name,
tags
from
gcp_sql_database_instance
where
not tags :: JSONB ? 'application';

Count of database instances per location

select
location,
count(*) instance_count
from
gcp_sql_database_instance
group by
location;

.inspect gcp_sql_database_instance

GCP SQL Database Instance

NameTypeDescription
activation_policytextDescribes the activation policy specifies when the instance is activated.
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
authorized_gae_applicationsjsonbA list of App Engine app IDs, that can access this instance.
availability_typetextSpecifies the availability type of the instance. This field is used only for PostgreSQL and MySQL instances.
backend_typetextSpecifies the backend type. Possible values are: FIRST_GEN, SECOND_GEN, EXTERNAL, and SQL_BACKEND_TYPE_UNSPECIFIED.
backup_enabledbooleanIndicates whether backup configuration is enabled, or not.
backup_locationtextSpecifies the backup location.
backup_replication_log_archiving_enabledbooleanIndicates whether backup replication log archiving is enabled, or not.
backup_start_timetextSpecifies the start time for the daily backup configuration.
binary_log_enabledbooleanIndicates whether binary log is enabled, or not.
can_defer_maintenancebooleanIndicates whether the scheduled maintenance can be deferred, or not.
can_reschedule_maintenancebooleanIndicates whether the scheduled maintenance can be rescheduled, or not.
connection_nametextSpecifies the connection name of the Cloud SQL instance used in connection strings.
crash_safe_replication_enabledbooleanSpecifies whether the database flags for crash-safe replication are enabled, or not.
current_disk_sizebigintSpecifies the current disk usage of the instance in bytes.
data_disk_size_gbbigintSpecifies the size of the data disk, in GB. Minimum size is 10GB. Not used for First Generation instances.
data_disk_typetextSpecifies the type of the data disk used for this instance.
database_flagsjsonbA list of database flags passed to the instance at startup.
database_replication_enabledbooleanSpecifies whether the replication of database is enabled, or not.
database_versiontextSpecifies the type and version of the database engine.
enable_point_in_time_recoverybooleanAllows user to recover data from a specific point in time, down to a fraction of a second.
failover_replica_availablebooleanThe availability status of the failover replica. A false status indicates that the failover replica is out of sync.
failover_replica_nametextThe name of the failover replica. If specified at instance creation, a failover replica is created for the instance.
gce_zonetextSpecifies the Compute Engine zone that the instance is currently serving from.
instance_typetextSpecifies the type of the instance.
instance_usersjsonbA list of users in the specified Cloud SQL instance.
ip_addressesjsonbA list of assigned IP addresses for the instance.
ip_configurationjsonbDescribes the settings for IP management. It allows to enable or disable the instance IP and manage which external networks can connect to the instance.
ipv6_addressinetSpecifies the IPv6 address assigned to the instance. This property is applicable only to First Generation instances.
kindtextThe type of the resource.
kms_key_nametextSpecifies the resource name of KMS key used for disk encryption.
kms_key_version_nametextSpecifies the KMS key version used to encrypt the Cloud SQL instance.
labelsjsonbA label is a key-value pair that helps you organize your Google Cloud instances. You can attach a label to each resource, then filter the resources based on their labels.
locationtextThe GCP multi-region, region, or zone in which the resource is located.
location_preferencejsonbDescribes the location preference settings. This allows the instance to be located as near as possible to either an App Engine app or Compute Engine zone for better performance.
machine_typetextSpecifies the tier or machine type for this instance.
maintenance_start_timetimestamp without time zoneThe start time of any upcoming scheduled maintenance for this instance.
maintenance_windowjsonbDescribes the maintenance window for this instance.
master_instance_nametextSpecifies the name of the instance which will act as master in the replication setup.
max_disk_sizebigintSpecifies the maximum disk size of the instance in bytes.
nametextA friendly name that identifies the resource.
on_premises_configurationjsonbDescribes the configurations specific to on-premises instances.
pricing_plantextSpecifies the pricing plan for this instance.
projecttextThe GCP Project in which the resource is located.
replica_namesjsonbA list of replicas of the instance.
replication_configurationjsonbDescribes the configurations specific to failover replicas and read replicas.
replication_typetextSpecifies the type of replication this instance uses.
self_linktextThe server-defined URL for the resource.
service_account_email_addresstextThe service account email address assigned to the instance. This property is applicable only to Second Generation instances.
settings_versionbigintSpecifies the version of instance settings.
ssl_configurationjsonbDescribes the SSL configuration of the instance.
statetextSpecifies the current serving state of the Cloud SQL instance.
storage_auto_resizebooleanSpecifies whether the configuration for automatic increment of the the storage size is enabled, or not.
storage_auto_resize_limitbigintSpecifies the maximum size to which storage capacity can be automatically increased.
suspension_reasonjsonbA list of reasons for the suspension, if the instance state is SUSPENDED.
tagsjsonbA map of tags for the resource.
titletextTitle of the resource.