google-cloud-platformcloudgoogle-compute-enginevirtual-network

Are MAC addresses unique over multiple projects in GCE?


I'm pulling instance data from Google Compute Engine from multiple projects. The MAC addresses of the instance interfaces are a unique key in my solution so I need to avoid duplicates. I couldn't find any info on that in the GCE documentation.

I would assume that they are not unique - only unique within the boundaries of one project but I wanted to be sure.

Thanks.


Solution

  • I believe, the current MAC addresses in GCE are not guaranteed to be unique globally. However, these are unique within a GCE network.

    This is because the MAC address is calculated based of internal IP no matter whether the internal IP is user defined or auto generated. As a result, the internal IP does not change throughout the life cycle of the VM; regardless of VM status. Thus, the MAC address might also not be unique within a project boundary.

    That being said, if you are searching for unique key then I would suggest using combination of instance name and project number or project ID. This is due to the fact the project number and ID are unique across Google Cloud Platform.