How to obtain current instance ID from boto3?
Question: Is there an equivalent of

    
    
    curl http://169.254.169.254/latest/meta-data/instance-id
    

with boto3 to obtain the current running instance instance-id in python?


Answer: There is no api for it, no. There is
[`InstanceMetadataFetcher`](https://github.com/boto/botocore/blob/develop/botocore/utils.py#L157),
but it is currently only used to fetch IAM roles for authentication.

Any sort of `GET` should serve you though. Botocore uses the python
[`requests`](http://docs.python-requests.org/en/latest/) library which is
quite nice.

    
    
    import requests
    response = requests.get('http://169.254.169.254/latest/meta-data/instance-id')
    instance_id = response.text
    

