Find region from within an EC2 instance

前端 未结 28 1498
谎友^
谎友^ 2020-12-02 06:24

Is there a way to look up the region of an instance from within the instance?

I\'m looking for something similar to the method of finding the instance id.

28条回答
  •  青春惊慌失措
    2020-12-02 06:52

    You can use ec2-metadata:

    ec2-metadata -z | grep -Po "(us|sa|eu|ap)-(north|south|central)?(east|west)?-[0-9]+"
    

提交回复
热议问题