[AWS] SSH connect to bastion host by name tag
by 담배맛구마실습하다가, bastion host IP 찾아보는거 너무 귀찮아서 만듬.
#!/bin/bash
if [ "$1" == "" ]; then
echo "[ERROR] input key file name by parameter!"
exit 0
fi
instacneTag='ec2-an2-imys-test-bastion'
publicip=$(aws ec2 describe-instances \
--filters "Name=tag:Name,Values=$instacneTag" \
--query "Reservations[0].Instances[0].PublicIpAddress" --output text)
ssh -i $1 ec2-user@$publicip
반응형
'Cloud' 카테고리의 다른 글
[AWS] How to get EC2 Windows instance password (0) | 2020.09.05 |
---|---|
[AWS] AWS Code Series (6) | 2020.06.22 |
[AWS] AWS Transfer Family (0) | 2020.06.22 |
블로그의 정보
정윤상이다.
담배맛구마