amazon ec2 - Querying instance details long after it is terminated -


in amazon-ec2, instances page shows details of machine ip, size, key-pair, security group, how long has run etc.

once instance terminated, line-item stays visible hour. within period, can know details of machine while running. once line item gets removed, there no way know that.

say, instances manually instantiated, used time , terminated. after hour of event there no way find out happened.

there 1 detailed-bill feature, provides instance-ids , size. interested in key-pair, ip, os, security group , name-of-machine if any. there way find out them?

edit

i understand can have cron job periodically list instances (and details) , store in database. thing is, host cron process, need machine 24x7. need sort of hook, callback, event.

even if not readily available, can such solution made?

once instance has been terminated, mentioned, of information available through api before disappears after hour or so. (ip address dns not available since every time stop or terminate instance ip address relinquished) after instance disappears means it's gone good.

the workaround query instances api every ofter , save state , instance information. can save in memory, database or text files, depending on trying or application trying create.

here's example of saving instance information python dictionary in memory using boto python interface api:

reservations = conn.get_all_instances() res in reservations:     instance = res.instances[0]     if instance.id == 'i-xxxxxx':         instance_dict[instance.id] = instance 

the dictionary instance_dict have ip address, dns , other instance info duration of program long don't overwrite it. terminate instance can run like:

instance_dict['i-xxxxxx'].terminate() 

but later can still use:

instance_dict['i-xxxxxx'].ip_address 

and:

instance_dict['i-xxxxxx'].dns_name 

hope helps.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -