Find region from within an EC2 instance

前端 未结 28 1442
谎友^
谎友^ 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 07:09

    There is one more way of achieving that:

    REGION=`curl http://169.254.169.254/latest/dynamic/instance-identity/document|grep region|awk -F\" '{print $4}'`
    
    echo $REGION
    
    us-east-1
    

提交回复
热议问题