本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
藍圖操作 CLI
本指南涵蓋透過 AWS Command Line Interface (CLI) for Amazon Bedrock Data Automation (BDA) 提供的藍圖操作。
建立藍圖
藍圖定義您想要從文件、影像、音訊或影片檔案擷取的資料結構和屬性。使用 create-blueprint 命令來定義新的藍圖。
下列命令會建立量身打造的新藍圖,以從護照影像擷取資料。
語法
aws bedrock-data-automation create-blueprint \ --blueprint-name "passport-blueprint" \ --type "IMAGE" \ --blueprint-stage "DEVELOPMENT" \ --schema '{ "class": "Passport", "description": "Blueprint for processing passport images", "properties": { "passport_number": { "type": "string", "inferenceType": "explicit", "instruction": "The passport identification number" }, "full_name": { "type": "string", "inferenceType": "explicit", "instruction": "The full name of the passport holder" }, "expiration_date": { "type": "string", "inferenceType": "explicit", "instruction": "The passport expiration date" } } }'
完成參數參考
下表顯示 create-blueprint
命令的所有可用參數:
參數 | 必要 | 預設 | 描述 |
---|---|---|---|
--blueprint-name |
是 | N/A | 藍圖的名稱 |
--type |
是 | N/A | 內容類型 (映像、文件、音訊、影片) |
--blueprint-stage |
否 | LIVE | 藍圖階段 (DEVELOPMENT 或 LIVE) |
--schema |
是 | N/A | 定義藍圖結構的 JSON 結構描述 |
--client-token |
否 | 自動產生的 | 請求冪等的唯一識別符 |
檢視藍圖組態
列出所有藍圖
使用 list-blueprints 命令擷取與您的帳戶相關聯的所有藍圖清單。
語法
aws bedrock-data-automation list-blueprints
檢視藍圖詳細資訊
若要查看特定藍圖的詳細資訊,包括其結構描述和組態,請使用 get-blueprint 命令。
語法
aws bedrock-data-automation get-blueprint \ --blueprint-arn "Amazon Resource Name (ARN)"
檢查特定版本
使用版本控制的藍圖時,請使用 get-blueprint 命令搭配 --blueprint-version 選項來檢視特定版本。
語法
aws bedrock-data-automation get-blueprint \ --blueprint-arn "Amazon Resource Name (ARN)" \ --blueprint-version "version-number"
檢查特定階段
若要在 DEVELOPMENT 或 LIVE 階段檢視藍圖,請使用:
aws bedrock-data-automation get-blueprint \ --blueprint-arn "Amazon Resource Name (ARN)" \ --blueprint-stage "LIVE"
編輯藍圖規格
更新藍圖設定
若要修改現有藍圖的結構描述或屬性,請使用 update-blueprint 命令。
語法
aws bedrock-data-automation update-blueprint \ --blueprint-arn "Amazon Resource Name (ARN)" \ --schema '{ "class": "Passport", "description": "Updated blueprint for processing passport images", "properties": { "passport_number": { "type": "string", "inferenceType": "explicit", "instruction": "The passport identification number" }, "full_name": { "type": "string", "inferenceType": "explicit", "instruction": "The full name of the passport holder" }, "expiration_date": { "type": "string", "inferenceType": "explicit", "instruction": "The passport expiration date" } } }'
注意:更新藍圖時,您必須提供完整的結構描述,即使您未變更的欄位也是如此。
提升為 LIVE
若要將藍圖從 DEVELOPMENT 移至 LIVE 階段進行生產,請使用 update-blueprint 命令搭配 --blueprint-stage 選項。
語法
aws bedrock-data-automation update-blueprint \ --blueprint-arn "Amazon Resource Name (ARN)" \ --blueprint-stage "LIVE"
藍圖版本控制
使用 create-blueprint-version 命令進行重大變更之前,請建立新的藍圖版本以保留其目前狀態。
語法
aws bedrock-data-automation create-blueprint-version \ --blueprint-arn "Amazon Resource Name (ARN)"
管理藍圖標籤
標籤可協助使用者組織和分類藍圖,以簡化管理。
新增標籤
透過新增標籤將中繼資料套用至您的藍圖。
語法
aws bedrock-data-automation tag-resource \ --resource-arn "Amazon Resource Name (ARN)" \ --tags '{"Department":"Finance","Project":"PassportProcessing"}'
移除標籤
使用 untag-resource 命令從藍圖中移除特定標籤。
語法
aws bedrock-data-automation untag-resource \ --resource-arn "Amazon Resource Name (ARN)" \ --tag-keys '["Department","Project"]'
檢視標籤
使用 list-tags-for-resource 命令列出與藍圖相關聯的所有標籤。
語法
aws bedrock-data-automation list-tags-for-resource \ --resource-arn "Amazon Resource Name (ARN)"
刪除藍圖
刪除整個藍圖
使用 delete-blueprint 命令永久移除藍圖及其所有版本。
語法
aws bedrock-data-automation delete-blueprint \ --blueprint-arn "Amazon Resource Name (ARN)"
注意:此命令會永久刪除藍圖,且無法復原。
重要:您無法刪除任何專案目前正在使用的藍圖。刪除之前,請確定不會在任何專案的自訂輸出組態中參考藍圖。