I'd wager that Powershell is having difficulty parsing that comma and loses the ParameterValue afterwards. You may want to try to wrap whole section after --parameter
in a string (double-quoted, so $version
still resolves):
aws cloudformation create-stack --stack-name Cloud-$version --template-body C:\awsdeploy\MyCloud.template --parameters "ParameterKey=BuildNumber,ParameterValue=$version"
Or, failing that, try running the line explicitly in the cmd environment.
If you're interested in an alternative solution, AWS has implemented their command line tools in a separate utility called AWS Tools for Powershell. create-stack
maps to New-CFNStack
as shown in this documentation: New-CFNStack Docs
It looks like this would be the equivalent call:
$p1 = New-Object -Type Amazon.CloudFormation.Model.Parameter
$p1.ParameterKey = "BuildNumber"
$p1.ParameterValue = "$version"
New-CFNStack -StackName "cloud-$version" `
-TemplateBody "C:\awsdeploy\MyCloud.template" `
-Parameters @( $p1 )