Re:Show HN: Bash-My-AWS – CLI Commands for AWS
by dvtrn on Wednesday January 01, 2020 @12:19PM
(#21929050)
Hasn’t AWSCLI supported toggling the cmd output to either text, json or csv for quite some time now or have I misunderstood your comment here?
[ Parent
| on HN ]
Re:Show HN: Bash-My-AWS – CLI Commands for AWS
by failmode on Wednesday January 01, 2020 @05:50PM
(#21931298)
Bash-My-AWS wraps AWSCLI as thinly as possible and makes use of JMESPath and the text output.
The result is you have a simple set of commands that don't require you to type hundreds of characters.
instances() {
local instance_ids=$(__bma_read_inputs)
local filters=$(__bma_read_filters $@)
aws ec2 describe-instances \
$([[ -n ${instance_ids} ]] && echo --instance-ids ${instance_ids}) \
--query "
Reservations[].Instances[][
InstanceId,
InstanceType,
State.Name,
[Tags[?Key=='Name'].Value][0][0],
LaunchTime,
Placement.AvailabilityZone,
VpcId
]" \
--output text |
grep -E -- "$filters" |
LC_ALL=C sort -b -k 6 |
column -s$'\t' -t
}