Para determinar o tamanho de cada volume de EBS associado a um AMI, use ec2-describe-images, com o id da imagem. Parte da saída é o mapeamento de dispositivo de bloco, que inclui o dispositivo, o instantâneo e o tamanho em GB. Por exemplo, o Linux AMI da Amazon (ami-e565ba8c) resultaria no seguinte:
ec2-describe-images ami-e565ba8c
IMAGE ami-e565ba8c amazon/amzn-ami-pv-2012.03.1.x86_64-ebs amazon available public x86_64 machine aki-88aa75e1 ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-dbb6e5a1 8
Podemos ver que essa AMI anexou seu volume EBS (derivado de snap-dbb6e5a1) a / dev / sda1 e que o tamanho é de 8GB.
Outro exemplo (um CentOS AMI aleatório) - dispositivo root de 6 GB:
ec2-describe-images ami-d91dcbb0
IMAGE ami-d91dcbb0 918714796546/CentOS-6.2-vs 918714796546 available public x86_64 machine aki-8e5ea7e7 ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda snap-14226d70 6
Um exemplo da minha região não padrão (minha região padrão é us-east-1) - dispositivo raiz de 10 GB:
ec2-describe-images --region us-west-1 ami-2f9bc26a
IMAGE ami-2f9bc26a 081293161529/CentOS-6.2-i386-virtastic-120215-3b 081293161529 available public i386 machine aki-87396bc2 ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda snap-a4854dc6 10
Por fim, se eu usar uma de minhas próprias AMIs que tenham vários volumes anexados do EBS (10 GB, 5 GB, 3 GB), a saída será:
ec2-describe-images ami-xxxxxxxx
IMAGE ami-xxxxxxxx xxxxxxxxxx/MyAMIName xxxxxxxxxx available private x86_64 machine aki-407d9529 ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-xxxxxxxa 10
BLOCKDEVICEMAPPING /dev/sdh1 snap-xxxxxxxb 5
BLOCKDEVICEMAPPING /dev/sdh2 snap-xxxxxxxc 3
O mesmo comando permite aplicar filtros para realizar algumas pesquisas básicas nas AMIs. Consulte a documentação da AWS para saber sobre os possíveis filtros e seu uso, caso esteja interessado.
Para usar ec2-describe-instances, você precisa configurar as ferramentas da API - elas podem ser configuradas no Windows ou no Linux e são ferramentas de linha de comando. --filter
é um dos parâmetros que você passa no comando, ele permite restringir os resultados da pesquisa combinando critérios selecionados. A Amazon detalha a instalação das ferramentas da API na documentação deles . Observe que as ferramentas da API não precisam ser configuradas em uma instância - elas podem ser executadas em qualquer computador.
Por exemplo, para obter todas as imagens de 64 bits públicas, com suporte do EBS, que contêm 'centos' no nome:
ec2-describe-images -a --filter "name=*centos*" --filter "is-public=true" --filter "root-device-type=ebs" --filter "architecture=x86_64"
Para obter todas as imagens públicas de 64 bits do EBS que contenham 'centos' no nome e que tenham um volume EBS de 8, 9 ou 10 GB, você pode usar:
ec2-describe-images -a --filter "name=*centos*" --filter "is-public=true" --filter "root-device-type=ebs" --filter "architecture=x86_64" --filter "block-device-mapping.volume-size=8" --filter "block-device-mapping.volume-size=9" --filter "block-device-mapping.volume-size=10"
IMAGE ami-10548979 021471307000/ebs-ami/hapx/centos_55_64bit 021471307000 available public x86_64 machine aki-b51cf9dc ari-b31cf9da ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-3ad8b241 10
IMAGE ami-c252f6ab 097336413681/centos-55-64-ebs-120513-2.6.35-8 097336413681 available public x86_64 machine aki-88aa75e1 ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-ad4d0ed1 10
IMAGE ami-f030c799 158864314994/mesos-hypertable-centos-4 158864314994 available public x86_64 machine ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-972d4bfd 10
IMAGE ami-0c2bdc65 158864314994/mesos-hypertable-centos-6 158864314994 available public x86_64 machine ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-f31d7699 10
IMAGE ami-cc887ea5 158864314994/mesos-hypertable-centos-7 158864314994 available public x86_64 machine ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-fb1a3091 10
IMAGE ami-673af20e 180777447352/amazon-linux-centos-64-bit 180777447352 available public x86_64 machine aki-825ea7eb ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-8aac94e8 8
IMAGE ami-6c47ba05 229012137537/centos-5.6-64bit-ebs-pvgrub 229012137537 available public x86_64 machine aki-427d952b ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-1f689b70 10
IMAGE ami-3bec2e52 240054632121/centos-5.6-64-type-1 240054632121 available public x86_64 machine aki-b51cf9dc ari-b31cf9da ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-a2e4efc2 10
IMAGE ami-26e1334f 276679183639/citrusleaf-2.0.23.54-trial-centos6 276679183639 available public x86_64 machine aki-4e7d9527 ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda snap-b8d619c3 8
IMAGE ami-158a427c 324077455750/centos-5-x86_64-ebs-beta2.img 324077455750 available public x86_64 machine aki-427d952b ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-811153e3 10
IMAGE ami-838a42ea 324077455750/centos-6-x86_64-ebs-beta2.img 324077455750 available public x86_64 machine aki-427d952b ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-0923616b 10
IMAGE ami-d2855ebb 352560329280/harman-centos-5.6x64 352560329280 available public x86_64 machine aki-e5c1218c ari-e3c1218a ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-82a0dfff 10
BLOCKDEVICEMAPPING /dev/sdf snap-7e9fe003 1
IMAGE ami-18ba1e71 352560329280/harman-centos-5.6x64-pvc86 352560329280 available public x86_64 machine aki-e5c1218c ari-e3c1218a ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-db89e6a7 10
BLOCKDEVICEMAPPING /dev/sdf snap-d189e6ad 1
IMAGE ami-858741ec 405596411149/centos-5.6-x86_64-pegasus-cloud-tutorial-2405596411149 available public x86_64 machine aki-b51cf9dc ari-b31cf9da ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-cd3f5bac 10
IMAGE ami-e2f8248b 499412572202/centos-5.8-base-with_selinux_disabled 499412572202 available public x86_64 machine aki-b51cf9dc ari-b31cf9da ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-06566b7d 10
IMAGE ami-5469913d 658020488564/centoswithnxserver 658020488564 available public x86_64 machine aki-b51cf9dc ari-b31cf9da ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-98a5e7f6 10
IMAGE ami-48f90621 706600422991/centos_5_64_clean 706600422991 available public x86_64 machine aki-b51cf9dc ari-b31cf9da ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-61c8560e 10
IMAGE ami-d4de25bd 707215113857/centos5-x86_64-ebs 707215113857 available public x86_64 machine aki-f006f399 ari-f406f39d ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-e076448e 10
IMAGE ami-fbd31292 752972755156/opencrowd-ideashare-centos-5.5-x64-trial-v01 752972755156 available public x86_64 machine aki-b51cf9dc ari-b31cf9da ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-8ff2f4ee 10
IMAGE ami-8f8d53e6 766915741798/nagiosxi/centos/6/2.2-SNAPSHOT-1/x86_64 766915741798 available public x86_64 machine aki-427d952b ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-bb4f6bc1 10
IMAGE ami-a90fd1c0 770727804447/Instance_import_demo_centos_5.6 770727804447 available public x86_64 machine aki-427d952b ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-c7a0a7bd 10
IMAGE ami-d638cbbf 811118151095/suz-lab_ebs_centos-core-x86_64-5.5.7 811118151095 available public x86_64 machine ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-30c0115c 10
IMAGE ami-a038cbc9 811118151095/suz-lab_ebs_centos-core-x86_64-5.5.7-100g 811118151095 available public x86_64 machine ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-b615c4da 10
BLOCKDEVICEMAPPING /dev/sdb1 snap-b015c4dc 100
IMAGE ami-5a02fc33 811118151095/suz-lab_ebs_centos-core-x86_64-5.6.2 811118151095 available public x86_64 machine aki-f006f399 ari-f406f39d ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-f18e929e 10
IMAGE ami-bc649dd5 919814621061/app-apache64-centos55-1-20110609041807 919814621061 available public x86_64 machine aki-b51cf9dc ari-b31cf9da ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-58e05c36 10
IMAGE ami-3f9e4856 919814621061/app64-centos5-us-east-1-20120117-20120117024004 919814621061 available public x86_64 machine aki-825ea7eb ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-8a7d1eee 10
IMAGE ami-42ee362b 919814621061/app64-centos5-us-east-1-20120413-20120413071405 919814621061 available public x86_64 machine aki-825ea7eb ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-429e103f 10
IMAGE ami-dbea33b2 919814621061/base64-centos5-us-east-1-20120405-20120405064803 919814621061 available public x86_64 machine aki-825ea7eb ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-3cb37441 10
IMAGE ami-fbfe2992 919814621061/centos-5.7-scalr/centos/5/1.0-SNAPSHOT-1/x86_64 919814621061 available public x86_64 machine aki-825ea7eb ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-b649fbd2 10
IMAGE ami-bb10c7d2 919814621061/centos-6-scalr/centos/6/1.0-SNAPSHOT-1/x86_64 919814621061 available public x86_64 machine aki-825ea7eb ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-62d85d06 10
IMAGE ami-0166b168 919814621061/memcached64-centos5-us-east-1-20120116-20120116084405 919814621061 available public x86_64 machineaki-825ea7eb ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-92a1c4f6 10
IMAGE ami-eaee3683 919814621061/memcached64-centos5-us-east-1-20120413-20120413073004 919814621061 available public x86_64 machineaki-825ea7eb ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-aaae20d7 10
IMAGE ami-f920e690 919814621061/memcached64-centos55-us-east-1-20110802084407 919814621061 available public x86_64 machine aki-b51cf9dc ari-b31cf9da ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-9f4a03fe 10
IMAGE ami-0366b16a 919814621061/mongodb64-centos5-us-east-1-20120116-20120116084403 919814621061 available public x86_64 machineaki-825ea7eb ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-8aa1c4ee 10
IMAGE ami-baee36d3 919814621061/mongodb64-centos5-us-east-1-20120413-20120413074803 919814621061 available public x86_64 machineaki-825ea7eb ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-58bb3525 10
IMAGE ami-8d66b1e4 919814621061/mysql-app64-centos5-us-east-1-20120116-20120116085805 919814621061 available public x86_64 machineaki-825ea7eb ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-7eb4d11a 10
IMAGE ami-5aee3633 919814621061/mysql-app64-centos5-us-east-1-20120413-20120413071404 919814621061 available public x86_64 machineaki-825ea7eb ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-de9f11a3 10
IMAGE ami-8f66b1e6 919814621061/percona64-centos5-us-east-1-20120116-20120116085805 919814621061 available public x86_64 machineaki-825ea7eb ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-78b4d11c 10
IMAGE ami-c4778ead 919814621061/percona64-centos55-1-20110608121605 919814621061 available public x86_64 machine aki-b51cf9dc ari-b31cf9da ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-bae252d4 10
IMAGE ami-fc956e95 919814621061/percona64-centos55-10-20110627103005 919814621061 available public x86_64 machine aki-b51cf9dc ari-b31cf9da ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-3eae8d50 10
IMAGE ami-313cfd58 919814621061/pgsql64-centos55-us-east1-20110816100807 919814621061 available public x86_64 machine aki-b51cf9dc ari-b31cf9da ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-6c06e90c 10
IMAGE ami-0f66b166 919814621061/postgresql64-centos5-us-east-1-20120116-20120116084404 919814621061 available public x86_64 machineaki-825ea7eb ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-bca1c4d8 10
IMAGE ami-e0ee3689 919814621061/postgresql64-centos5-us-east-1-20120413-20120413073205 919814621061 available public x86_64 machineaki-825ea7eb ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-24af2159 10
IMAGE ami-0d66b164 919814621061/redis64-centos5-us-east-1-20120116-20120116084404 919814621061 available public x86_64 machine aki-825ea7eb ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-b6a1c4d2 10
IMAGE ami-ecee3685 919814621061/redis64-centos5-us-east-1-20120413-20120413073004 919814621061 available public x86_64 machine aki-825ea7eb ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-7aaf2107 10
IMAGE ami-83ed2eea 919814621061/redis64-centos55-us-east-1-20110906090406 919814621061 available public x86_64 machine aki-b51cf9dc ari-b31cf9da ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-4c61182c 10
IMAGE ami-34a6565d 919814621061/scalr-centos55-x64 919814621061 available public x86_64 machine aki-b51cf9dc ari-b31cf9da ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-bfc2b8d2 10
IMAGE ami-bb0ac8d2 919814621061/scalr-centos55-x64-20110919 919814621061 available public x86_64 machine aki-b51cf9dc ari-b31cf9da ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-ec5a468c 10
IMAGE ami-2c9e6145 919814621061/scalr-centos56-x64 919814621061 available public x86_64 machine aki-b51cf9dc ari-b31cf9da ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-5dda4f32 10
IMAGE ami-c768abae 919814621061/scalr-centos60-x86_64-20110912 919814621061 available public x86_64 machine aki-4e7d9527 ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda snap-e6defe86 8
IMAGE ami-ec778385 919814621061/szr-app-apache-centos55-x86_64-ebs-1 919814621061 available public x86_64 machine aki-b51cf9dc ari-b31cf9da ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-156fb17f 10
IMAGE ami-5afd1733 919814621061/szr-base-centos54-x86_64-ebs-1 919814621061 available public x86_64 machine aki-b51cf9dc ari-b31cf9da ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-34c44d5f 10
IMAGE ami-1402f77d 919814621061/szr-base-centos55-x86_64-ebs-1 919814621061 available public x86_64 machine aki-b51cf9dc ari-b31cf9da ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-66b78d0d 10
IMAGE ami-30ab5459 919814621061/szr-base-centos56-x86_64-ebs-1 919814621061 available public x86_64 machine aki-b51cf9dc ari-b31cf9da ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-17ca4378 10
IMAGE ami-30dd2a59 919814621061/szr-lamp-centos55-x86_64-ebs-1 919814621061 available public x86_64 machine aki-b51cf9dc ari-b31cf9da ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-1921bd73 10
IMAGE ami-fe0bff97 919814621061/szr-lb-nginx-centos55-x86_64-ebs-2 919814621061 available public x86_64 machine aki-b51cf9dc ari-b31cf9da ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-854d92ef 10
IMAGE ami-08f21861 919814621061/szr-mysql-centos54-x86_64-ebs-1 919814621061 available public x86_64 machine aki-b51cf9dc ari-b31cf9da ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-16840d7d 10
IMAGE ami-a002f7c9 919814621061/szr-mysql-centos55-x86_64-ebs-1 919814621061 available public x86_64 machine aki-b51cf9dc ari-b31cf9da ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-f0a19b9b 10
IMAGE ami-399e4850 919814621061/www64-centos5-us-east-1-20120117-20120117023604 919814621061 available public x86_64 machine aki-825ea7eb ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-847b18e0 10
IMAGE ami-4eee3627 919814621061/www64-centos5-us-east-1-20120413-20120413071405 919814621061 available public x86_64 machine aki-825ea7eb ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-22810f5f 10
IMAGE ami-df77b7b6 932221497473/centos_53_x86_64-(2/6/18) 932221497473 available public x86_64 machine windows ebs hvm xen
BLOCKDEVICEMAPPING /dev/sda1 snap-160d9876 11
BLOCKDEVICEMAPPING xvdg snap-180d9878 20
BLOCKDEVICEMAPPING xvdh snap-1a0d987a 10
BLOCKDEVICEMAPPING xvdi snap-1c0d987c 5
IMAGE ami-6dd91a04 932221497473/centos_60_x86_64-(2/6/32) 932221497473 available public x86_64 machine aki-4e7d9527 ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda snap-66027306 8
BLOCKDEVICEMAPPING /dev/sdg snap-68027308 10
BLOCKDEVICEMAPPING /dev/sdh snap-6a02730a 20
IMAGE ami-a847b9c1 932665800539/cloudopt-centos-5.6-x64-ebs 932665800539 available public x86_64 machine aki-b51cf9dc ari-b31cf9da ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda1 snap-90a44afe 10
IMAGE ami-dfc302b6 944964708905/rightimage_centos_6.0_x86_64_20110810.1_ebs944964708905 available public x86_64 machine aki-4e7d9527 ebs paravirtual xen
BLOCKDEVICEMAPPING /dev/sda snap-ede1da8c 8
Observe que o comando acima retornará AMIs que possuem vários volumes do EBS, se qualquer desses volumes atenderem aos critérios. Você sempre pode filtrar seus resultados usando grep
, caso deseje.
Como sempre, não execute AMIs de fontes desconhecidas. Se você quer um CentOS AMI, eu sugiro que fique com o Linux da Amazon. É baseado no CentOS / RHEL (totalmente compatível com os binários da EPEL), bem mantido (pacotes são atualizados regularmente, as versões atuais de muitos pacotes populares estão disponíveis), é o AMI oficialmente suportado do EC2, e é muito leve (vem com o mínimo para começar - não ocupa muito espaço, usa pouca memória).