1

I am trying to create dev-endpoint server on EC2. I must copy my SSL certificate key store onto the Amazon EC2 instance

scp -i ec2-private-key keystore.jks ec2-user@dns-address-of-ec2-instance:~/keystore.jks

I followed ssl-certificate tutorial. How should my scp line look like?

scp -i  server.key server.cert ec2-user@my....
MikiBelavista
  • 2,470
  • 10
  • 48
  • 70
  • can you check `man scp`? there is no such `scp -I` you can rearrange the`scp` command to `scp -i yourkey.pem server.* ec2-user@my..` – Adiii Jul 09 '20 at 12:50
  • @Adiii The question is what is actually your key.pem? The one I generated with Openssl, or the one I had before,keygen(id_rsa,id_rsa.pub). – MikiBelavista Jul 09 '20 at 12:53
  • No, the one you download from aws during instance creation, seems like this -`ec2-private-key` – Adiii Jul 09 '20 at 12:57

1 Answers1

1

You should use the following command:

scp -i $EC2_PEM $FILE $USERNAME@$REMOTE_HOST_ADDRESS:~/$PATH_TO_REMOTE_LOCATION

In this the following is what to use for the variables:

  • $EC2_PEM - The PEM for connecting to the server (what you would use to SSH)
  • $FILE - The name of the file (private key/public key), providing the full path (either absolute or relative) to the SSL on your current host machine
  • $USERNAME - The username used to SSH to the remote host
  • REMOTE_HOST_ADDRESS - Either the IP address or domain name of the server you are attempting to SCP the file to
  • $PATH_TO_REMOTE_LOCATION - The path that the file will live on disk

You will need to run this for each file individually.

PMah
  • 686
  • 5
  • 24
Chris Williams
  • 32,215
  • 4
  • 30
  • 68