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.

preguntada hace 9 meses5486 visualizaciones
1 Respuesta
1
Respuesta aceptada

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
EXPERTO
respondido hace 9 meses
profile picture
EXPERTO
revisado hace un mes

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas