本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
列出和檢視元件詳細資訊
本節說明如何尋找資訊和檢視您在 EC2 Image Builder 配方中使用的元件詳細資訊。
列出映像建置器元件
您可以使用下列其中一種方法來列出和篩選映像建置器元件。
- AWS 管理主控台
-
若要在 中顯示元件清單 AWS 管理主控台,請遵循下列步驟:
-
開啟 EC2 Image Builder 主控台,位於 https://console.aws.amazon.com/imagebuilder/。
-
從導覽窗格中選取元件。根據預設,Image Builder 會顯示您帳戶擁有的元件清單。
-
您可以選擇性地篩選元件擁有權。若要查看您未擁有但可存取的元件,請展開擁有者類型下拉式清單,然後選取其中一個值。擁有者類型清單位於搜尋文字方塊旁的搜尋列中。您可以選擇下列的數值:
-
AWS Marketplace – 直接與 AWS Marketplace 產品訂閱相關聯的元件。
-
快速入門 (Amazon 受管) – Amazon 建立和維護的公開可用元件。
-
由我擁有 – 您建立的元件。這是預設選擇。
-
與我共用 – 其他人從其帳戶建立和與您共用的元件。
-
第三方受管 – 您訂閱的第三方擁有的元件 AWS Marketplace。
- AWS CLI
-
下列範例示範如何使用 list-components命令來傳回您帳戶擁有的 Image Builder 元件清單。
aws imagebuilder list-components
您可以選擇性地篩選元件擁有權。擁有者屬性會定義您要列出元件的擁有者。根據預設,此請求會傳回您帳戶擁有的元件清單。若要依元件擁有者篩選結果,請在執行 list-components命令時,使用 --owner 參數指定下列其中一個值。
元件擁有者值
-
AWSMarketplace
-
Amazon
-
Self
-
Shared
-
ThirdParty
下列範例顯示具有 --owner 參數的 list-components命令來篩選結果。
aws imagebuilder list-components --owner Self
{
"requestId": "012a3456-b789-01cd-e234-fa5678b9012b",
"componentVersionList": [
{
"arn": "arn:aws:imagebuilder:us-west-2:123456789012:component/sample-component01/1.0.0",
"name": "sample-component01",
"version": "1.0.0",
"platform": "Linux",
"type": "BUILD",
"owner": "123456789012",
"dateCreated": "2020-09-24T16:58:24.444Z"
},
{
"arn": "arn:aws:imagebuilder:us-west-2:123456789012:component/sample-component01/1.0.1",
"name": "sample-component01",
"version": "1.0.1",
"platform": "Linux",
"type": "BUILD",
"owner": "123456789012",
"dateCreated": "2021-07-10T03:38:46.091Z"
}
]
}
aws imagebuilder list-components --owner Amazon
aws imagebuilder list-components --owner Shared
aws imagebuilder list-components --owner ThirdParty
當您列出具有 --owner AWSMarketplace值的元件時,您可以依產品代碼篩選結果。指定值為 格式的productCodes篩選條件marketplace:productCodeId,如下列範例所示:
aws imagebuilder list-components --owner AWSMarketplace --filters name=productCodes,values=marketplace:examplecode123
Image Builder 會傳回aws-marketplace命名空間下的 AWS Marketplace 元件 ARNs,其擁有者為 AWSMarketplace。當您get-component呼叫 AWS Marketplace 元件時,回應會包含擁有者,但會省略元件資料。只有在呼叫建置執行個體有權使用產品時,才能使用元件資料。
從 列出元件建置版本 AWS CLI
下列範例示範如何使用 list-component-build-versions命令列出具有特定語意版本的元件建置版本。若要進一步了解 Image Builder 資源的語意版本控制,請參閱 Image Builder 中的語意版本控制。
aws imagebuilder list-component-build-versions --component-version-arn arn:aws:imagebuilder:us-west-2:123456789012:component/example-component/1.0.1
{
"requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111",
"componentSummaryList": [
{
"arn": "arn:aws:imagebuilder:us-west-2:123456789012:component/examplecomponent/1.0.1/1",
"name": "examplecomponent",
"version": "1.0.1",
"platform": "Linux",
"type": "BUILD",
"owner": "123456789012",
"description": "An example component that builds, validates and tests an image",
"changeDescription": "Updated version.",
"dateCreated": "2020-02-19T18:53:45.940Z",
"tags": {
"KeyName": "KeyValue"
}
}
]
}
從 取得元件詳細資訊 AWS CLI
下列範例顯示當您指定元件的 Amazon Resource Name (ARN) 時,如何使用 get-component命令來取得元件詳細資訊。
aws imagebuilder get-component --component-build-version-arn arn:aws:imagebuilder:us-west-2:123456789012:component/example-component/1.0.1/1
{
"requestId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11112",
"component": {
"arn": "arn:aws:imagebuilder:us-west-2:123456789012:component/examplecomponent/1.0.1/1",
"name": "examplecomponent",
"version": "1.0.1",
"type": "BUILD",
"platform": "Linux",
"owner": "123456789012",
"data": "name: HelloWorldTestingDocument\ndescription: This is hello world testing document... etc.\"\n",
"encrypted": true,
"dateCreated": "2020-09-24T16:58:24.444Z",
"tags": {}
}
}
從 取得元件政策詳細資訊 AWS CLI
下列範例顯示當您指定元件的 ARN 時,如何使用 get-component-policy命令來取得元件政策的詳細資訊。
aws imagebuilder get-component-policy --component-arn arn:aws:imagebuilder:us-west-2:123456789012:component/example-component/1.0.1