16 November,2022 by Rambler
Question : When I use the AWS CLI --output table option , I get characters returning which is breaking the output . Here is an example:
aws rds describe-db-snapshots --db-instance-identifier MyRDSInstance --query "DBSnapshots[].[DBSnapshotIdentifier,SnapshotCreateTime,SnapshotType]" --output table
---------------------------------------------------------------------------------------------------------
| DescribeDBSnapshots |
+-----------------------------------------------------+------------------------------------+------------+
| ←[1m←[34mawsbackup:job-dfghre-0d2d-121e-7cbb-953bf72345678←[0m | ←[1m←[34m2022-11-16T02:27:00.115000+00:00←[0m | ←[1m←[34mawsbackup←[0m |
How can I fix this problem? As an extra piece of information I'm executing the same on Linux - but not getting the same issue
Answer: I have seen this before and is a bug which needs to be fixed. There is a workaround - which I've used and will clean up these extra color character codes and make it much easier to read the aws cli output
The fix is to add the switch : --color off
The AWS documentation "--color <string>
Specifies support for color output. Valid values are on
, off
, and auto
. The default value is auto
."
So in your example it would be:
aws rds describe-db-snapshots --db-instance-identifier MyRDSInstance --query "DBSnapshots[].[DBSnapshotIdentifier,SnapshotCreateTime,SnapshotType]" --output table --color off
Read AWS CLI Cheatsheet for more tips on how to use AWS CLI commands
This is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
Posted by: |