Skip to content

Commit 00d8720

Browse files
author
andrew
committed
Fix throttling for SSM parameters
1 parent e1cb51f commit 00d8720

File tree

5 files changed

+232
-1
lines changed

5 files changed

+232
-1
lines changed

aliases

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ alias elb-subnets='${BMA_HOME:-$HOME/.bash-my-aws}/bin/bma elb-subnets'
113113
alias elb-tag='${BMA_HOME:-$HOME/.bash-my-aws}/bin/bma elb-tag'
114114
alias elb-tags='${BMA_HOME:-$HOME/.bash-my-aws}/bin/bma elb-tags'
115115
alias elbs='${BMA_HOME:-$HOME/.bash-my-aws}/bin/bma elbs'
116+
alias elbv2-arn='${BMA_HOME:-$HOME/.bash-my-aws}/bin/bma elbv2-arn'
116117
alias elbv2-azs='${BMA_HOME:-$HOME/.bash-my-aws}/bin/bma elbv2-azs'
117118
alias elbv2-dnsname='${BMA_HOME:-$HOME/.bash-my-aws}/bin/bma elbv2-dnsname'
118119
alias elbv2-subnets='${BMA_HOME:-$HOME/.bash-my-aws}/bin/bma elbv2-subnets'

bash_completion.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ complete -F _bma_elbs_completion elb-subnets
192192
complete -F _bma_elbs_completion elb-tag
193193
complete -F _bma_elbs_completion elb-tags
194194
complete -F _bma_elbs_completion elbs
195+
complete -F _bma_elbv2s_completion elbv2-arn
195196
complete -F _bma_elbv2s_completion elbv2-azs
196197
complete -F _bma_elbv2s_completion elbv2-dnsname
197198
complete -F _bma_elbv2s_completion elbv2-subnets

docs/command-reference.md

Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,6 +1614,17 @@ Accepts Load Balancer names on STDIN and converts to Network Load Balancer names
16141614
bash-my-aws-alb application internet-facing provisioning 2020-01-04T11:29:45.030Z
16151615

16161616

1617+
### elbv2-arn
1618+
1619+
List DNS Names of elbv2(s)
1620+
1621+
USAGE: elbv2-dnsname load-balancer [load-balancer]
1622+
1623+
$ elbv2s | elbv2-dnsname
1624+
bash-my-aws bash-my-aws-c23c598688520e51.elb.ap-southeast-2.amazonaws.com
1625+
bash-my-aws-alb bash-my-aws-alb-2036199590.ap-southeast-2.elb.amazonaws.com
1626+
1627+
16171628
### elbv2-dnsname
16181629

16191630
List DNS Names of elbv2(s)
@@ -2242,6 +2253,221 @@ List targets for SSM Association Execution
22422253
Note: Can't use skim-stdin as it requires to arguments
22432254

22442255

2256+
### ssm-parameters
2257+
2258+
List SSM Parameters
2259+
2260+
USAGE: ssm-parameters [filter]
2261+
2262+
$ ssm-parameters
2263+
/company/ad/a1234567/username
2264+
/ami/Ubuntu-20.04-proxy
2265+
/cloudwatch-agent/config/general
2266+
/cnf/staticSite/B1P2V34SR5KF0Z/encryptionKeyArn
2267+
/ops/CloudMetrics/linux
2268+
/ops/CloudMetrics/windows
2269+
2270+
2271+
### ssm-parameter-value
2272+
2273+
Print SSM Parameter Value
2274+
2275+
USAGE: ssm-parameter-value ssm-parameter [ssm-parameter]
2276+
2277+
$ ssm-parameters | ssm-parameter-value
2278+
/ops/Monitoring/metrics/unix
2279+
{
2280+
"agent": {
2281+
"metrics_collection_interval": 60,
2282+
"logfile": "/var/log/aws-monitoring/aws-monitoring-agent.log"
2283+
},
2284+
"logs": {
2285+
"logs_collected": {
2286+
"files": {
2287+
<snip>
2288+
2289+
2290+
### instance-ssm-platform-type
2291+
2292+
Show platform type (OS) for instance
2293+
2294+
USAGE: instance-ssm-platform-type instance-id [instance-id]
2295+
2296+
$ instances | instance-ssm-platform-type
2297+
i-0c1d2e3f4a567890b None
2298+
i-0d1c2b3a4e5f6789c Linux
2299+
i-0e1f2d3c4b5a6789d Linux
2300+
i-0f1e2d3c4b5a6789e None
2301+
i-0a9f8e7d6c5b4a312 None
2302+
i-01b2a3c4d5e6f7893 Windows
2303+
2304+
2305+
## ssm-commands~
2306+
2307+
2308+
### ssm-instances
2309+
2310+
List Instances known to SSM
2311+
2312+
USAGE: ssm-instances [filter]
2313+
2314+
$ ssm-instances
2315+
i-00a123b456d789012 Online Amazon Linux 2 192.168.1.10 server001.example.com
2316+
i-01b234c567e890123 Online Microsoft Windows Server 2019 Datacenter 10.0.17763 192.168.1.20 winserver002.example.com
2317+
i-02c345d678f901234 Online Ubuntu 20.04 192.168.1.30 ubuntu003.example.com
2318+
i-03d456e789a012345 Online Ubuntu 20.04 192.168.1.40 ubuntu004.example.com
2319+
i-04e567f89b1234567 Online Amazon Linux 2 192.168.1.50 server005.example.com
2320+
*Optionally provide a filter string for a `| grep` effect with tighter columisation:*
2321+
2322+
$ ssm-instances Windows
2323+
i-00a123b456d789012 Online Microsoft Windows Server 2019 Datacenter 68.0.11111 192.168.1.10 server001.example.com
2324+
i-01b234c567e890123 Online Microsoft Windows Server 2022 Datacenter 68.0.11112 192.168.1.20 winserver002.example.com
2325+
2326+
2327+
### ssm-send-command
2328+
2329+
Run a command locally on EC2 instance(s) running Linux
2330+
2331+
USAGE: ssm-send-command COMMAND instance-id [instance-id]
2332+
2333+
$ ssm-send-command 'date +%F' i-0fict1234abcd
2334+
Command ID: 12345abc-de67-f890-gh12-34ij56kl789m
2335+
Waiting for command to complete...
2336+
i-0fict1234abcd 2023-12-01
2337+
2338+
$ ssm-instances | grep Linux | ssm-send-command 'date +%F'
2339+
Command ID: 98b7c6d2-e3f4-11ac-8d20-47a56db09c8f
2340+
Waiting for command to complete...
2341+
i-0fake1234a567bcd 2023-12-01
2342+
i-0fake2345b678cde 2023-12-01
2343+
i-0fake3456c789def 2023-11-30
2344+
i-0fake4567d890efa 2023-11-30
2345+
i-0fake5678e901fgh 2023-12-01
2346+
i-0fake6789f012ghi 2023-12-01
2347+
2348+
See also: ssm-send-command-windows
2349+
Escape double quotes in command
2350+
Send command
2351+
2352+
2353+
### ssm-send-command-windows
2354+
2355+
Run a command locally on EC2 instance(s) running Windows
2356+
2357+
USAGE: ssm-send-command-windows COMMAND instance-id [instance-id]
2358+
2359+
$ ssm-send-command 'Get-Hotfix' i-0fict1234abcd
2360+
Command ID: 12345abc-de67-f890-gh12-34ij56kl789m
2361+
Waiting for command to complete...
2362+
i-0fict1234abcd 2023-12-01
2363+
2364+
$ ssm-instances Windows | ssm-send-command-windows Get-Hotfix
2365+
Command ID: a0eeeddc-2edf-42bc-b0c7-122f5bc50956
2366+
Waiting for command to complete...
2367+
i-0fake1234abcd
2368+
Source Description HotFixID InstalledBy InstalledOn
2369+
------ ----------- -------- ----------- -----------
2370+
FAKEAPP01234 Update KB1234567 NT AUTHORITY\SYSTEM 10/11/2023 12:00:00 AM
2371+
FAKEAPP01234 Update KB8901234 NT AUTHORITY\SYSTEM 12/12/2018 12:00:00 AM
2372+
FAKEAPP01234 Security Update KB5678901 NT AUTHORITY\SYSTEM 12/12/2018 12:00:00 AM
2373+
FAKEAPP01234 Update KB2345678 NT AUTHORITY\SYSTEM 1/9/2019 12:00:00 AM
2374+
FAKEAPP01234 Update KB3456789 NT AUTHORITY\SYSTEM 3/11/2021 12:00:00 AM
2375+
FAKEAPP01234 Security Update KB4567890 NT AUTHORITY\SYSTEM 4/21/2019 12:00:00 AM
2376+
FAKEAPP01234 Security Update KB5678901 NT AUTHORITY\SYSTEM 5/15/2019 12:00:00 AM
2377+
FAKEAPP01234 Security Update KB6789012 NT AUTHORITY\SYSTEM 6/12/2019 12:00:00 AM
2378+
---Output truncated---
2379+
i-0fake1234abcd
2380+
Source Description HotFixID InstalledBy InstalledOn
2381+
------ ----------- -------- ----------- -----------
2382+
FAKEAPP01234 Update KB1234567 NT AUTHORITY\SYSTEM 10/11/2023 12:00:00 AM
2383+
FAKEAPP01234 Update KB8901234 NT AUTHORITY\SYSTEM 12/12/2018 12:00:00 AM
2384+
FAKEAPP01234 Security Update KB5678901 NT AUTHORITY\SYSTEM 12/12/2018 12:00:00 AM
2385+
2386+
See also: ssm-send-command-windows
2387+
2388+
2389+
### ssm-automation-executions
2390+
2391+
List recent SSM Automation Executions
2392+
USAGE: ssm-automation-executions [filter]
2393+
2394+
$ ssm-automation-executions
2395+
1234abcd-ef56-7890-gh12-ijk3456lmnop UpdateAndSecureNodes None Failed 2023-07-20T09:00:00.000000+00:00 None
2396+
5678efgh-ijkl-9012-mnop-qrstuvwx3456 UpdateAndSecureNodes i-0a1b2c3d4e5f67890 Failed 2023-07-20T09:00:10.000000+00:00 None
2397+
90abijkl-mnop-4567-qrst-uvwxyza12345 UpdateAndSecureNodes i-1b2c3d4e5f6g78901 Failed 2023-07-20T09:00:20.000000+00:00 None
2398+
cdefmnop-qrst-8910-uvwx-yzab1234cdef UpdateAndSecureNodes i-2c3d4e5f6g7h89012 Failed 2023-07-20T09:00:30.000000+00:00 None
2399+
ghijqrst-uvwx-2345-yzab-abcd5678efgh UpdateAndSecureNodes i-3d4e5f6g7h8i90123 Failed 2023-07-20T09:00:40.000000+00:00 None
2400+
2401+
2402+
### ssm-automation-execution-failures
2403+
2404+
2405+
2406+
### ssm-automation-step-executions
2407+
2408+
Show step-by-step details for an SSM Automation Execution
2409+
2410+
USAGE: automation-execution-steps execution_id [execution_id]
2411+
2412+
$ ssm-automation-executions | ssm-automation-steps-executions
2413+
[Outputs detailed step information for each provided execution ID]
2414+
2415+
2416+
### ssm-automation-execution
2417+
2418+
Show details for an SSM Automation Execution
2419+
2420+
USAGE: ssm-automation-execution execution_id [execution_id]
2421+
2422+
$ ssm-automation-executions | head | ssm-automation-execution
2423+
1234abcd-5678-9def-ghij-klmnopqrstuv DeployNewFeatures i-01234a5b6c7d8e9f0 Failed 2023-09-10T10:10:10.000000+00:00 2023-09-10T10:10:20.000000+00:00
2424+
9876fedc-ba98-7654-c321-onmlkjihgfed DeployNewFeatures i-09876b5c4d3e2f1g0 Failed 2023-09-10T10:20:30.000000+00:00 2023-09-10T10:20:40.000000+00:00
2425+
abcd1234-efgh-5678-ijkl-9mnopq7rstuv DeployNewFeatures i-0a1b2c3d4e5f6g7h8 Failed 2023-09-10T10:30:50.000000+00:00 2023-09-10T10:31:00.000000+00:00
2426+
ijkl8765-ghij-4321-klmn-5opq4rstu3vw DeployNewFeatures i-0i8j7k6l5m4n3o2p1 Failed 2023-09-10T10:40:10.000000+00:00 2023-09-10T10:40:20.000000+00:00
2427+
2428+
2429+
### ssm-associations
2430+
2431+
List SSM associations
2432+
2433+
USAGE: ssm-associations [filter]
2434+
2435+
$ ssm-associations
2436+
Task-RunSecurityScan cron(30 2 * * SUN) 2023-01-15T02:30:00.000000+00:00 Failed
2437+
Task-UpdateSystemPackages cron(0 4 * * SAT) 2023-04-22T04:00:00.000000+00:00 Success
2438+
Service-ConfigureNetworkSettings rate(7 days) 2023-05-07T11:00:00.000000+00:00 Success
2439+
Script-DeployMonitoringTools cron(15 3 * * FRI) 2023-03-03T03:15:00.000000+00:00 Failed
2440+
2441+
2442+
### ssm-association-executions
2443+
2444+
List SSM Association Executions
2445+
2446+
USAGE: ssm-associations [filter]
2447+
2448+
$ ssm-associations
2449+
12345678-9abc-def0-1234-56789abcdef0 a1b2c3d4-e5f6-7890-a1b2-c3d4e5f67890 Success {Success=10} 2023-07-21T10:30:00.000000+00:00
2450+
12345678-9abc-def0-1234-56789abcdef0 b1c2d3e4-f5g6-7890-b1c2-d3e4f5g67890 Success {Success=15} 2023-07-22T11:00:00.000000+00:00
2451+
12345678-9abc-def0-1234-56789abcdef0 c1d2e3f4-g5h6-7890-c1d2-e3f4g5h67890 Success {Success=13} 2023-07-23T09:45:00.000000+00:00
2452+
12345678-9abc-def0-1234-56789abcdef0 d1e2f3g4-h5i6-7890-d1e2-f3g4h5i67890 Failed {Failed=2, Success=12} 2023-07-24T12:30:00.000000+00:00
2453+
12345678-9abc-def0-1234-56789abcdef0 e1f2g3h4-i5j6-7890-e1f2-g3h4i5j67890 Failed {Failed=3, Success=11} 2023-07-25T14:15:00.000000+00:00
2454+
2455+
2456+
### ssm-association-execution-targets
2457+
2458+
List targets for SSM Association Execution
2459+
2460+
USAGE: ssm-association-execution-targets association-id execution-id
2461+
2462+
$ association-execution-targets abcd1234-ef56-7890-gh12-ijk3456lmnop 12345678-90ab-cdef-1234-567890abcdef
2463+
abcd1234-ef56-7890-gh12-ijk3456lmnop 12345678-90ab-cdef-1234-567890abcdef i-01234abcde56789f0 Success Success 2023-08-10T11:30:00.000000+00:00
2464+
abcd1234-ef56-7890-gh12-ijk3456lmnop 12345678-90ab-cdef-1234-567890abcdef i-02345bcdef67891g1 Success Success 2023-08-10T11:30:10.000000+00:00
2465+
abcd1234-ef56-7890-gh12-ijk3456lmnop 12345678-90ab-cdef-1234-567890abcdef i-03456cdefg78912h2 Success Success 2023-08-10T11:30:20.000000+00:00
2466+
abcd1234-ef56-7890-gh12-ijk3456lmnop 12345678-90ab-cdef-1234-567890abcdef i-04567defgh89123i3 Success Success 2023-08-10T11:30:30.000000+00:00
2467+
2468+
Note: Can't use skim-stdin as it requires to arguments
2469+
2470+
22452471
### ssm-parameters
22462472

22472473
List SSM Parameters

functions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ elb-subnets
113113
elb-tag
114114
elb-tags
115115
elbs
116+
elbv2-arn
116117
elbv2-azs
117118
elbv2-dnsname
118119
elbv2-subnets

lib/ssm-functions

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,8 @@ ssm-parameters() {
387387
# /cnf/staticSite/B1P2V34SR5KF0Z/encryptionKeyArn
388388
# /ops/CloudMetrics/linux
389389
# /ops/CloudMetrics/windows
390-
390+
export AWS_MAX_ATTEMPTS=10
391+
export AWS_RETRY_MODE=adaptive # try to avoid throttling exceptions
391392
local filters=$(__bma_read_filters $@)
392393
aws ssm describe-parameters \
393394
--output text \
@@ -421,6 +422,7 @@ ssm-parameter-value() {
421422
aws ssm get-parameter \
422423
--name "$parameter" \
423424
--query Parameter.Value \
425+
--with-decryption \
424426
--output json
425427
done
426428
}

0 commit comments

Comments
 (0)