How to Copy from a Server to s3 and Vice Versa

s3: Which is known as Simple Storage Service by AWS is an object storage service which offers great scalability, data availability, security, and performance.

Prerequisite:

Note: The AWS CLI must be configured on your local work station. simple by downloading it from AWS. I will create a blog for this in the future. After installing AWS CLI for your Operating System (windows, MacOS or linux)

Follow the next steps now to configure the AWS CLI

$aws configure
AWS Access Key ID [None]: Your Access Key ID 
AWS Secret Access Key [None]: Your Secret Key
Default region name [None]: Enter your desired region in this format (us-west-2)
Default output format [None]: I usually leave this by default as (json)

After configuring the AWS CLI, next would be to enter the right syntax to copy files to and from s3.

Note: You will need to have the right permissions in place to perform these task.

Here are the use cases

Copy from s3 to Host: Here we have a bucket sitting at the root level with a folder in it and file inside the folder. 
Then you will need to specify the path on your server you want this to be copied to.

aws s3 cp s3://s3bucketname/s3foldername/fileexample.7z G:\fileexample.7z

copy from host to s3: What this does is simple to copy the file in drive C and upload it to s3. Here we have the bucket, folder inside the bucket and the file that will reside inside the bucket. followed by the right region you want the file to be uploaded to

aws s3 cp C:\filename.zip s3://s3bucketname/s3foldername/fileexample.zip --region ap-northeast-1