検索条件
全1件
(1/1ページ)
A5M2でRDSに繋ぐ方法。aws-cliを使い、WSL2にプロキシを立てるとよい。
この方式だとSSHDを立ててトンネリングするとか、そういう作業が不要なので楽。
前提としてAWSにログインしておく必要がある。
REGION=ap-northeast-1
aws ssm describe-instance-information --region ${REGION} | jq -r '.InstanceInformationList.[].ComputerName + "\t" + .InstanceInformationList.[].InstanceId'
REGION=ap-northeast-1
aws rds describe-db-instances --region ${REGION} --query 'DBInstances[].{Endpoint:Endpoint.Address,Port:Endpoint.Port}' --output table
REGION=ap-northeast-1
INST_ID=i-xxxxxxxxxxx
HOST=xxxxxxx.yyy.rds.amazonaws.com
DIST_PORT=3306
LISTEN_PORT=13306
aws ssm start-session \
--region ${REGION} \
--target ${INST_ID} \
--document-name AWS-StartPortForwardingSessionToRemoteHost \
--parameters 'host=${HOST},portNumber=${DIST_PORT},localPortNumber=${LISTEN_PORT}'
127.0.0.1