我想取得與 Amazon API Gateway API 金鑰相關的使用情況。
依照下列指示,使用 AWS 管理主控台或 AWS Command Line Interface (AWS CLI) 取得 API 金鑰使用情況。
**注意:**如果您在執行 AWS CLI 命令時收到錯誤,請確認您使用的是最新版本的 AWS CLI。
如需詳細資訊,請參閱 Create, configure, and test usage plans with the API Gateway console。
您可以使用 AWS CLI 命令 get-usage,取得某日期範圍內,用量計畫的用量資料,類似於以下內容:
aws apigateway get-usage --usage-plan-id <usage-plan-id> --start-date "20xx-xx-xx" --end-date "20xx-xx-xx" --key-id <api-key-id>
**注意:**用量日期範圍不能超過 90 天。
如需詳細資訊,請參閱 Create, configure, and test usage plans using the API Gateway CLI and REST API。
API 金鑰和用量方案的最佳實務