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 réponse
1
Réponse acceptée

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
EXPERT
répondu il y a 9 mois
profile picture
EXPERT
vérifié il y a un mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions