Skip to content

Commit 1d2b5b7

Browse files
author
andrew
committed
merge
2 parents 7bccd31 + 01e68fb commit 1d2b5b7

File tree

7 files changed

+889
-57
lines changed

7 files changed

+889
-57
lines changed

aliases

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ alias debug='${BMA_HOME:-$HOME/.bash-my-aws}/bin/bma debug'
9292
alias deployment='${BMA_HOME:-$HOME/.bash-my-aws}/bin/bma deployment'
9393
alias deployment-delete-danger='${BMA_HOME:-$HOME/.bash-my-aws}/bin/bma deployment-delete-danger'
9494
alias deployment-groups='${BMA_HOME:-$HOME/.bash-my-aws}/bin/bma deployment-groups'
95-
alias deployments='${BMA_HOME:-$HOME/.bash-my-aws}/bin/bma deployments'
9695
alias deployments-group='${BMA_HOME:-$HOME/.bash-my-aws}/bin/bma deployments-group'
9796
alias distributions='${BMA_HOME:-$HOME/.bash-my-aws}/bin/bma distributions'
9897
alias ecr-repositories='${BMA_HOME:-$HOME/.bash-my-aws}/bin/bma ecr-repositories'
@@ -117,9 +116,6 @@ alias elbv2-dnsname='${BMA_HOME:-$HOME/.bash-my-aws}/bin/bma elbv2-dnsname'
117116
alias elbv2-subnets='${BMA_HOME:-$HOME/.bash-my-aws}/bin/bma elbv2-subnets'
118117
alias elbv2-target-groups='${BMA_HOME:-$HOME/.bash-my-aws}/bin/bma elbv2-target-groups'
119118
alias elbv2s='${BMA_HOME:-$HOME/.bash-my-aws}/bin/bma elbv2s'
120-
alias fargate-clusters='${BMA_HOME:-$HOME/.bash-my-aws}/bin/bma fargate-clusters'
121-
alias fargate-services='${BMA_HOME:-$HOME/.bash-my-aws}/bin/bma fargate-services'
122-
alias fargate-tasks='${BMA_HOME:-$HOME/.bash-my-aws}/bin/bma fargate-tasks'
123119
alias hosted-zone-a-records='${BMA_HOME:-$HOME/.bash-my-aws}/bin/bma hosted-zone-a-records'
124120
alias hosted-zone-ns-records='${BMA_HOME:-$HOME/.bash-my-aws}/bin/bma hosted-zone-ns-records'
125121
alias hosted-zones='${BMA_HOME:-$HOME/.bash-my-aws}/bin/bma hosted-zones'

docs/command-reference.md

Lines changed: 42 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,15 +1361,9 @@ List logging status of Cloudtrails
13611361
List deployments
13621362

13631363

1364-
### deployments
1365-
1366-
List all deployment IDs for a deployment group (not useful for the user, only internal)
1367-
# ?? if no deployment group, could we list all deployments for this application, with their groups and statuses?
1368-
1369-
13701364
### deployment-groups
13711365

1372-
List all deployment groups for an application
1366+
List min, desired and maximum capacities of EC2 Autoscaling Group(s)
13731367

13741368

13751369
## ecr-commands
@@ -1434,7 +1428,7 @@ if you do pass a filter, it filters on the task name. All clusters are included
14341428

14351429
### ecs-scaling-activities
14361430

1437-
LIst autoscaling activities - the actual scaling events that have happened
1431+
List autoscaling activities - the actual scaling events that have happened
14381432
eg
14391433
ecs-scaling www
14401434
2023-11-22T06:24:50.937000+11:00 www-ecs-public-ServicePublic-OuN3rXBLvmx3-AlarmLow-64de4512-d901-4b26-a6a2-184bb1e90bc6 in state ALARM triggered policy www-ecs-public-target-tracking-mem70 Successfully set desired count to 2. Change successfully fulfilled by ecs.
@@ -1471,6 +1465,28 @@ Most of the things you want to know about a replication group are boolean
14711465
eg AutomaticFailover, MultiAZClusterEnabled, AtRestEncryptionEnabled etc
14721466

14731467

1468+
## elasticache-commands-littlelaptop
1469+
1470+
1471+
### elasticaches
1472+
1473+
List elasticache thingies
1474+
1475+
$ target-groups
1476+
bash-my-aws-nlb-tg TCP 22 vpc-04636ebe5573f6f65 instance bash-my-aws-nlb
1477+
bash-my-aws-alb-tg HTTP 443 vpc-04636ebe5573f6f65 instance bash-my-aws-alb
1478+
1479+
1480+
### elasticache-replication-groups
1481+
1482+
1483+
Accepts Target Group names on stdin or as arguments
1484+
1485+
$ target-group-targets bash-my-aws-nlb-tg
1486+
i-4e15ece1de1a3f869 443 healthy bash-my-aws-nlb-tg
1487+
i-89cefa9403373d7a5 443 unhealthy bash-my-aws-nlb-tg
1488+
1489+
14741490
## elb-commands
14751491

14761492

@@ -1607,28 +1623,6 @@ List target groups of ELBv2(s) [Application and Network Load Balancers)
16071623
bash-my-aws-alb-tg HTTP 443 vpc-018d9739 bash-my-aws-alb
16081624

16091625

1610-
## fargate-commands
1611-
1612-
1613-
### fargate-clusters
1614-
1615-
List ECS clusters
1616-
1617-
1618-
### fargate-services
1619-
1620-
List ECS services
1621-
gets all clusters if no cluster_names passed in
1622-
echo "cluster_names=$cluster_names"
1623-
1624-
1625-
### fargate-tasks
1626-
1627-
List ECS services
1628-
gets all clusters if no cluster_names passed in
1629-
echo "service_names=$service_names"
1630-
1631-
16321626
## iam-commands
16331627

16341628

@@ -2098,24 +2092,24 @@ Run a command locally on EC2 instance(s) running Windows
20982092
$ ssm-instances Windows | ssm-send-command-windows Get-Hotfix
20992093
Command ID: a0eeeddc-2edf-42bc-b0c7-122f5bc50956
21002094
Waiting for command to complete...
2101-
i-0fake1234abcd
2102-
Source Description HotFixID InstalledBy InstalledOn
2103-
------ ----------- -------- ----------- -----------
2104-
FAKEAPP01234 Update KB1234567 NT AUTHORITY\SYSTEM 10/11/2023 12:00:00 AM
2105-
FAKEAPP01234 Update KB8901234 NT AUTHORITY\SYSTEM 12/12/2018 12:00:00 AM
2106-
FAKEAPP01234 Security Update KB5678901 NT AUTHORITY\SYSTEM 12/12/2018 12:00:00 AM
2107-
FAKEAPP01234 Update KB2345678 NT AUTHORITY\SYSTEM 1/9/2019 12:00:00 AM
2108-
FAKEAPP01234 Update KB3456789 NT AUTHORITY\SYSTEM 3/11/2021 12:00:00 AM
2109-
FAKEAPP01234 Security Update KB4567890 NT AUTHORITY\SYSTEM 4/21/2019 12:00:00 AM
2110-
FAKEAPP01234 Security Update KB5678901 NT AUTHORITY\SYSTEM 5/15/2019 12:00:00 AM
2111-
FAKEAPP01234 Security Update KB6789012 NT AUTHORITY\SYSTEM 6/12/2019 12:00:00 AM
2112-
---Output truncated---
2113-
i-0fake1234abcd
2114-
Source Description HotFixID InstalledBy InstalledOn
2115-
------ ----------- -------- ----------- -----------
2116-
FAKEAPP01234 Update KB1234567 NT AUTHORITY\SYSTEM 10/11/2023 12:00:00 AM
2117-
FAKEAPP01234 Update KB8901234 NT AUTHORITY\SYSTEM 12/12/2018 12:00:00 AM
2118-
FAKEAPP01234 Security Update KB5678901 NT AUTHORITY\SYSTEM 12/12/2018 12:00:00 AM
2095+
i-0fake1234abcd
2096+
Source Description HotFixID InstalledBy InstalledOn
2097+
------ ----------- -------- ----------- -----------
2098+
FAKEAPP01234 Update KB1234567 NT AUTHORITY\SYSTEM 10/11/2023 12:00:00 AM
2099+
FAKEAPP01234 Update KB8901234 NT AUTHORITY\SYSTEM 12/12/2018 12:00:00 AM
2100+
FAKEAPP01234 Security Update KB5678901 NT AUTHORITY\SYSTEM 12/12/2018 12:00:00 AM
2101+
FAKEAPP01234 Update KB2345678 NT AUTHORITY\SYSTEM 1/9/2019 12:00:00 AM
2102+
FAKEAPP01234 Update KB3456789 NT AUTHORITY\SYSTEM 3/11/2021 12:00:00 AM
2103+
FAKEAPP01234 Security Update KB4567890 NT AUTHORITY\SYSTEM 4/21/2019 12:00:00 AM
2104+
FAKEAPP01234 Security Update KB5678901 NT AUTHORITY\SYSTEM 5/15/2019 12:00:00 AM
2105+
FAKEAPP01234 Security Update KB6789012 NT AUTHORITY\SYSTEM 6/12/2019 12:00:00 AM
2106+
---Output truncated---
2107+
i-0fake1234abcd
2108+
Source Description HotFixID InstalledBy InstalledOn
2109+
------ ----------- -------- ----------- -----------
2110+
FAKEAPP01234 Update KB1234567 NT AUTHORITY\SYSTEM 10/11/2023 12:00:00 AM
2111+
FAKEAPP01234 Update KB8901234 NT AUTHORITY\SYSTEM 12/12/2018 12:00:00 AM
2112+
FAKEAPP01234 Security Update KB5678901 NT AUTHORITY\SYSTEM 12/12/2018 12:00:00 AM
21192113

21202114
See also: ssm-send-command-windows
21212115

functions

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ debug
9292
deployment
9393
deployment-delete-danger
9494
deployment-groups
95-
deployments
9695
deployments-group
9796
distributions
9897
ecr-repositories
@@ -117,9 +116,6 @@ elbv2-dnsname
117116
elbv2-subnets
118117
elbv2-target-groups
119118
elbv2s
120-
fargate-clusters
121-
fargate-services
122-
fargate-tasks
123119
hosted-zone-a-records
124120
hosted-zone-ns-records
125121
hosted-zones

lib/codedeploy-functions

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/bash
2+
# shellcheck disable=SC2046
3+
# shellcheck disable=SC2155
4+
#
5+
# codedeploy-functions
6+
7+
deployment() {
8+
9+
# List deployments
10+
11+
local deploymentgroup_names=$(skim-stdin)
12+
local filters=$(__bma_read_filters $@)
13+
14+
# aws deploy list-applications
15+
# aws deploy list-deployment-groups --application-name 'tenders-web-dev2'
16+
# list-deployments (limit to last 24 hours or most recent 5??)
17+
# aws deploy list-deployments --deployment-group-name gc3-test2 --application-name grants-web-gc3-test2 --include-only-statuses "Succeeded" --query 'deployments[0]'
18+
# aws deploy get-deployment --deployment-id d-MLWOBA1PK
19+
aws deploy list-deployments \
20+
${asg_names/#/'--auto-scaling-group-names '} \
21+
--output text \
22+
--query "AutoScalingGroups[].[
23+
AutoScalingGroupName,
24+
join(',', [Tags[?Key=='Name'].Value || 'NO_NAME'][]),
25+
CreatedTime,
26+
join(',' sort(AvailabilityZones))
27+
]" |
28+
grep -E -- "$filters" |
29+
sort -k 3 |
30+
column -s$'\t' -t
31+
}
32+
33+
34+
deployment-groups() {
35+
36+
# List min, desired and maximum capacities of EC2 Autoscaling Group(s)
37+
38+
local asg_names=$(skim-stdin "$@")
39+
[[ -z $asg_names ]] && __bma_usage "asg_name [asg_name]" && return 1
40+
41+
# shellcheck disable=SC2086
42+
aws autoscaling describe-auto-scaling-groups \
43+
--auto-scaling-group-names $asg_names \
44+
--output text \
45+
--query "AutoScalingGroups[][
46+
AutoScalingGroupName,
47+
MinSize,
48+
DesiredCapacity,
49+
MaxSize
50+
]" |
51+
column -s$'\t' -t
52+
}
53+
54+

lib/ecs-functions

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ ecs-tasks() {
144144

145145
ecs-scaling-activities() {
146146

147-
# LIst autoscaling activities - the actual scaling events that have happened
147+
# List autoscaling activities - the actual scaling events that have happened
148148
# eg
149149
# ecs-scaling www
150150
# 2023-11-22T06:24:50.937000+11:00 www-ecs-public-ServicePublic-OuN3rXBLvmx3-AlarmLow-64de4512-d901-4b26-a6a2-184bb1e90bc6 in state ALARM triggered policy www-ecs-public-target-tracking-mem70 Successfully set desired count to 2. Change successfully fulfilled by ecs.
@@ -187,5 +187,6 @@ ecs-scaling-actions() {
187187
--query "ScheduledActions[].[ScheduledActionName,Schedule,ScalableTargetAction.MinCapacity,ScalableTargetAction.MaxCapacity]" \
188188
--output text |
189189
grep -E -- "$filters" |
190+
LC_ALL=C sort -k 1 |
190191
columnise
191192
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/bash
2+
#
3+
# elasticache-functions
4+
#
5+
#
6+
7+
8+
elasticaches() {
9+
10+
# List elasticache thingies
11+
#
12+
# $ target-groups
13+
# bash-my-aws-nlb-tg TCP 22 vpc-04636ebe5573f6f65 instance bash-my-aws-nlb
14+
# bash-my-aws-alb-tg HTTP 443 vpc-04636ebe5573f6f65 instance bash-my-aws-alb
15+
16+
local cache_names=$(skim-stdin)
17+
local filters=$(__bma_read_filters $@)
18+
19+
aws elasticache describe-cache-clusters \
20+
${cache_names/#/'--cache-cluster-id '} \
21+
--output text \
22+
--query "
23+
CacheClusters[][
24+
CacheClusterId,
25+
CacheNodeType,
26+
Engine,
27+
EngineVersion,
28+
CacheClusterStatus
29+
]" |
30+
grep -E -- "$filters" |
31+
LC_ALL=C sort -b |
32+
column -s$'\t' -t
33+
}
34+
35+
36+
elasticache-replication-groups() {
37+
38+
#
39+
# Accepts Target Group names on stdin or as arguments
40+
#
41+
# $ target-group-targets bash-my-aws-nlb-tg
42+
# i-4e15ece1de1a3f869 443 healthy bash-my-aws-nlb-tg
43+
# i-89cefa9403373d7a5 443 unhealthy bash-my-aws-nlb-tg
44+
45+
local ec_names=$(skim-stdin "$@")
46+
47+
for ec_name in $ec_names; do
48+
local tg_arn=$(aws describe-replication-groups \
49+
--names "$ec_name" \
50+
--output text \
51+
--query "
52+
ReplicationGroups[][
53+
ReplicationGroupId
54+
]
55+
")
56+
done | column -s$'\t' -t
57+
}

0 commit comments

Comments
 (0)