aws / aws/aws-cli

Delete Cloudwatch alarm incorrectly assumes JSON is being passed to it

Open
#3,620 3 comments 1 reaction 0 assignees View on GitHub
bug cloudwatch confusing-error documentation p2
Dominant language
Python
Stars
17.3k
Forks
4.6k
Avg merge
1d 2h
Merged PRs (30d)
13

Description

When deleting a Cloudwatch alarm with `aws cloudwatch delete-alarms`, if the string begins with an open square bracket (`[`), the AWS CLI will assume that JSON is being passed.

Annoyingly this only applies to deleting alarms, not creating them. To resolve the issue we have had to place the string in a JSON array with a single element.

```sh
$ aws cloudwatch delete-alarms --alarm-names "[test] this is not JSON"

Expecting value: line 1 column 2 (char 1)
$ aws cloudwatch delete-alarms --alarm-names "this is not JSON"
$ aws cloudwatch delete-alarms --alarm-names '["[test] this is not JSON"]' --region eu-west-2
$
```

In my use-case, we have alarms that begin with square brackets in order to identify the relevant deployment/service.

I am not sure if this is a lack of documentation issue (as passing an array is not in the AWS CLI public documentation) or an issue with identifying if a JSON array has been passed - I'd argue both.

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.