powershellaws-cliparameter-splatting

Splatting args into the AWS cli results in "unknown options"


I'm getting the error unknown options from this:

$test = "s3",  "ls",  "s3://mybucket", '--region us-east-2'
aws @test

Unknown options: --region us-east-2


Solution

  • The problem is the argument with a value needs to be broken up:
    '--region us-east-2' to '--region', 'us-east-2'

    $test = "s3",  "ls",  "s3://mybucket", '--region', 'us-east-2'
    aws @test