[PYTHON] Liste AWS ami

Listen Sie AWS AMIs auf.

! /usr/bin/env python
-*- coding: utf-8 -*-
import urllib2
import argparse
from BeautifulSoup import BeautifulSoup

def main():
    fp = urllib2.urlopen('http://cloud-images.ubuntu.com/precise/current/')
    soup = BeautifulSoup(fp)
    table = soup.find('table')
    rows = table.findAll('tr')
    for row in rows[1:]: # first is header
        tds = row.findAll('td')
        region = tds[0].text
        arch = tds[1].text
        store = tds[2].text
        ami = tds[3].text.replace('Launch', '')
        print('{} {} {} {}'.format(region, arch, store, ami))
if __name__ == '__main__':
    main()

Recommended Posts

Liste AWS ami
verknüpfte Liste
Beitrittsliste
Listeneinschlussnotation
[Python] -Liste
Holen Sie sich die neuesten AMI-Informationen mit der AWS CLI
Erstellen einer AWS EC2 EC2-Instanz (Amazon Linux AMI) 2