#AWS의 ElasticBeanStalk를 사용하여 서버와 SSH 연결을 할 때 aws cli의 eb ssh 명령을 사용할 수 있음

3196 단어 AWS
ssh의 복잡한 설정 없이 연결할 수 있습니다!

eb 명령 사용

pip install awscli

eb init --interactive


여러 가지 설정.

eb ssh --setup


환경 이름 및 키 쌍 선택 또는 만들기
 eb ssh --setup
WARNING: You are about to setup SSH for environment "puppeteer". If you continue, your existing instances will have to be **terminated** and new instances will be created. The environment will be temporarily unavailable.
To confirm, type the environment name: puppeteer

Select a keypair.
1) pup
2) [ Create new KeyPair ]
(default is 1):
Printing Status:
2019-11-08 23:47:41    INFO    Environment update is starting.
 -- Events -- (safe to Ctrl+C) Use "eb abort" to cancel the command.

자꾸 환경이 바뀌는 것 같아.


조금 기다리는 게 좋을 것 같아요.

환경 업데이트 성공

Printing Status:
2019-11-08 23:47:41    INFO    Environment update is starting.
2019-11-08 23:47:45    INFO    Updating environment puppeteer's configuration settings.
2019-11-08 23:48:20    INFO    Successfully deployed new configuration to environment.

eb ssh


.ssh 폴더에 열쇠를 넣어야 할 것 같습니다
$ eb ssh 
INFO: Attempting to open port 22.
INFO: SSH port 22 open.
ERROR: NotFoundError - The EB CLI cannot find your SSH key file for keyname "pup". Your SSH key file must be located in the .ssh folder in your home directory.
AWS 콘솔에서 키 쌍을 만들어 다운로드한 상태이기 때문에 파일을 이동합니다.
cp ~/Downloads/pup.pem ~/.ssh

다시 ebssh


연결됐습니다!
$ eb ssh 
INFO: Attempting to open port 22.
INFO: SSH port 22 open.
INFO: Running ssh -i /Users/yumainaura/.ssh/pup.pem [email protected]
The authenticity of host 'SSS.SSS.SSS.SSS (SSS.SSS.SSS.SSS)' can't be established.
ECDSA key fingerprint is SHA256:YYYYYYYYYYYYYYYYYYYYYYYYYY
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'SSS.SSS.SSS.SSS' (ECDSA) to the list of known hosts.
 _____ _           _   _      ____                       _        _ _
| ____| | __ _ ___| |_(_) ___| __ )  ___  __ _ _ __  ___| |_ __ _| | | __
|  _| | |/ _` / __| __| |/ __|  _ \ / _ \/ _` | '_ \/ __| __/ _` | | |/ /
| |___| | (_| \__ \ |_| | (__| |_) |  __/ (_| | | | \__ \ || (_| | |   <
|_____|_|\__,_|___/\__|_|\___|____/ \___|\__,_|_| |_|___/\__\__,_|_|_|\_\
                                       Amazon Linux AMI

This EC2 instance is managed by AWS Elastic Beanstalk. Changes made via SSH
WILL BE LOST if the instance is replaced by auto-scaling. For more information
on customizing your Elastic Beanstalk environment, see our documentation here:
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html
[ec2-user@ip-XXX-XXX-XXX-XXX ~]$

참고 자료


간단한 ElasticaBeanstalk 시작 인스턴스에서 ssh(EB CLI) | Tagbangers Blog 로그인

Original by Github issue

좋은 웹페이지 즐겨찾기