public void createInstance ( final String my_instance_id , final String my_config_id , final String my_client_project ) { // [START instance_admin_client_create_instance] final String instanceId = my_instance_id ; final String configId = my_config_id ; final String clientProject = my_client_project ; OperationFuture < Instance , CreateInstanceMetadata > op = instanceAdminClient . createInstance ( InstanceInfo . newBuilder ( InstanceId . of ( clientProject , instanceId ) ) . setInstanceConfigId ( InstanceConfigId . of ( clientProject , configId ) ) . setDisplayName ( instanceId ) . setNodeCount ( 1 ) . build ( ) ) ; try { op . get ( ) ; } catch ( ExecutionException e ) { throw ( SpannerException ) e . getCause ( ) ; } catch ( InterruptedException e ) { throw SpannerExceptionFactory . propagateInterrupt ( e ) ; } // [END instance_admin_client_create_instance] }
Example to create an instance .