aws / aws/aws-cli

`--cli-input-json` does not support equals sign (`=`) when specifying argument

Open
#7,058 7 comments 0 reactions 0 assignees View on GitHub
bug ec2 p3
Dominant language
Python
Stars
17.3k
Forks
4.6k
Avg merge
1d 2h
Merged PRs (30d)
13

Description

### Describe the bug

When passing JSON arguments via `--cli-input-json`, `aws ec2 create-security-group` seems to ignore the values `GroupName` and `Description`.

### Expected Behavior

```
$ aws ec2 create-security-group --region=us-west-2 --cli-input-json='{"Description":"desc", "GroupName":"name", "VpcId":"vpc-xxxxxxxx"}'

{
"GroupId": "sg-xxxxxxxx"
}
```

### Current Behavior

```
$ aws ec2 create-security-group --region=us-west-2 --cli-input-json='{"Description":"desc", "GroupName":"name", "VpcId":"vpc-xxxxxxxx"}'

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

aws help
aws help
aws help

aws: error: the following arguments are required: --description, --group-name
```

### Reproduction Steps

```bash
#/bin/bash

# Replace these with valid values.
region='us-west-2'
vpc='vpc-xxxxxxxx'

# Instead of using `jq` you can of course just write JSON directly.
args="$(jq -n --arg vpc "${vpc}" '{Description: "desc", GroupName: "name", VpcId: $vpc}')"

aws ec2 create-security-group --region="${region}" --cli-input-json="${args}"
```

### Possible Solution

I assume there's something funky in the metadata or other command setup for `create-security-group`. Strangely though, the output of `--generate-cli-skeleton` seems to be what one would expect:

```
$ aws ec2 create-security-group --generate-cli-skeleton
{
"Description": "",
"GroupName": "",
"VpcId": "",
"TagSpecifications": [
{
"ResourceType": "transit-gateway-attachment",
"Tags": [
{
"Key": "",
"Value": ""
}
]
}
],
"DryRun": true
}
```

### Additional Information/Context

_No response_

### CLI version used

aws-cli/2.6.1 Python/3.9.12 Darwin/21.5.0 source/arm64 prompt/off

### Environment details (OS name and version, etc.)

macOS 12.4

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.