Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Filter machine types by CPU arcitecture

I am using `Google::Apis::ComputeV1::ComputeService` class (https://googleapis.dev/ruby/google-api-client/latest/Google/Apis/ComputeV1/ComputeService.html#list_...) to interact with my instances. Is it possible to get all available machine types filtered by processor architecture?
There is currently Tau T2A machine series that supports ARM, but I don't want to select them just by name so that I can use other suitable machines when they become available in the future.

0 1 344
1 REPLY 1

Since the Ruby client for Google Cloud is wrapping the REST API, you can filter instances by many of these fields. Another way to find out available filters would be to fetch a yaml response from the gcloud CLI.

You can filter by the cpuPlatform field, providing a processor platform name (in the case of Tau T2A ARM instances it would be): 

 

client = ::Google::‌Cloud‌::Compute::V1::Instances::Rest::Client.new

instance_list = client.list project: project, zone: zone, filter: "cpuPlatform = \"Ampere Altra\""

 

Another way to filter would be using the disks[].architecture nested field. However, this filter would need to be done on the client, since the REST API cannot currently filter by an object in an array. This field can either be arm64 or x86-64.