Skip to content

Commit c520d3e

Browse files
committed
[update] - add menu search and add some function about vpc, route54,s3,lambda
1 parent 0bfa04f commit c520d3e

File tree

5 files changed

+67
-8
lines changed

5 files changed

+67
-8
lines changed

services/ec2.sh

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ aws_ec2_start() {
4848
aws_run_commandline "aws ec2 start-instances --instance-ids $instance_id"
4949
}
5050

51-
5251
# Ec2 image
5352
aws_ec2_list_images() {
5453
aws_run_commandline "aws ec2 describe-images --owners self"
@@ -78,3 +77,33 @@ aws_ec2_get_image() {
7877
aws_ec2_connect() {
7978
aws_ssm_connection_ec2 $1
8079
}
80+
81+
aws_ec2_list_eips() {
82+
aws_run_commandline 'aws ec2 describe-addresses'
83+
}
84+
85+
# VPC
86+
87+
aws_ec2_list_vpcs() {
88+
aws_run_commandline \
89+
"
90+
aws ec2 describe-vpcs --query '*[].{Id:VpcId,CidrBlock:CidrBlock,Name:Tags[?Key == \`Name\`] | [0].Value}' --output table
91+
"
92+
}
93+
94+
aws_vpc_list() {
95+
aws_ec2_list_vpc
96+
}
97+
98+
# Subnets
99+
aws_subnet_list() {
100+
101+
aws_ec2_list_subnets
102+
}
103+
104+
aws_ec2_list_subnets() {
105+
aws_run_commandline \
106+
"
107+
aws ec2 describe-subnets
108+
"
109+
}

services/lambda.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,5 @@ aws_lambda_get() {
1212
}
1313
1414
aws_lambda_get_with_hint() {
15-
echo "List lambda functions"
16-
aws_lambda_function=$(aws lambda list-functions --query "*[].FunctionName" --output text | tr "\t" "\n" | peco)
17-
aws_run_commandline "aws lambda get-function --function-name ${aws_lambda_function}"
15+
aws_lambda_get $(echo "$(peco_aws_lambda_list)" | peco)
1816
}

services/rds.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ aws_rds_list_db_clusters() {
99
Status:Status,\
1010
DBClusterParameterGroup:DBClusterParameterGroup,\
1111
Endpoint:Endpoint,\
12-
ReaderEndpoint:ReaderEndpoint,\
12+
EndpointReader:ReaderEndpoint,\
1313
Engine:Engine,\
1414
EngineVersion:EngineVersion,\
1515
DBClusterMembers:DBClusterMembers\

services/route53.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
#!/bin/bash
22
# AWS Route53
33
aws_route53_list() {
4-
aws_run_commandline 'aws route53 list-hosted-zones --query "*[].Name"'
4+
# aws_run_commandline 'aws route53 list-hosted-zones --query "*[].Name"'
5+
aws_run_commandline 'aws route53 list-hosted-zones --query \
6+
"*[].{Id:Id,Name:Name,PrivateZone:Config.PrivateZone}" --output table'
7+
}
8+
9+
aws_route53_get_host_zone() {
10+
aws_route53_host_zone_id=$1
11+
12+
aws_run_commandline "aws route53 list-resource-record-sets \
13+
--hosted-zone-id ${aws_route53_host_zone_id:?'aws_route53_host_zone_id is unset or empty'}"
514
}

services/s3.sh

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,31 @@
11
#!/bin/bash
22

33
aws_s3_ls() {
4-
aws_s3_list
4+
aws_run_commandline "aws s3 ls"
5+
56
}
67
aws_s3_list() {
7-
aws_run_commandline "aws s3 ls"
8+
aws_run_commandline 'aws s3api list-buckets --query "Buckets[].Name"'
9+
}
10+
11+
aws_s3_get_object_metadata() {
12+
bucket_name=$1
13+
object_key=$2
14+
15+
commandline=$(echo aws s3api head-object --bucket ${bucket_name:?"bucket_name is unset or empty"} \
16+
--key ${object_key:?"object_key is unset or empty"})
17+
18+
aws_run_commandline "${commandline}"
19+
820
}
21+
22+
# aws_s3_get_object_metadata_with_hint() {
23+
# bucket_name=$(echo "$(peco_aws_s3_list)" | peco)
24+
# object_key=$2
25+
26+
# commandline=$(echo aws s3api head-object --bucket ${bucket_name:?"bucket_name is unset or empty"} \
27+
# --key ${object_key:?"object_key is unset or empty"})
28+
29+
# aws_run_commandline "${commandline}"
30+
31+
# }

0 commit comments

Comments
 (0)