🖥

#AWS ElasticBeanStalk で SCP 接続して サーバーのファイルをローカルにコピーする

2019/11/10に公開
eb ssh
eb ssh <env-name>
INFO: Attempting to open port 22.
INFO: SSH port 22 open.
INFO: Running ssh -i /Users/yumainaura/.ssh/pup.pem ec2-user@ZZZ.ZZZ.ZZZ.ZZZ
Last login: Sat Nov  9 22:57:33 2019 from XXX.XXX.XXX.XXX
 _____ _           _   _      ____                       _        _ _
| ____| | __ _ ___| |_(_) ___| __ )  ___  __ _ _ __  ___| |_ __ _| | | __
|  _| | |/ _` / __| __| |/ __|  _ \ / _ \/ _` | '_ \/ __| __/ _` | | |/ /
| |___| | (_| \__ \ |_| | (__| |_) |  __/ (_| | | | \__ \ || (_| | |   <
|_____|_|\__,_|___/\__|_|\___|____/ \___|\__,_|_| |_|___/\__\__,_|_|_|\_\
                                       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-YYY-YYY-YYY-YYY ~]$ pwd
/home/ec2-user

これで ssh 接続コマンドがわかるので、scp用にコマンドを加工して使う。

scp -i /Users/yumainaura/.ssh/pup.pem ec2-user@ZZZ.ZZZ.ZZZ.ZZZ /home/ec2-user:/path/to/file ./

Original by Github issue

https://github.com/YumaInaura/YumaInaura/issues/2693

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

https://line.me/ti/g2/eEPltQ6Tzh3pYAZV8JXKZqc7PJ6L0rpm573dcQ

Twitter

https://twitter.com/YumaInaura

公開日時

2019-11-10

Discussion