由于我不想为测试付费,免费限制大小为 10G。
我可以知道一些默认 AMI 的根设备根,例如
Amazon Linux AMI 2012.03
The Amazon Linux AMI 2012.03 is an EBS-backed, PV-GRUB image. It includes Linux 3.2, AWS tools, and repository access to multiple versions of MySQL, PostgreSQL, Python, Ruby, and Tomcat.
Root Device Size: 8 GB
最后一行显示 8GB。
但是,如果我在社区页面中找到 AMI,它不会显示根设备大小。
有人知道如何使用默认不提供但小于 10GB 的 centOS 等实例,以便我仍然可以免费使用吗?
答案1
要确定与 AMI 关联的每个 EBS 卷的大小,请使用 ec2-describe-images 和 image-id。输出的一部分是块设备映射,其中包括设备、快照和大小(以 GB 为单位)。例如,Amazon 的 Linux AMI (ami-e565ba8c) 将产生以下内容:
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
我们可以看到该 AMI 将其根 EBS 卷(源自 snap-dbb6e5a1)附加到 /dev/sda1,大小为 8GB。
另一个示例(随机 CentOS AMI)- 6GB 根设备:
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
来自我的非默认区域(我的默认区域是 us-east-1)的示例 - 10GB 根设备:
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
最后,如果我使用自己的一个 AMI,该 AMI 具有多个附加的 EBS 卷(10GB、5GB、3GB),则输出为:
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
同一命令确实允许您应用过滤器对 AMI 执行一些基本搜索。请参阅AWS 文档如果您有兴趣,可以了解可能的过滤器及其用途。
要使用 ec2-describe-instances,您需要设置 API 工具 - 它们可以在 Windows 或 Linux 上设置,并且是命令行工具。--filter
是您传递给命令的参数之一,它允许您通过匹配选择条件来缩小搜索结果范围。亚马逊详细介绍了 API 工具的安装他们的文件。请注意,API 工具不需要在实例上设置 - 它们可以从任何计算机上运行。
例如,要获取所有公共的、EBS 支持的、64 位图像,这些图像名称中包含“centos”:
ec2-describe-images -a --filter "name=*centos*" --filter "is-public=true" --filter "root-device-type=ebs" --filter "architecture=x86_64"
要获取所有公共的、由 EBS 支持的 64 位图像,这些图像名称中包含“centos”并且具有 8、9 或 10GB EBS 卷,您可以使用:
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
请注意,如果任何的卷符合标准。grep
如果需要,您可以随时使用 进一步筛选结果。
与往常一样,不要运行来自未知来源的 AMI。如果您想要 CentOS AMI,我实际上建议坚持使用 Amazon 的 Linux。它基于 CentOS/RHEL(与 EPEL 的二进制文件完全兼容),维护良好(软件包定期更新,许多流行软件包的最新版本可用),是 EC2 的官方支持 AMI,并且非常轻量级(附带最低限度的启动 - 不会占用太多空间,占用很少的内存)。
答案2
粗略地查找所有 8GB 图像的详细信息的方法
ec2-describe-images --all -v > ~/output.txt
cat ~/output.txt | grep -B 18 '<volumeSize>8</volumeSize>'
东部地区样本输出
<imageId>ami-005daf69</imageId>
<imageLocation>amazon/ElasticBeanstalk-Tomcat6-64bit-20110322-2041</imageLocation>
<imageState>available</imageState>
<imageOwnerId>102837901569</imageOwnerId>
<isPublic>true</isPublic>
<architecture>x86_64</architecture>
<imageType>machine</imageType>
<kernelId>aki-427d952b</kernelId>
<imageOwnerAlias>amazon</imageOwnerAlias>
<name>ElasticBeanstalk-Tomcat6-64bit-20110322-2041</name>
<description>Elastic Beanstalk Tomcat 6 64-bit</description>
<rootDeviceType>ebs</rootDeviceType>
<rootDeviceName>/dev/sda1</rootDeviceName>
<blockDeviceMapping>
<item>
<deviceName>/dev/sda1</deviceName>
<ebs>
<snapshotId>snap-4bd68427</snapshotId>
<volumeSize>8</volumeSize>
<item>
<imageId>ami-00a97b69</imageId>
<imageLocation>031458542082/TarCloud Client 0.1</imageLocation>
<imageState>available</imageState>
<imageOwnerId>031458542082</imageOwnerId>
<isPublic>true</isPublic>
<architecture>i386</architecture>
<imageType>machine</imageType>
<kernelId>aki-805ea7e9</kernelId>
<name>TarCloud Client 0.1</name>
<description>TarCloud Client 0.1</description>
<rootDeviceType>ebs</rootDeviceType>
<rootDeviceName>/dev/sda1</rootDeviceName>
<blockDeviceMapping>
<item>
<deviceName>/dev/sda1</deviceName>
<ebs>
<snapshotId>snap-9a946ae1</snapshotId>
<volumeSize>8</volumeSize>
答案3
您必须安装 AWS 工具。官方工具在这里:
http://aws.amazon.com/developertools/351
如果您按照说明安装它们,您将拥有一个命令行界面,允许您从本地命令行控制实例。