Import files to S3 bucket from the server

Hi Experts,
I am completely new to AWS. I have been assigned a task to transfer the files of  'x' folder  on the server to s3 bucket .  Because the server space is getting filled very fast. We need an automated power shell script or something else which would move the files everyday automatically and delete the files from the server.

Any help would be greatly appreciated!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

A.E. VeltstraCommented:
AWS has example documentation about this, using Powershell scripts:
It doesn't completely fit your needs, but it should point you into the right direction.
Hoping this helps,

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Prabhin MPDevOps EngineerCommented:
first, you need to install aws cli and configure your ACCESS key and secret key which you get it from IAM page -> got to the user and download the key from there.

use the below commands as per your distro
apt-get update awscli      
yum install awscli

after installing execute the following command to configure AWS CLI

aws configure

You will now be asked to enter the ‘AWS Access Key ID’, then ‘AWS Secret Access Key’ & lastly ‘Default Region Name’. All these information can be obtained from AWS Dashboard.

now create a bucket in s3

see the backup script


nowdate=$(date +"%Y-%m-%d")
dayago=`(date --date='02 days ago' '+%Y-%m-%d')`
todate=$(date +"%Y-%m-%d")
mondate=$(date +"%m")
mkdir backup
cd backup ; mkdir folder-$nowdate
cp -r /path/to/takebackup folder-$nowdate
aws cp folder-$nowdat s3://buckername --recursive
rm -rf /path/to/takebackup
rm -rf folder-dayago
RadhaKrishnaKiJayaAuthor Commented:
Thank you!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.