Source:
<code>public static Operation startInstance(Compute compute, String instanceName) throws IOException { System.out.println("================== Starting New Instance =================="); Instance instance = new Instance(); instance.setName(instanceName); instance.setMachineType( <START> "<LINK_4>" + PROJECT_ID + "/zones/" + ZONE_NAME + "/machineTypes/n1-standard-1"); <END> NetworkInterface ifc = new NetworkInterface(); ifc.setNetwork( "<LINK_4>" + PROJECT_ID + "/global/networks/default"); List<AccessConfig> configs = new ArrayList<>(); AccessConfig config = new AccessConfig(); config.setType(NETWORK_INTERFACE_CONFIG); config.setName(NETWORK_ACCESS_CONFIG); configs.add(config); ifc.setAccessConfigs(configs); instance.setNetworkInterfaces(Collections.singletonList(ifc)); AttachedDisk disk = new AttachedDisk(); disk.setBoot(true); disk.setAutoDelete(true); disk.setType("PERSISTENT"); AttachedDiskInitializeParams params = new AttachedDiskInitializeParams(); params.setDiskName(instanceName); params.setSourceImage(SOURCE_IMAGE_PREFIX + SOURCE_IMAGE_PATH); params.setDiskType( "<LINK_4>" + PROJECT_ID + "/zones/" + ZONE_NAME + "/diskTypes/pd-standard"); disk.setInitializeParams(params); instance.setDisks(Collections.singletonList(disk)); ServiceAccount account = new ServiceAccount(); account.setEmail("default"); List<String> scopes = new ArrayList<>(); scopes.add("<LINK_0>"); scopes.add("<LINK_3>"); account.setScopes(scopes); instance.setServiceAccounts(Collections.singletonList(account)); Metadata meta = new Metadata(); Metadata.Items item = new Metadata.Items(); item.setKey("startup-script-url"); item.setValue("gs://" + PROJECT_ID + "/vm-startup.sh"); meta.setItems(Collections.singletonList(item)); instance.setMetadata(meta); System.out.println(instance.toPrettyString()); Compute.Instances.Insert insert = compute.instances().insert(PROJECT_ID, ZONE_NAME, instance); return insert.execute(); }</code><technical_language>create this string w/ String.format(...) Also, e2-standard-1 well</technical_language>

Target:
public static Operation startInstance(Compute compute, String instanceName) throws IOException { System.out.println("================== Starting New Instance =================="); Instance instance = new Instance(); instance.setName(instanceName); instance.setMachineType( String.format( "<LINK_1>", PROJECT_ID, ZONE_NAME)); NetworkInterface ifc = new NetworkInterface(); ifc.setNetwork( String.format( "<LINK_4>%s/global/networks/default", PROJECT_ID)); List<AccessConfig> configs = new ArrayList<>(); AccessConfig config = new AccessConfig(); config.setType(NETWORK_INTERFACE_CONFIG); config.setName(NETWORK_ACCESS_CONFIG); configs.add(config); ifc.setAccessConfigs(configs); instance.setNetworkInterfaces(Collections.singletonList(ifc)); AttachedDisk disk = new AttachedDisk(); disk.setBoot(true); disk.setAutoDelete(true); disk.setType("PERSISTENT"); AttachedDiskInitializeParams params = new AttachedDiskInitializeParams(); params.setDiskName(instanceName); params.setSourceImage(SOURCE_IMAGE_PREFIX + SOURCE_IMAGE_PATH); params.setDiskType( String.format( "<LINK_4>%s/zones/%s/diskTypes/pd-standard", PROJECT_ID, ZONE_NAME)); disk.setInitializeParams(params); instance.setDisks(Collections.singletonList(disk)); ServiceAccount account = new ServiceAccount(); account.setEmail("default"); List<String> scopes = new ArrayList<>(); scopes.add("<LINK_0>"); scopes.add("<LINK_3>"); account.setScopes(scopes); instance.setServiceAccounts(Collections.singletonList(account)); Metadata meta = new Metadata(); Metadata.Items item = new Metadata.Items(); item.setKey("startup-script-url"); item.setValue(String.format("gs://%s/vm-startup.sh", PROJECT_ID)); meta.setItems(Collections.singletonList(item)); instance.setMetadata(meta); System.out.println(instance.toPrettyString()); Compute.Instances.Insert insert = compute.instances().insert(PROJECT_ID, ZONE_NAME, instance); return insert.execute(); }