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
ふたたび eb ssh
接続できた!
$ eb ssh
INFO: Attempting to open port 22.
INFO: SSH port 22 open.
INFO: Running ssh -i /Users/yumainaura/.ssh/pup.pem ec2-user@DDD.DDD.DDD.DDD
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 ~]$
参考
ElasticBeanstalkで起動されたインスタンスに簡単にsshログインしてみる(EB CLI) | Tagbangers Blog
Original by Github issue
チャットメンバー募集
何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。