0

I have a normal CodeDeploy package which is able to deployed using the Console without any issues, but when using the CLI, I get a weird error.

aws deploy create-deployment --application-name MyApp --s3-location bucket=mybucket,key=My.Zip.1.1.1.zip,bundleType=zip --deployment-group-name MyDeploymentGroup --deployment-config-name CodeDeployDefault.OneAtATime --description "This throwns an error"

Running the above, I get the following returned:

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

  aws help
  aws <command> help
  aws <command> <subcommand> help

Unknown options: bundleType=zip, key=My.Zip.1.1.1.zip

Weird, since the help does say you need bundleType and key in the s3-location parameter. Just as a test, I remove these unknown options:

aws deploy create-deployment --application-name MyApp --s3-location bucket=mybucket --deployment-group-name MyDeploymentGroup --deployment-config-name CodeDeployDefault.OneAtATime --description "This throwns an error"

Which returns:

--s3-location must specify bucket, key and bundleType.

So, now you know of these options and require them? What is going on here? Am I missing something obvious?

Matt
  • 189
  • 1
  • 10

2 Answers2

1

I had the same issue. It seemed to be related to the version of PowerShell. It worked on v5, but not on v4.

To fix it, I just put double quotes around the s3-location argument:

aws deploy create-deployment --application-name MyApp --s3-location "bucket=mybucket,key=My.Zip.1.1.1.zip,bundleType=zip" --deployment-group-name MyDeploymentGroup --deployment-config-name CodeDeployDefault.OneAtATime --description "This throwns an error"
Stephen Oberauer
  • 5,237
  • 6
  • 53
  • 75
0

When I ran the code you provided, I got the following returned:

$ aws --version
aws-cli/1.10.60 Python/2.7.11 Darwin/15.6.0 botocore/1.4.50 
$ aws deploy create-deployment --application-name ...snip

An error occurred (ApplicationDoesNotExistException) when calling the CreateDeployment operation: No application found for name: MyApp

And this(AWS server side error) is the expected behaviour(I guess).

One possibility that your CLI raised the validation error is that your AWS CLI is out of date.

Which version is your AWS CLI?

quiver
  • 4,230
  • 1
  • 22
  • 20
  • Well, the expected behaviour is that it creates the deployment, as the application does exist for me. I was running "aws-cli/1.10.32 Python/2.7.9 Windows/8 botocore/1.4.22", so updated to "aws-cli/1.10.61 Python/2.7.9 Windows/8 botocore/1.4.51" but the same thing occurs. – Matt Sep 02 '16 at 05:39
  • Even running "aws deploy create-deployment --application-name a --s3-location bucket=a,key=a.zip,bundleType=zip --deployment-group-name a" has the same error. – Matt Sep 02 '16 at 05:40
  • In "expected behaviour" I mean AWS CLI validation error does not error. – quiver Sep 02 '16 at 14:53
  • I also tried with latest CLI on Windows, but I couldn't reproduce your error. – quiver Sep 02 '16 at 14:59
  • A full uninstall, reboot, re-install cycle fixed the issue. Must have been related to a prior version as suspected above. – Matt Sep 05 '16 at 06:15