View a markdown version of this page

列出和查看映像配方的详细信息 - EC2 Image Builder
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)。

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

列出和查看映像配方的详细信息

本节介绍您可以通过多种方式查找有关您的 EC2 Image Builder 映像配方的信息并查看详细信息。

列出镜像配方

您可以列出所有图片配方,也可以按所有者筛选结果。使用 Self 列出你拥有的食谱,或 Shared 列出其他账号与你共享的食谱。

Console

要查看在您的账户下创建的图片配方列表,请按照以下步骤操作:

  1. 打开 EC2 映像生成器控制台,网址为 https://console.aws.amazon.com/imagebuilder/。

  2. 在导航窗格中,选择映像配方。这会显示在您账户下创建的映像配方列表。

  3. 要查看详细信息或创建新的配方版本,请选择配方名称链接。这将打开配方的详细视图。

    注意

    您也可以选中配方名称 旁边的复选框,然后选择 查看详细信息。

Amazon CLI

以下示例说明了如何使用 Amazon CLI列出所有映像配方。

aws imagebuilder list-image-recipes

该命令返回每个图像配方的摘要,如以下示例输出所示。

{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "imageRecipeSummaryList": [ { "arn": "arn:aws:imagebuilder:us-west-2:123456789012:image-recipe/my-recipe/1.0.0", "name": "my-recipe", "platform": "Linux", "owner": "123456789012", "parentImage": "arn:aws:imagebuilder:us-west-2:aws:image/amazon-linux-2023-x86/x.x.x", "dateCreated": "2024-01-15T10:30:00.000Z", "tags": { "Environment": "Production" } } ] }

以下示例仅列出了您拥有的食谱:

aws imagebuilder list-image-recipes --owner Self

以下示例列出了其他账户与您共享的食谱:

aws imagebuilder list-image-recipes --owner Shared
PowerShell

以下示例显示了如何使用 Get-EC2IBImageRecipeList cmdlet 列出你所有的图片配方:

Get-EC2IBImageRecipeList

以下示例仅列出了您拥有的食谱:

Get-EC2IBImageRecipeList -Owner Self

以下示例列出了其他账户与您共享的食谱:

Get-EC2IBImageRecipeList -Owner Shared

查看图片配方详情

Console

要查看特定图像配方的详细信息,请选择要查看的图像配方,然后使用中描述的步骤 列出镜像配方。

在配方详细信息页面上,您可以:

Amazon CLI

以下示例说明了如何指定 Amazon 资源名称(ARN)以通过使用 imagebuilder CLI 命令获取映像配方详细信息。

aws imagebuilder get-image-recipe --image-recipe-arn arn:aws:imagebuilder:us-west-2:123456789012:image-recipe/my-recipe/1.0.0

该命令返回完整的图像配方,如以下示例输出所示。

{ "requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "imageRecipe": { "arn": "arn:aws:imagebuilder:us-west-2:123456789012:image-recipe/my-recipe/1.0.0", "name": "my-recipe", "description": "My Linux image recipe", "platform": "Linux", "version": "1.0.0", "components": [ { "componentArn": "arn:aws:imagebuilder:us-west-2:123456789012:component/my-component/1.0.0/1" } ], "parentImage": "arn:aws:imagebuilder:us-west-2:aws:image/amazon-linux-2023-x86/x.x.x", "dateCreated": "2024-01-15T10:30:00.000Z", "tags": {}, "owner": "123456789012" } }
PowerShell

以下示例显示了如何使用 Get-EC2IBImageRecipe cmdlet 通过指定图像配方的亚马逊资源名称 (ARN) 来获取其详细信息:

Get-EC2IBImageRecipe -ImageRecipeArn arn:aws:imagebuilder:us-west-2:123456789012:image-recipe/my-recipe/1.0.0

获取镜像配方策略详细信息

配方策略是一种基于资源的策略。它控制对您的食谱的跨账户访问权限。当你分享食谱时 Amazon Resource Access Manager (Amazon RAM),映像生成器会自动创建策略。您也可以使用设置自定义策略 put-image-recipe-policy 命令。

注意

如果您直接使用设置资源策略 put-image-recipe-policy,然后你必须将资源升级为 Amazon RAM 资源共享,以便与您共享资源的负责人可以看到它。有关更多信息,请参阅 选项 2:应用资源策略并提升到现有的资源共享。

Amazon CLI

以下示例说明了如何指定 ARN 以通过使用 imagebuilder CLI 命令获取映像配方策略详细信息。如果配方中没有附加任何政策,则响应为空。

aws imagebuilder get-image-recipe-policy --image-recipe-arn arn:aws:imagebuilder:us-west-2:123456789012:image-recipe/my-recipe/1.0.0
PowerShell

以下示例显示了如何使用 Get-EC2IBImageRecipePolicy cmdlet 通过指定图像配方策略的 ARN 来获取其详细信息:

Get-EC2IBImageRecipePolicy -ImageRecipeArn arn:aws:imagebuilder:us-west-2:123456789012:image-recipe/my-recipe/1.0.0

cmdlet 将策略作为 JSON 字符串返回。如果配方中没有附加任何政策,则 cmdlet 将返回 {}。