Created
September 13, 2019 17:16
-
-
Save gargolito/00fbf7e02d18c1970f54c849cb7c1135 to your computer and use it in GitHub Desktop.
aws python json parsing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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