Skip to content

Instantly share code, notes, and snippets.

@gargolito
Created September 13, 2019 17:16
Show Gist options
  • Save gargolito/00fbf7e02d18c1970f54c849cb7c1135 to your computer and use it in GitHub Desktop.
Save gargolito/00fbf7e02d18c1970f54c849cb7c1135 to your computer and use it in GitHub Desktop.
aws python json parsing
# list available instance reservations
for k,v in d.items():
for r in v['ReservedInstances']:
if int(str(datetime.datetime.strptime(r['End'], '%Y-%m-%dT%H:%M:%S.000Z') - datetime.datetime.now()).split(',')[0].split(' ')[0]) > 0:
print(k, r['End'], r['InstanceCount'], r['InstanceType'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment