Lister AWS ami

Répertoriez les AMI AWS.

! /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

Lister AWS ami
liste liée
Rejoindre la liste
Notation d'inclusion de liste
[Python] liste
Obtenez les dernières informations AMI avec l'AWS CLI
Création d'une instance AWS EC2 EC2 (Amazon Linux AMI) 2