How to check application runs in AWS EC2 instance

前端 未结 4 406
别那么骄傲
别那么骄傲 2021-01-11 11:11

How can I check which platform my app runs, AWS EC2 instance, Azure Role instance and non-cloud system? now I do that like this:

if(isAzure())
{
    //run in         


        
4条回答
  •  太阳男子
    2021-01-11 12:10

    On ec2 Ubuntu instances, the file /sys/hypervisor/uuid exists and its first three characters are 'ec2'. I like using this because it doesn't rely on external servers.

提交回复
热议问题