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.

已提问 9 个月前5492 查看次数
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 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则