[ Web Proxy ]
URL:
Viewing: https://cloud.google.com/python/docs/reference/bigtable/latest/instance [Back]  [Original]

Instance  |  Python client libraries  |  Google Cloud Documentation Skip to main content
Google Cloud Documentation [Google Cloud Documentation]
Send feedback

Instance Stay organized with collections Save and categorize content based on your preferences.

2.43.0 (latest) 2.42.0 2.41.0 2.40.0 2.39.0 2.38.0 2.37.0 2.36.0 2.35.0 2.34.0 2.33.0 2.32.0 2.31.0 2.30.1 2.29.0 2.28.1 2.26.0 2.25.0 2.24.0 2.23.1 2.22.0 2.21.0 2.20.0 2.19.0 2.18.1 2.17.0 2.16.0 2.15.0 2.14.1 2.13.2 2.12.0 2.11.3 2.10.1 2.9.0 2.8.1 2.7.1 2.6.0 2.5.2 2.4.0 2.3.3 2.2.0 2.1.0 2.0.0 1.7.3 1.6.1 1.5.1 1.4.0 1.3.0 1.2.1 1.1.0 1.0.0 0.34.0

User-friendly container for Google Cloud Bigtable Instance.

class google.cloud.bigtable.instance.Instance(instance_id, client, display_name=None, instance_type=None, labels=None, _state=None)

Bases: object

Representation of a Google Cloud Bigtable Instance.

We can use an Instance to:

NOTE: For now, we leave out the default_storage_type (an enum) which if not sent will end up as data_v2_pb2.STORAGE_SSD.

app_profile(app_profile_id, routing_policy_type=None, description=None, cluster_id=None, multi_cluster_ids=None, allow_transactional_writes=None)

Factory to create AppProfile associated with this instance.

For example:

from google.cloud.bigtable import Client, enums

routing_policy_type = enums.RoutingPolicyType.ANY

client = Client(admin=True)
instance = client.instance(INSTANCE_ID)

description = "routing policy-multy"

app_profile = instance.app_profile(
    app_profile_id=APP_PROFILE_ID,
    routing_policy_type=routing_policy_type,
    description=description,
    cluster_id=CLUSTER_ID,
)

app_profile = app_profile.create(ignore_warnings=True)

cluster(cluster_id, location_id=None, serve_nodes=None, default_storage_type=None, kms_key_name=None, min_serve_nodes=None, max_serve_nodes=None, cpu_utilization_percent=None)

Factory to create a cluster associated with this instance.

For example:

from google.cloud.bigtable import Client, enums

# Assuming that there is an existing instance with `INSTANCE_ID`
# on the server already.
# to create an instance see
# 'https://cloud.google.com/bigtable/docs/creating-instance'

client = Client(admin=True)
instance = client.instance(INSTANCE_ID)

cluster_id = "clus-my-" + UNIQUE_SUFFIX
location_id = "us-central1-a"
serve_nodes = 1
storage_type = enums.StorageType.SSD

cluster = instance.cluster(
    cluster_id,
    location_id=location_id,
    serve_nodes=serve_nodes,
    default_storage_type=storage_type,
)
operation = cluster.create()
# We want to make sure the operation completes.
operation.result(timeout=100)
    1. The Cloud Bigtable service account associated with the
project that contains the cluster must be granted the
`cloudkms.cryptoKeyEncrypterDecrypter` role on the
CMEK.


    2. Only regional keys can be used and the region of the
CMEK key must match the region of the cluster.


    3. All clusters within an instance must use the same CMEK
key.

create(location_id=None, serve_nodes=None, default_storage_type=None, clusters=None, min_serve_nodes=None, max_serve_nodes=None, cpu_utilization_percent=None)

Create this instance.

For example:

from google.cloud.bigtable import Client, enums

my_instance_id = "inst-my-" + UNIQUE_SUFFIX
my_cluster_id = "clus-my-" + UNIQUE_SUFFIX
location_id = "us-central1-f"
serve_nodes = 1
storage_type = enums.StorageType.SSD
production = enums.Instance.Type.PRODUCTION
labels = {"prod-label": "prod-label"}

client = Client(admin=True)
instance = client.instance(my_instance_id, instance_type=production, labels=labels)
cluster = instance.cluster(
    my_cluster_id,
    location_id=location_id,
    serve_nodes=serve_nodes,
    default_storage_type=storage_type,
)
operation = instance.create(clusters=[cluster])

# We want to make sure the operation completes.
operation.result(timeout=100)

NOTE: Uses the project and instance_id on the current Instance in addition to the display_name. To change them before creating, reset the values via

instance.display_name = 'New display name'
instance.instance_id = 'i-changed-my-mind'

before calling create().

delete()

Delete this instance.

For example:

from google.cloud.bigtable import Client

client = Client(admin=True)

instance_to_delete = client.instance(instance_id)
instance_to_delete.delete()

Marks an instance and all of its tables for permanent deletion in 7 days.

Immediately upon completion of the request:

Soon afterward:

At the instances delete_time:

exists()

Check whether the instance already exists.

For example:

from google.cloud.bigtable import Client

client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
instance_exists = instance.exists()

classmethod from_pb(instance_pb, client)

Creates an instance instance from a protobuf.

For example:

from google.cloud.bigtable import Client
from google.cloud.bigtable_admin_v2.types import instance as data_v2_pb2

client = Client(admin=True)
instance = client.instance(INSTANCE_ID)

name = instance.name
instance_pb = data_v2_pb2.Instance(
    name=name, display_name=INSTANCE_ID, type=PRODUCTION, labels=LABELS
)

instance2 = instance.from_pb(instance_pb, client)

get_iam_policy(requested_policy_version=None)

Gets the access control policy for an instance resource.

For example:

from google.cloud.bigtable import Client

client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
policy = instance.get_iam_policy()

list_app_profiles()

Lists information about AppProfiles in an instance.

For example:

from google.cloud.bigtable import Client

client = Client(admin=True)
instance = client.instance(INSTANCE_ID)

app_profiles_list = instance.list_app_profiles()

list_clusters()

List the clusters in this instance.

For example:

from google.cloud.bigtable import Client

client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
(clusters_list, failed_locations_list) = instance.list_clusters()

list_tables()

List the tables in this instance.

For example:

from google.cloud.bigtable import Client

client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
tables_list = instance.list_tables()

property name()

Instance name used in requests.

NOTE: This property will not change if instance_id does not, but the return value is not cached.

For example:

from google.cloud.bigtable import Client

client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
instance_name = instance.name

The instance name is of the form

"projects/{project}/instances/{instance_id}"

reload()

Reload the metadata for this instance.

For example:

from google.cloud.bigtable import Client

client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
instance.reload()

set_iam_policy(policy)

Sets the access control policy on an instance resource. Replaces any existing policy.

For more information about policy, please see documentation of class google.cloud.bigtable.policy.Policy

For example:

from google.cloud.bigtable import Client
from google.cloud.bigtable.policy import BIGTABLE_ADMIN_ROLE, Policy

client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
instance.reload()
new_policy = Policy()
new_policy[BIGTABLE_ADMIN_ROLE] = [Policy.service_account(service_account_email)]

policy_latest = instance.set_iam_policy(new_policy)

property state()

state of Instance.

For example:

from google.cloud.bigtable import Client

client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
instance_state = instance.state

table(table_id, mutation_timeout=None, app_profile_id=None)

Factory to create a table associated with this instance.

For example:

from google.api_core import exceptions, retry

from google.cloud.bigtable import Client, column_family

client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
table = instance.table("table_my")
# Define the GC policy to retain only the most recent 2 versions.
max_versions_rule = column_family.MaxVersionsGCRule(2)

# Could include other retriable exception types
# Could configure deadline, etc.
predicate_504 = retry.if_exception_type(exceptions.DeadlineExceeded)
retry_504 = retry.Retry(predicate_504)

retry_504(table.create)(column_families={"cf1": max_versions_rule})

test_iam_permissions(permissions)

Returns permissions that the caller has on the specified instance resource.

For example:

from google.cloud.bigtable import Client

client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
instance.reload()
permissions = ["bigtable.clusters.create", "bigtable.tables.create"]
permissions_allowed = instance.test_iam_permissions(permissions)

update()

Updates an instance within a project.

For example:

from google.cloud.bigtable import Client

client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
display_name = "My new instance"
instance.display_name = display_name
instance.update()

NOTE: Updates any or all of the following values: display_name type labels To change a value before updating, assign that values via

instance.display_name = 'New display name'

before calling update().

Send feedback

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-08-25 UTC.

Need to tell us more? [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-08-25 UTC."],[],[]]

Web Proxy Viewer  |  New URL  |  Original Page