Skip to content

Commit 174a46b

Browse files
committed
[Fix] - merge conflict
2 parents 155ea44 + 2493a5a commit 174a46b

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ brew install lamhaison/formulae/aws-cli-utils
8989
## Load when start an Iterm terminal
9090
Add these lines to ~/.bashrc or ~/.zshrc or ~/.bash_profile
9191
```
92-
source "$(which aws-cli-utils.sh)" "/opt/homebrew/Cellar/aws-cli-utils/$(brew info aws-cli-utils | head -1 | awk -F "stable " '{print $2}')" "${HOME}" "True"
92+
source "$(which lhs-helpful-commandlines.sh)" "/opt/homebrew/Cellar/lhs-helpful-commandlines/$(brew info lhs-helpful-commandlines | grep -E '==> .*: stable (.*)$' | sed -E 's|==> .*: stable (.*)$|\1|g')" "True" "True"
9393
9494
```
9595

common/peco.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ peco_aws_list_db_clusters() {
142142
peco_aws_input 'aws rds describe-db-clusters --query "*[].DBClusterIdentifier"' 'true'
143143
}
144144

145+
peco_aws_list_db_endpoint() {
146+
peco_aws_input 'aws rds describe-db-clusters --query "*[].[Endpoint, ReaderEndpoint]"' 'true'
147+
}
148+
145149
peco_aws_list_db_instances() {
146150
peco_aws_input 'aws rds describe-db-instances --query "*[].DBInstanceIdentifier"' 'true'
147151
}

services/aws_secretmanager.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ function aws_secretmanager_get_with_hint() {
3333
}
3434

3535
function aws_secretmanager_get_value() {
36-
3736
local secret_name=$1
3837
local nolog=${2:-'no'}
3938
# Check input invalid

services/ssm.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,21 @@ aws_ssm_connection_ec2() {
2727
fi
2828

2929
}
30+
31+
aws_ssm_port_forwarding_ec2_for_rds() {
32+
aws_ec2_instance_id=$1
33+
aws_rds_endpoint=$2
34+
local_port=$3
35+
aws_commandline_logging "\
36+
aws ssm start-session --target ${aws_ec2_instance_id:?'aws_ec2_instance_id is unset or empty'}
37+
--document-name AWS-StartPortForwardingSessionToRemoteHost \
38+
--parameters host="${aws_rds_endpoint:?'aws_rds_endpoint is unset or empty'}",portNumber="3306",localPortNumber="${local_port:?'local_port is unset or empty'}"
39+
"
40+
41+
if [[ -n "${aws_ec2_instance_id}" || -n "${aws_rds_endpoint}"|| -n "${local_port}" ]]; then
42+
aws ssm start-session --target $aws_ec2_instance_id \
43+
--document-name AWS-StartPortForwardingSessionToRemoteHost \
44+
--parameters host="$aws_rds_endpoint",portNumber="3306",localPortNumber="$local_port"
45+
fi
46+
47+
}

0 commit comments

Comments
 (0)