Question

I'm attempting to use the new(ish) AWS unified CLI with command aws elasticbeanstalk create-application-version and am unable to get the format of the --source-bundle argument correctly.

I've tried various formats and get similar errors each time. The commands are being run on Windows Server 2008 via Powershell. I am able to use the aws s3 mb and cp commands without issue so I do not believe it is an installation, Python/PATH, or Windows issue.

You'll see the $builddate variable which is defined in Powershell as follows:

$builddate = Get-Date -format MMddyyhhmmss

Commands I've tried and their errors

Command:

aws elasticbeanstalk create-application-version --application-name Api.Mobile --version-label Api.Mobile-production-$builddate --source-bundle build-production/APIv1/build-production-$builddate.zip

Error:

Error parsing parameter --source-bundle, should be: --source-bundle S3Bucket=value,S3Key=value

So then I try the following command to adhere to the suggested format:

aws elasticbeanstalk create-application-version --application-name Api.Mobile --version-label Api.Mobile-production-$builddate --source-bundle S3Bucket=build-production/APIv1,S3Key=build-production-$builddate.zip

Error:

Unknown options: S3Key=build-production-022414101105.zip

I've also tried the S3Bucket= declaration without the subfolder (even though the file does not exist without the subfolder) and still get the Unknown options error.

Was it helpful?

Solution

Turns out it was a Powershell issue of parsing the comma.

From the aws-cli Github issue, answered by jamesls:

I believe the issue is that powershell is parsing the comma character out before the CLI sees the argument list.

For example, the above command is split into arguments like this on powershell:

['elasticbeanstalk', 'create-application-version',
'--application-name', 'Api.Mobile', '--version-label',
'Api.Mobile-production-', '--source-bundle',
'S3Bucket=build-production/APIv1', 'S3Key=build-production-.zip']

If you surround the value in double quotes, then powershell leaves the comma character alone:

$ aws elasticbeanstalk create-application-version --application-name
Api.Mobile --version-label Api.Mobile-production-$builddate
--source-bundle "S3Bucket=build-production/APIv1,S3Key=build-production-$builddate.zip"

['elasticbeanstalk', 'create-application-version',
'--application-name', 'Api.Mobile', '--version-label',
'Api.Mobile-production-', '--source-bundle',
'S3Bucket=build-production/APIv1,S3Key=build-production-.zip']
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top