LoginSignup
0
0

More than 5 years have passed since last update.

aws apigateway get-export で An error occurred () when calling the GetExport operation: Invalid stage identifier specified というエラーが返ってくる

Posted at

AWS CLIでAPI Gatewayのget-exportでハマったのでメモ

ハマったこと

Swagger用のYAMLファイルをエクスポートしようとしたところ、以下のようなエラーが発生。

$ aws apigateway get-export \
  --rest-api-id xxxxxxxxxx \
  --stage-name prod \
  --export-type swagger \
  --accepts application/yaml swagger.yaml \

An error occurred () when calling the GetExport operation: Invalid stage identifier specified

原因

リージョンの設定が間違っていた。

テスト用に作ったため、~/.aws/configで設定していた東京リージョンとは異なるバージニアリージョンにAPI Gatewayを作成していた。

解決方法

~/.aws/configを直しても良いけど、今回のエクスポートに限ってリージョンを指定したいので、regionオプションを使用する。

$ aws apigateway get-export \
  --rest-api-id xxxxxxxxxx \
  --stage-name prod \
  --export-type swagger \
  --accepts application/yaml swagger.yaml \
  --region us-east-1
{
    "contentType": "application/octet-stream",
    "contentDisposition": "attachment; filename=\"swagger_2016-10-21T10:49:03Z.yaml\""
}

OK。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0