下载 Amazon EC2 AMI?

发布于 2024-09-26 09:20:18 字数 432 浏览 9 评论 0原文

我想下载一个公共 Amazon EC2 AMI,例如 这个 (Ubuntu Lucid) ,以便我可以通过编程方式提取其内容。

我该怎么做?我怀疑某处有一个S3地址? 这篇博文看起来曾经描述过这个过程,但该链接似乎不再有效。

到目前为止,我只能找到有关如何在 AWS 中移动 EC2 实例的解释。我相信清单文件是这个难题的重要组成部分。

I would like to download a public Amazon EC2 AMI, such as this one (Ubuntu Lucid), so that I can programmatically extract its contents.

How do I do this? I suspect there is an S3 address somewhere? This blog post looks like it once described this process, but the link seems to no longer work.

So far I can only find explanations of how to move around EC2 instance within AWS. I believe manifest files are an important piece of the puzzle.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

有木有妳兜一样 2024-10-03 09:20:18

使用 ec2-download-bundleAMI 工具中下载 AMI。创建实例,然后立即创建 AMI。使用 ec2-download-bundle 检索和解密 AMI。

Use the ec2-download-bundle in the AMI Tools to download AMIs. Create an instance, then immediately create an AMI. Use ec2-download-bundle to retrieve and decrypt the AMI.

云淡风轻 2024-10-03 09:20:18

我至少可以想到两种方法:

将 AMI 导出到 S3

遵循(令人惊讶的复杂)EC2 VM 导出文档 将 AMI 导出到 S3,然后从 S3 下载。

这可能适用于某些 AMI,但遗憾的是,当我尝试它时,它对我不起作用,因为我试图下载从 Amazon Lightsail 快照导出的 AMI,这显然失败了aws.amazon.com/vm-import/latest/userguide/limits-image-export.html" rel="nofollow noreferrer">先决条件:

$ aws ec2 export-image --image-id ami-xxx --disk-image-format RAW --s3-export-location S3Bucket=xxx

An error occurred (InvalidParameter) when calling the ExportImage operation: The image ID (ami-xxx) provided has encrypted EBS block devices and is not exportable.

但是,有效的是以下方法:

将卷附加到EC2 实例

  1. 从 AMI 启动 EC2 实例。
  2. 停止实例并分离其卷。
  3. 将卷附加到另一个实例(可以是新实例,也可以是您已有的实例)。
  4. 连接到实例。
  5. 然后,您可以从该实例访问该卷,并使用您选择的工具提取其内容(例如挂载它、检查它、从中rsync等)。

I can think of at least two approaches:

Exporting the AMI to S3

Follow the (surprisingly complicated) EC2 VM export docs to export the AMI to S3, then download from S3.

This may work for some AMIs, but sadly it didn't work for me when I tried it because I was trying to download an AMI exported from an Amazon Lightsail snapshot, which apparently fails the prerequisites:

$ aws ec2 export-image --image-id ami-xxx --disk-image-format RAW --s3-export-location S3Bucket=xxx

An error occurred (InvalidParameter) when calling the ExportImage operation: The image ID (ami-xxx) provided has encrypted EBS block devices and is not exportable.

What did work, however, was the following approach:

Attaching the volume to an EC2 instance

  1. Launch an EC2 instance from the AMI.
  2. Stop the instance and detach its volume.
  3. Attach the volume to another instance (either a new one or one you already have lying around).
  4. Connect to the instance.
  5. You can then access the volume from that instance and use the tools of your choice to extract its contents (e.g. mount it, inspect it, rsync from it, etc.).
三寸金莲 2024-10-03 09:20:18

似乎一种方法是直接从公众那里创建一卷。然后,您可以运行一个实例,安装从 ami 创建的卷,并使用任何文件传输方案从实例下载文件。

Seems an approach would be to create a volume directly from the public ami. Then you could run an instance, mount the volume you created from the ami, and download the files from the instance using any file transfer scheme.

无法言说的痛 2024-10-03 09:20:18

您是否有真正想要解决的问题?

因为如果存在,并且您需要特定 AMI 的内容来解决该问题,那么您最好的方法是启动一个实例并拍摄其正在运行的 EBS 的快照(然后您可以下载该快照)。如果您不使用 EBS 支持的实例,则可以使用 Amazon 工具从当前实例创建 AMI。

Is there a real problem that you're trying to solve?

Because if there is, and you need the contents of a particular AMI to solve it, then your best approach is going to be starting an instance and taking a snapshot of its running EBS (which you can then download). If you're not using an EBS-backed instance, then you can use the Amazon tools to create an AMI from your current instance.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文