Copy files from private EC2 instance to local machine

0

Hi,

I have a requirement of copying files from private EC2 instance to my local machine. I have port forwarded a EC2 instance to local using below command.

aws ssm start-session
--target instance-id
--document-name AWS-StartPortForwardingSession
--parameters '{"portNumber":["22"], "localPortNumber":["2222"]}'

Now is there a way to copy files from EC2machine to local machine without passing PEM keys. I have tried it but getting error

scp -P 2222 ec2-user@localhost:/var/log/yumlog /home/user ec2-user@localhost: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

Can any one guide to copy the files.

1回答
1
承認された回答

Hi, yes, right way to go for your goal is scp not ssm. See https://dearsikandarkhan.medium.com/files-copying-between-aws-ec2-and-local-d07ed205eefa

Corresponding AWS reference documentation is here: https://docs.aws.amazon.com/managedservices/latest/appguide/qs-file-transfer.html

Follow in details all the guidance about security groups and access key creation / management to get it to work properly.

Best,

Didier

profile pictureAWS
エキスパート
回答済み 9ヶ月前
profile picture
エキスパート
レビュー済み 1ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ