aws / aws-tools-for-powershell

The AWS Tools for PowerShell lets developers and administrators manage their AWS services from the PowerShell scripting environment.
Apache License 2.0
235 stars 78 forks source link

No example to show how to use "Write-ECSClusterCapacityProvider" #157

Closed muthu329024 closed 4 years ago

muthu329024 commented 4 years ago

I'm not able to use "Write-ECSClusterCapacityProvider" to update --default-capacity-provider-strategy using powershell

> Write-ECSClusterCapacityProvider -Cluster test-cluster  -CapacityProvider test-CapacityProvider -DefaultCapacityProvider
Strategy capacityProvider=test-CapacityProvider,weight=1,base=
Write-ECSClusterCapacityProvider : Cannot bind parameter 'DefaultCapacityProviderStrategy'. Cannot convert the
"capacityProvider=test-CapacityProvider" value of type "System.String" to type "Amazon.ECS.Model.CapacityProviderStrategyItem".
At line:1 char:130
+ ... roviderStrategy capacityProvider=test-CapacityProvider,weight=1,base=
+                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Write-ECSClusterCapacityProvider], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Amazon.PowerShell.Cmdlets.ECS.WriteECSClusterCapacityProviderCmdlet

Able to execute with AWS CLI without any issue

> aws ecs put-cluster-capacity-providers --cluster test-cluster --capacity-providers test-CapacityProvider --default-capacity-provider-strategy capacityProvider=test-CapacityProvider,weight=1,base=1
{
    "cluster": { ....
muthu329024 commented 4 years ago

Got it ...

Write-ECSClusterCapacityProvider -Cluster test-cluster -CapacityProvider test-CapacityProvider -DefaultCapacityProviderStrategy @{capacityProvider="test-CapacityProvider";weight=1;base=1}