AWS SAM部署返回错误无效选择

时间:2018-09-20 16:36:26

标签: amazon-web-services aws-lambda aws-code-deploy

我正在按照here的说明使用AWS CodeDeploy将代码从GitHub推送到AWS。

我遇到此错误:

$ sam deploy -template-file packaged.yaml –stack-name mySafeDeployStack –capabilities CAPABILITY_IAM
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 subcommand: Invalid choice, valid choices are:

push                                     | register                                
deregister                               | install                                 
uninstall                               

我以前已经成功运行了此命令:

$ sam package --template-file template.yaml --s3-bucket my-bucket --output-template-file packaged.yaml
Uploading to ...  (100.00%)
Successfully packaged artifacts and wrote output template to file packaged.yaml.
Execute the following command to deploy the packaged template
aws cloudformation deploy --template-file .../packaged.yaml --stack-name <YOUR STACK NAME>

$ sam --version
SAM CLI, version 0.6.0

我尝试了推荐的命令:

aws cloudformation deploy ...

但它返回相同的错误。

1 个答案:

答案 0 :(得分:0)

当标志需要两个破折号时,您似乎使用了一个破折号。 sam package命令成功,因为您使用了两个破折号。

这应该有效:

sam deploy --template-file packaged.yaml --stack-name mySafeDeployStack --capabilities CAPABILITY_IAM