amu03
amu03

Reputation: 361

How to AWS s3 sync from remote server to s3 bucket?

I am a newbie on aws and server in general. Hope someone can help me :)

What I want to do:

I have some image files on remote server and I would like to copy them to aws s3 bucket. I can ssh this remote server once I ssh intermediate server. so it looks like

me(local) <-----> server1 <----> server2 where image files on

What I did:

*I first ssh server1.

*I installed aws-cli on that server, and set configure.

*Then I entered aws s3 sync <username-I-use-for-server2>@<server2-IP>:/images/pc s3://<s3 bucket name>

Problem:

What I expected was to get password prompt from server2 then sync the files in images/pc to s3 bucket but I got the error saying The user-provided path <username-I-use-for-server2>@<server2-IP>:/images/pc does not exist.

can anyone tell me What am I doing wrong?

I've checked that I can ssh server2 and that there's files inside /images/pc as well.

Any help would be appreciated!!

Upvotes: 0

Views: 2469

Answers (1)

Chris Williams
Chris Williams

Reputation: 35188

It is expected that this is a local path to the current server.

The available combinations are <LocalPath> <S3Uri> or <S3Uri> <LocalPath> or <S3Uri> <S3Uri>.

You will need to run this command against a local path on the server you're trying to copy the objects from.

Remember that all this command is actually doing is running aws s3api putObject under the hood along with some management to perform operations such as recursion on your local disk. It does not handle any SSH interactions.

If you wanted to share any assets between servers you would need to mount them between servers (for example using an NFS mount) before you are able to sync them up, otherwise run the command on the other server.

Upvotes: 2

Related Questions