0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

AWS CLIを実行したら謎にusageを示された

Posted at

とあるLambdaをAWS CLIで実行しようとして、次のようなコマンドを叩いたら

$ aws lambda invoke --function-name arn:aws:lambda:ap-northeast-1:XXXXXXXXXXXX:function:hoge-fuga-lambda response.json

このような結果に。

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help
aws: error: argument operation: Invalid choice, valid choices are:
add-layer-version-permission             | add-permission
create-alias                             | create-event-source-mapping
create-function                          | delete-alias
delete-event-source-mapping              | delete-function
delete-function-concurrency              | delete-layer-version
get-account-settings                     | get-alias
get-event-source-mapping                 | get-function
get-function-configuration               | get-layer-version
get-layer-version-by-arn                 | get-layer-version-policy
get-policy                               | invoke
invoke-async                             | list-aliases
list-event-source-mappings               | list-functions
list-layer-versions                      | list-layers
list-tags                                | list-versions-by-function
publish-layer-version                    | publish-version
put-function-concurrency                 | remove-layer-version-permission
remove-permission                        | tag-resource
untag-resource                           | update-alias
update-event-source-mapping              | update-function-code
update-function-configuration            | wait
help  

CLIの使い方間違っているよという趣旨の内容がでている。
ということで自分の叩いたコマンドを見直してみたものの、誤字脱字もなく、特に間違いは無さそうだった。

調べてみると CLIのバージョンによる問題の可能性もあるよ とのことだったので、CLIのバージョンを調べてみる。
環境はこんな感じ。

$ aws --version
aws-cli/1.16.194 Python/3.7.10 Linux/4.14.238-182.422.amzn2.x86_64 botocore/1.12.184

最新ではないけど、このバージョンでも先程のコマンドの内容で問題は無さそう。

結局、謎の文字が入っていたのか、一からコマンドをタイプし直したら通りました…。
コマンドが目に見えない形で間違っていたわけですね…。
元々ターミナルからコピペってきた文字列を使っていたので、その関係で謎の空白文字とかが入っていたのかもしれません。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?