-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathaws-networking-ro.yaml
More file actions
671 lines (601 loc) · 28.6 KB
/
aws-networking-ro.yaml
File metadata and controls
671 lines (601 loc) · 28.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
mcp:
description: |
AWS Networking Diagnostics Toolkit providing read-only access to AWS network configuration
and status information. This toolkit helps troubleshoot connectivity issues, security group
configurations, VPC setups, routing problems, and other AWS network-related concerns
through a secure, constrained interface to the AWS CLI.
NOTE FOR LLM: Authentication with AWS CLI is required to use these tools. If commands fail
with authentication errors, use the "aws_list_profiles" tool if available, and suggest
to use one of those profiles. If this tool is not available, please suggest to
add the tools in the "aws-ro.yaml" configuration, that provide:
1. aws_list_profiles - To list and manage AWS profiles
2. Use a specific profile with the 'profile' parameter on any command
run:
shell: bash
tools:
- name: "aws_vpc_list"
description: "List all VPCs in the AWS account"
params:
region:
type: string
description: "AWS region (e.g., us-east-1, eu-west-1)"
required: true
profile:
type: string
description: "AWS profile to use (optional, uses default if not specified)"
output_format:
type: string
description: "Output format (json, text, table)"
constraints:
- "region.matches('^[a-z]{2}-[a-z]+-[0-9]{1}$')" # Valid AWS region format
- "profile == '' || profile.matches('^[a-zA-Z0-9_-]+$')" # Valid profile name format
- "output_format == '' || ['json', 'text', 'table'].exists(f, f == output_format)" # Valid output formats
run:
timeout: "60s"
env:
- AWS_PROFILE
- AWS_DEFAULT_PROFILE
- AWS_SHARED_CREDENTIALS_FILE
- HOME
- AWS_CONFIG_FILE
command: |
FORMAT_PARAM="{{ if .output_format }}--output {{ .output_format }}{{ else }}--output table{{ end }}"
PROFILE_PARAM="{{ if .profile }}--profile {{ .profile }}{{ end }}"
# Fix environment variable names and handling
if [ -z "$AWS_SHARED_CREDENTIALS_FILE" ]; then
export AWS_SHARED_CREDENTIALS_FILE="$HOME/.aws/credentials"
fi
if [ -z "$AWS_CONFIG_FILE" ]; then
export AWS_CONFIG_FILE="$HOME/.aws/config"
fi
echo "Using AWS_SHARED_CREDENTIALS_FILE: $AWS_SHARED_CREDENTIALS_FILE"
echo "Using AWS_CONFIG_FILE: $AWS_CONFIG_FILE"
# Attempt to run the command and capture the output and exit status
OUTPUT=$(aws $PROFILE_PARAM ec2 describe-vpcs --region {{ .region }} $FORMAT_PARAM 2>&1)
EXIT_CODE=$?
# Check if authentication failed
if [[ $EXIT_CODE -ne 0 && ($OUTPUT == *"Unable to locate credentials"* || $OUTPUT == *"AuthFailure"* || $OUTPUT == *"ExpiredToken"* || $OUTPUT == *"AccessDenied"*) ]]; then
echo "AWS authentication error detected. You need valid AWS credentials to use this tool."
echo ""
echo "Try using the aws_auth_check tool from aws-ro.yaml to diagnose authentication issues:"
echo "aws_auth_check region={{ .region }}{{ if .profile }} profile={{ .profile }}{{ end }}"
echo ""
echo "Error details: $OUTPUT"
exit 1
else
# If no authentication error, just output the result
echo "$OUTPUT"
fi
output:
prefix: "VPCs in region {{ .region }}:"
- name: "aws_subnet_list"
description: "List all subnets in a VPC"
params:
region:
type: string
description: "AWS region (e.g., us-east-1, eu-west-1)"
required: true
profile:
type: string
description: "AWS profile to use (optional, uses default if not specified)"
vpc_id:
type: string
description: "VPC ID (e.g., vpc-12345678)"
output_format:
type: string
description: "Output format (json, text, table)"
constraints:
- "region.matches('^[a-z]{2}-[a-z]+-[0-9]{1}$')" # Valid AWS region format
- "profile == '' || profile.matches('^[a-zA-Z0-9_-]+$')" # Valid profile name format
- "vpc_id == '' || vpc_id.matches('^vpc-[a-f0-9]{8,}$')" # Valid VPC ID format
- "output_format == '' || ['json', 'text', 'table'].exists(f, f == output_format)" # Valid output formats
run:
timeout: "60s"
env:
- AWS_PROFILE
- AWS_DEFAULT_PROFILE
- AWS_SHARED_CREDENTIALS_FILE
- HOME
- AWS_CONFIG_FILE
command: |
FORMAT_PARAM="{{ if .output_format }}--output {{ .output_format }}{{ else }}--output table{{ end }}"
PROFILE_PARAM="{{ if .profile }}--profile {{ .profile }}{{ end }}"
FILTER="{{ if .vpc_id }}--filters Name=vpc-id,Values={{ .vpc_id }}{{ end }}"
# Fix environment variable names and handling
if [ -z "$AWS_SHARED_CREDENTIALS_FILE" ]; then
export AWS_SHARED_CREDENTIALS_FILE="$HOME/.aws/credentials"
fi
if [ -z "$AWS_CONFIG_FILE" ]; then
export AWS_CONFIG_FILE="$HOME/.aws/config"
fi
echo "Using AWS_SHARED_CREDENTIALS_FILE: $AWS_SHARED_CREDENTIALS_FILE"
echo "Using AWS_CONFIG_FILE: $AWS_CONFIG_FILE"
aws $PROFILE_PARAM ec2 describe-subnets --region {{ .region }} $FILTER $FORMAT_PARAM
output:
prefix: "Subnets{{ if .vpc_id }} in VPC {{ .vpc_id }}{{ end }} (region {{ .region }}):"
- name: "aws_security_group_list"
description: "List all security groups, optionally filtered by VPC"
params:
region:
type: string
description: "AWS region (e.g., us-east-1, eu-west-1)"
required: true
profile:
type: string
description: "AWS profile to use (optional, uses default if not specified)"
vpc_id:
type: string
description: "VPC ID (e.g., vpc-12345678)"
output_format:
type: string
description: "Output format (json, text, table)"
constraints:
- "region.matches('^[a-z]{2}-[a-z]+-[0-9]{1}$')" # Valid AWS region format
- "profile == '' || profile.matches('^[a-zA-Z0-9_-]+$')" # Valid profile name format
- "vpc_id == '' || vpc_id.matches('^vpc-[a-f0-9]{8,}$')" # Valid VPC ID format
- "output_format == '' || ['json', 'text', 'table'].exists(f, f == output_format)" # Valid output formats
run:
timeout: "60s"
env:
- AWS_PROFILE
- AWS_DEFAULT_PROFILE
- AWS_SHARED_CREDENTIALS_FILE
- HOME
- AWS_CONFIG_FILE
command: |
FORMAT_PARAM="{{ if .output_format }}--output {{ .output_format }}{{ else }}--output table{{ end }}"
PROFILE_PARAM="{{ if .profile }}--profile {{ .profile }}{{ end }}"
FILTER="{{ if .vpc_id }}--filters Name=vpc-id,Values={{ .vpc_id }}{{ end }}"
# Fix environment variable names and handling
if [ -z "$AWS_SHARED_CREDENTIALS_FILE" ]; then
export AWS_SHARED_CREDENTIALS_FILE="$HOME/.aws/credentials"
fi
if [ -z "$AWS_CONFIG_FILE" ]; then
export AWS_CONFIG_FILE="$HOME/.aws/config"
fi
echo "Using AWS_SHARED_CREDENTIALS_FILE: $AWS_SHARED_CREDENTIALS_FILE"
echo "Using AWS_CONFIG_FILE: $AWS_CONFIG_FILE"
aws $PROFILE_PARAM ec2 describe-security-groups --region {{ .region }} $FILTER $FORMAT_PARAM
output:
prefix: "Security groups{{ if .vpc_id }} in VPC {{ .vpc_id }}{{ end }} (region {{ .region }}):"
- name: "aws_security_group_detail"
description: "Get detailed information about a specific security group"
params:
region:
type: string
description: "AWS region (e.g., us-east-1, eu-west-1)"
required: true
profile:
type: string
description: "AWS profile to use (optional, uses default if not specified)"
group_id:
type: string
description: "Security group ID (e.g., sg-12345678)"
required: true
output_format:
type: string
description: "Output format (json, text, table)"
constraints:
- "region.matches('^[a-z]{2}-[a-z]+-[0-9]{1}$')" # Valid AWS region format
- "profile == '' || profile.matches('^[a-zA-Z0-9_-]+$')" # Valid profile name format
- "group_id.matches('^sg-[a-f0-9]{8,}$')" # Valid security group ID format
- "output_format == '' || ['json', 'text', 'table'].exists(f, f == output_format)" # Valid output formats
run:
timeout: "60s"
env:
- AWS_PROFILE
- AWS_DEFAULT_PROFILE
- AWS_SHARED_CREDENTIALS_FILE
- HOME
- AWS_CONFIG_FILE
command: |
FORMAT_PARAM="{{ if .output_format }}--output {{ .output_format }}{{ else }}--output table{{ end }}"
PROFILE_PARAM="{{ if .profile }}--profile {{ .profile }}{{ end }}"
# Fix environment variable names and handling
if [ -z "$AWS_SHARED_CREDENTIALS_FILE" ]; then
export AWS_SHARED_CREDENTIALS_FILE="$HOME/.aws/credentials"
fi
if [ -z "$AWS_CONFIG_FILE" ]; then
export AWS_CONFIG_FILE="$HOME/.aws/config"
fi
echo "Using AWS_SHARED_CREDENTIALS_FILE: $AWS_SHARED_CREDENTIALS_FILE"
echo "Using AWS_CONFIG_FILE: $AWS_CONFIG_FILE"
aws $PROFILE_PARAM ec2 describe-security-groups --region {{ .region }} --group-ids {{ .group_id }} $FORMAT_PARAM
output:
prefix: "Security group {{ .group_id }} details (region {{ .region }}):"
- name: "aws_nacl_list"
description: "List network ACLs, optionally filtered by VPC"
params:
region:
type: string
description: "AWS region (e.g., us-east-1, eu-west-1)"
required: true
profile:
type: string
description: "AWS profile to use (optional, uses default if not specified)"
vpc_id:
type: string
description: "VPC ID (e.g., vpc-12345678)"
output_format:
type: string
description: "Output format (json, text, table)"
constraints:
- "region.matches('^[a-z]{2}-[a-z]+-[0-9]{1}$')" # Valid AWS region format
- "profile == '' || profile.matches('^[a-zA-Z0-9_-]+$')" # Valid profile name format
- "vpc_id == '' || vpc_id.matches('^vpc-[a-f0-9]{8,}$')" # Valid VPC ID format
- "output_format == '' || ['json', 'text', 'table'].exists(f, f == output_format)" # Valid output formats
run:
timeout: "60s"
env:
- AWS_PROFILE
- AWS_DEFAULT_PROFILE
- AWS_SHARED_CREDENTIALS_FILE
- HOME
- AWS_CONFIG_FILE
command: |
FORMAT_PARAM="{{ if .output_format }}--output {{ .output_format }}{{ else }}--output table{{ end }}"
PROFILE_PARAM="{{ if .profile }}--profile {{ .profile }}{{ end }}"
FILTER="{{ if .vpc_id }}--filters Name=vpc-id,Values={{ .vpc_id }}{{ end }}"
# Fix environment variable names and handling
if [ -z "$AWS_SHARED_CREDENTIALS_FILE" ]; then
export AWS_SHARED_CREDENTIALS_FILE="$HOME/.aws/credentials"
fi
if [ -z "$AWS_CONFIG_FILE" ]; then
export AWS_CONFIG_FILE="$HOME/.aws/config"
fi
echo "Using AWS_SHARED_CREDENTIALS_FILE: $AWS_SHARED_CREDENTIALS_FILE"
echo "Using AWS_CONFIG_FILE: $AWS_CONFIG_FILE"
aws $PROFILE_PARAM ec2 describe-network-acls --region {{ .region }} $FILTER $FORMAT_PARAM
output:
prefix: "Network ACLs{{ if .vpc_id }} in VPC {{ .vpc_id }}{{ end }} (region {{ .region }}):"
- name: "aws_route_table_list"
description: "List route tables, optionally filtered by VPC"
params:
region:
type: string
description: "AWS region (e.g., us-east-1, eu-west-1)"
required: true
profile:
type: string
description: "AWS profile to use (optional, uses default if not specified)"
vpc_id:
type: string
description: "VPC ID (e.g., vpc-12345678)"
output_format:
type: string
description: "Output format (json, text, table)"
constraints:
- "region.matches('^[a-z]{2}-[a-z]+-[0-9]{1}$')" # Valid AWS region format
- "profile == '' || profile.matches('^[a-zA-Z0-9_-]+$')" # Valid profile name format
- "vpc_id == '' || vpc_id.matches('^vpc-[a-f0-9]{8,}$')" # Valid VPC ID format
- "output_format == '' || ['json', 'text', 'table'].exists(f, f == output_format)" # Valid output formats
run:
timeout: "60s"
env:
- AWS_PROFILE
- AWS_DEFAULT_PROFILE
- AWS_SHARED_CREDENTIALS_FILE
- HOME
- AWS_CONFIG_FILE
command: |
FORMAT_PARAM="{{ if .output_format }}--output {{ .output_format }}{{ else }}--output table{{ end }}"
PROFILE_PARAM="{{ if .profile }}--profile {{ .profile }}{{ end }}"
FILTER="{{ if .vpc_id }}--filters Name=vpc-id,Values={{ .vpc_id }}{{ end }}"
# Fix environment variable names and handling
if [ -z "$AWS_SHARED_CREDENTIALS_FILE" ]; then
export AWS_SHARED_CREDENTIALS_FILE="$HOME/.aws/credentials"
fi
if [ -z "$AWS_CONFIG_FILE" ]; then
export AWS_CONFIG_FILE="$HOME/.aws/config"
fi
echo "Using AWS_SHARED_CREDENTIALS_FILE: $AWS_SHARED_CREDENTIALS_FILE"
echo "Using AWS_CONFIG_FILE: $AWS_CONFIG_FILE"
aws $PROFILE_PARAM ec2 describe-route-tables --region {{ .region }} $FILTER $FORMAT_PARAM
output:
prefix: "Route tables{{ if .vpc_id }} in VPC {{ .vpc_id }}{{ end }} (region {{ .region }}):"
- name: "aws_eni_list"
description: "List network interfaces, optionally filtered by VPC or subnet"
params:
region:
type: string
description: "AWS region (e.g., us-east-1, eu-west-1)"
required: true
profile:
type: string
description: "AWS profile to use (optional, uses default if not specified)"
vpc_id:
type: string
description: "VPC ID (e.g., vpc-12345678)"
subnet_id:
type: string
description: "Subnet ID (e.g., subnet-12345678)"
output_format:
type: string
description: "Output format (json, text, table)"
constraints:
- "region.matches('^[a-z]{2}-[a-z]+-[0-9]{1}$')" # Valid AWS region format
- "profile == '' || profile.matches('^[a-zA-Z0-9_-]+$')" # Valid profile name format
- "vpc_id == '' || vpc_id.matches('^vpc-[a-f0-9]{8,}$')" # Valid VPC ID format
- "subnet_id == '' || subnet_id.matches('^subnet-[a-f0-9]{8,}$')" # Valid subnet ID format
- "output_format == '' || ['json', 'text', 'table'].exists(f, f == output_format)" # Valid output formats
run:
timeout: "60s"
env:
- AWS_PROFILE
- AWS_DEFAULT_PROFILE
- AWS_SHARED_CREDENTIALS_FILE
- HOME
- AWS_CONFIG_FILE
command: |
FORMAT_PARAM="{{ if .output_format }}--output {{ .output_format }}{{ else }}--output table{{ end }}"
PROFILE_PARAM="{{ if .profile }}--profile {{ .profile }}{{ end }}"
# Build filters dynamically
FILTERS=""
{{ if .vpc_id }}FILTERS="$FILTERS Name=vpc-id,Values={{ .vpc_id }}"{{ end }}
{{ if .subnet_id }}FILTERS="$FILTERS Name=subnet-id,Values={{ .subnet_id }}"{{ end }}
FILTER_PARAM="{{ if or .vpc_id .subnet_id }}--filters $FILTERS{{ end }}"
# Fix environment variable names and handling
if [ -z "$AWS_SHARED_CREDENTIALS_FILE" ]; then
export AWS_SHARED_CREDENTIALS_FILE="$HOME/.aws/credentials"
fi
if [ -z "$AWS_CONFIG_FILE" ]; then
export AWS_CONFIG_FILE="$HOME/.aws/config"
fi
echo "Using AWS_SHARED_CREDENTIALS_FILE: $AWS_SHARED_CREDENTIALS_FILE"
echo "Using AWS_CONFIG_FILE: $AWS_CONFIG_FILE"
aws $PROFILE_PARAM ec2 describe-network-interfaces --region {{ .region }} $FILTER_PARAM $FORMAT_PARAM
output:
prefix: "Network interfaces{{ if .vpc_id }} in VPC {{ .vpc_id }}{{ end }}{{ if .subnet_id }} in subnet {{ .subnet_id }}{{ end }} (region {{ .region }}):"
- name: "aws_lb_list"
description: "List load balancers (ELB, ALB, NLB) in the specified region"
params:
region:
type: string
description: "AWS region (e.g., us-east-1, eu-west-1)"
required: true
profile:
type: string
description: "AWS profile to use (optional, uses default if not specified)"
output_format:
type: string
description: "Output format (json, text, table)"
constraints:
- "region.matches('^[a-z]{2}-[a-z]+-[0-9]{1}$')" # Valid AWS region format
- "profile == '' || profile.matches('^[a-zA-Z0-9_-]+$')" # Valid profile name format
- "output_format == '' || ['json', 'text', 'table'].exists(f, f == output_format)" # Valid output formats
run:
timeout: "60s"
env:
- AWS_PROFILE
- AWS_DEFAULT_PROFILE
- AWS_SHARED_CREDENTIALS_FILE
- HOME
- AWS_CONFIG_FILE
command: |
FORMAT_PARAM="{{ if .output_format }}--output {{ .output_format }}{{ else }}--output table{{ end }}"
PROFILE_PARAM="{{ if .profile }}--profile {{ .profile }}{{ end }}"
# Fix environment variable names and handling
if [ -z "$AWS_SHARED_CREDENTIALS_FILE" ]; then
export AWS_SHARED_CREDENTIALS_FILE="$HOME/.aws/credentials"
fi
if [ -z "$AWS_CONFIG_FILE" ]; then
export AWS_CONFIG_FILE="$HOME/.aws/config"
fi
echo "Using AWS_SHARED_CREDENTIALS_FILE: $AWS_SHARED_CREDENTIALS_FILE"
echo "Using AWS_CONFIG_FILE: $AWS_CONFIG_FILE"
echo "Application and Network Load Balancers:"
aws $PROFILE_PARAM elbv2 describe-load-balancers --region {{ .region }} $FORMAT_PARAM
echo -e "\nClassic Load Balancers:"
aws $PROFILE_PARAM elb describe-load-balancers --region {{ .region }} $FORMAT_PARAM
output:
prefix: "Load balancers in region {{ .region }}:"
- name: "aws_vpn_list"
description: "List VPN connections in the specified region"
params:
region:
type: string
description: "AWS region (e.g., us-east-1, eu-west-1)"
required: true
profile:
type: string
description: "AWS profile to use (optional, uses default if not specified)"
output_format:
type: string
description: "Output format (json, text, table)"
constraints:
- "region.matches('^[a-z]{2}-[a-z]+-[0-9]{1}$')" # Valid AWS region format
- "profile == '' || profile.matches('^[a-zA-Z0-9_-]+$')" # Valid profile name format
- "output_format == '' || ['json', 'text', 'table'].exists(f, f == output_format)" # Valid output formats
run:
timeout: "60s"
env:
- AWS_PROFILE
- AWS_DEFAULT_PROFILE
- AWS_SHARED_CREDENTIALS_FILE
- HOME
- AWS_CONFIG_FILE
command: |
FORMAT_PARAM="{{ if .output_format }}--output {{ .output_format }}{{ else }}--output table{{ end }}"
PROFILE_PARAM="{{ if .profile }}--profile {{ .profile }}{{ end }}"
# Fix environment variable names and handling
if [ -z "$AWS_SHARED_CREDENTIALS_FILE" ]; then
export AWS_SHARED_CREDENTIALS_FILE="$HOME/.aws/credentials"
fi
if [ -z "$AWS_CONFIG_FILE" ]; then
export AWS_CONFIG_FILE="$HOME/.aws/config"
fi
echo "Using AWS_SHARED_CREDENTIALS_FILE: $AWS_SHARED_CREDENTIALS_FILE"
echo "Using AWS_CONFIG_FILE: $AWS_CONFIG_FILE"
aws $PROFILE_PARAM ec2 describe-vpn-connections --region {{ .region }} $FORMAT_PARAM
output:
prefix: "VPN connections in region {{ .region }}:"
- name: "aws_tgw_list"
description: "List transit gateways in the specified region"
params:
region:
type: string
description: "AWS region (e.g., us-east-1, eu-west-1)"
required: true
profile:
type: string
description: "AWS profile to use (optional, uses default if not specified)"
output_format:
type: string
description: "Output format (json, text, table)"
constraints:
- "region.matches('^[a-z]{2}-[a-z]+-[0-9]{1}$')" # Valid AWS region format
- "profile == '' || profile.matches('^[a-zA-Z0-9_-]+$')" # Valid profile name format
- "output_format == '' || ['json', 'text', 'table'].exists(f, f == output_format)" # Valid output formats
run:
timeout: "60s"
env:
- AWS_PROFILE
- AWS_DEFAULT_PROFILE
- AWS_SHARED_CREDENTIALS_FILE
- HOME
- AWS_CONFIG_FILE
command: |
FORMAT_PARAM="{{ if .output_format }}--output {{ .output_format }}{{ else }}--output table{{ end }}"
PROFILE_PARAM="{{ if .profile }}--profile {{ .profile }}{{ end }}"
# Fix environment variable names and handling
if [ -z "$AWS_SHARED_CREDENTIALS_FILE" ]; then
export AWS_SHARED_CREDENTIALS_FILE="$HOME/.aws/credentials"
fi
if [ -z "$AWS_CONFIG_FILE" ]; then
export AWS_CONFIG_FILE="$HOME/.aws/config"
fi
echo "Using AWS_SHARED_CREDENTIALS_FILE: $AWS_SHARED_CREDENTIALS_FILE"
echo "Using AWS_CONFIG_FILE: $AWS_CONFIG_FILE"
aws $PROFILE_PARAM ec2 describe-transit-gateways --region {{ .region }} $FORMAT_PARAM
output:
prefix: "Transit gateways in region {{ .region }}:"
- name: "aws_flow_logs"
description: "List VPC flow logs in the specified region"
params:
region:
type: string
description: "AWS region (e.g., us-east-1, eu-west-1)"
required: true
profile:
type: string
description: "AWS profile to use (optional, uses default if not specified)"
vpc_id:
type: string
description: "VPC ID (e.g., vpc-12345678)"
output_format:
type: string
description: "Output format (json, text, table)"
constraints:
- "region.matches('^[a-z]{2}-[a-z]+-[0-9]{1}$')" # Valid AWS region format
- "profile == '' || profile.matches('^[a-zA-Z0-9_-]+$')" # Valid profile name format
- "vpc_id == '' || vpc_id.matches('^vpc-[a-f0-9]{8,}$')" # Valid VPC ID format
- "output_format == '' || ['json', 'text', 'table'].exists(f, f == output_format)" # Valid output formats
run:
timeout: "60s"
env:
- AWS_PROFILE
- AWS_DEFAULT_PROFILE
- AWS_SHARED_CREDENTIALS_FILE
- HOME
- AWS_CONFIG_FILE
command: |
FORMAT_PARAM="{{ if .output_format }}--output {{ .output_format }}{{ else }}--output table{{ end }}"
PROFILE_PARAM="{{ if .profile }}--profile {{ .profile }}{{ end }}"
FILTER="{{ if .vpc_id }}--filter Name=resource-id,Values={{ .vpc_id }}{{ end }}"
# Fix environment variable names and handling
if [ -z "$AWS_SHARED_CREDENTIALS_FILE" ]; then
export AWS_SHARED_CREDENTIALS_FILE="$HOME/.aws/credentials"
fi
if [ -z "$AWS_CONFIG_FILE" ]; then
export AWS_CONFIG_FILE="$HOME/.aws/config"
fi
echo "Using AWS_SHARED_CREDENTIALS_FILE: $AWS_SHARED_CREDENTIALS_FILE"
echo "Using AWS_CONFIG_FILE: $AWS_CONFIG_FILE"
aws $PROFILE_PARAM ec2 describe-flow-logs --region {{ .region }} $FILTER $FORMAT_PARAM
output:
prefix: "VPC flow logs{{ if .vpc_id }} for VPC {{ .vpc_id }}{{ end }} in region {{ .region }}:"
- name: "aws_vpc_peering"
description: "List VPC peering connections in the specified region"
params:
region:
type: string
description: "AWS region (e.g., us-east-1, eu-west-1)"
required: true
profile:
type: string
description: "AWS profile to use (optional, uses default if not specified)"
vpc_id:
type: string
description: "VPC ID to filter by (e.g., vpc-12345678)"
output_format:
type: string
description: "Output format (json, text, table)"
constraints:
- "region.matches('^[a-z]{2}-[a-z]+-[0-9]{1}$')" # Valid AWS region format
- "profile == '' || profile.matches('^[a-zA-Z0-9_-]+$')" # Valid profile name format
- "vpc_id == '' || vpc_id.matches('^vpc-[a-f0-9]{8,}$')" # Valid VPC ID format
- "output_format == '' || ['json', 'text', 'table'].exists(f, f == output_format)" # Valid output formats
run:
timeout: "60s"
env:
- AWS_PROFILE
- AWS_DEFAULT_PROFILE
- AWS_SHARED_CREDENTIALS_FILE
- HOME
- AWS_CONFIG_FILE
command: |
FORMAT_PARAM="{{ if .output_format }}--output {{ .output_format }}{{ else }}--output table{{ end }}"
PROFILE_PARAM="{{ if .profile }}--profile {{ .profile }}{{ end }}"
FILTER_PARAM="{{ if .vpc_id }}--filters Name=requester-vpc-info.vpc-id,Values={{ .vpc_id }} Name=accepter-vpc-info.vpc-id,Values={{ .vpc_id }}{{ end }}"
# Fix environment variable names and handling
if [ -z "$AWS_SHARED_CREDENTIALS_FILE" ]; then
export AWS_SHARED_CREDENTIALS_FILE="$HOME/.aws/credentials"
fi
if [ -z "$AWS_CONFIG_FILE" ]; then
export AWS_CONFIG_FILE="$HOME/.aws/config"
fi
echo "Using AWS_SHARED_CREDENTIALS_FILE: $AWS_SHARED_CREDENTIALS_FILE"
echo "Using AWS_CONFIG_FILE: $AWS_CONFIG_FILE"
aws $PROFILE_PARAM ec2 describe-vpc-peering-connections --region {{ .region }} $FILTER_PARAM $FORMAT_PARAM
output:
prefix: "VPC peering connections{{ if .vpc_id }} involving VPC {{ .vpc_id }}{{ end }} in region {{ .region }}:"
- name: "aws_availability_zones"
description: "List availability zones in the specified region"
params:
region:
type: string
description: "AWS region (e.g., us-east-1, eu-west-1)"
required: true
profile:
type: string
description: "AWS profile to use (optional, uses default if not specified)"
output_format:
type: string
description: "Output format (json, text, table)"
constraints:
- "region.matches('^[a-z]{2}-[a-z]+-[0-9]{1}$')" # Valid AWS region format
- "profile == '' || profile.matches('^[a-zA-Z0-9_-]+$')" # Valid profile name format
- "output_format == '' || ['json', 'text', 'table'].exists(f, f == output_format)" # Valid output formats
run:
timeout: "60s"
env:
- AWS_PROFILE
- AWS_DEFAULT_PROFILE
- AWS_SHARED_CREDENTIALS_FILE
- HOME
- AWS_CONFIG_FILE
command: |
FORMAT_PARAM="{{ if .output_format }}--output {{ .output_format }}{{ else }}--output table{{ end }}"
PROFILE_PARAM="{{ if .profile }}--profile {{ .profile }}{{ end }}"
# Fix environment variable names and handling
if [ -z "$AWS_SHARED_CREDENTIALS_FILE" ]; then
export AWS_SHARED_CREDENTIALS_FILE="$HOME/.aws/credentials"
fi
if [ -z "$AWS_CONFIG_FILE" ]; then
export AWS_CONFIG_FILE="$HOME/.aws/config"
fi
echo "Using AWS_SHARED_CREDENTIALS_FILE: $AWS_SHARED_CREDENTIALS_FILE"
echo "Using AWS_CONFIG_FILE: $AWS_CONFIG_FILE"
aws $PROFILE_PARAM ec2 describe-availability-zones --region {{ .region }} $FORMAT_PARAM
output:
prefix: "Availability zones in region {{ .region }}:"