diff --git a/update-tg-config.py b/update-tg-config.py
index d2a375cf22532bfe4c542bc5fb5c6d2b147b0ce6..457da1c588f954f252220bf6cb8cf3de251b3dc5 100755
--- a/update-tg-config.py
+++ b/update-tg-config.py
@@ -1,8 +1,7 @@
 #!/usr/bin/python
 
 import boto3
-import urllib2
-import json
+import requests
 import sys
 import re
 import tempfile
@@ -55,8 +54,8 @@ def main():
 
 # Returns the region the instance is currently running in (eg: 'us-east')
 def get_region():
-  instance_info = urllib2.urlopen('http://169.254.169.254/2018-09-24/dynamic/instance-identity/document/').read()
-  instance_info = json.loads(instance_info)
+  session_token = requests.put('http://169.254.169.254/latest/api/token', headers={'X-aws-ec2-metadata-token-ttl-seconds': 60}).text
+  instance_info = requests.get('http://169.254.169.254/2018-09-24/dynamic/instance-identity/document/', headers={'X-aws-ec2-metadata-token': session_token}).json()
   return instance_info['region']
 
 # Returns the instance_id of this VM.