1 / 6

How to Copy Files From Linux to Amazon S3 Bucket

Sometimes you may need to copy files from Linux to S3 bucket. Here are the steps to do so.<br><br>Visit https://fedingo.com/how-to-copy-files-from-linux-to-s3-bucket/

Download Presentation

How to Copy Files From Linux to Amazon S3 Bucket

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. How to Copy Files from Linux to S3 bucket

  2. Install AWSCLI AWSCLI is available in almost every default Linux repository. So you can easily install it with the following commands, depending on your Linux distribution. $ sudo dnf install awscli ## Fedora, Redhat and CentOS $ sudo apt install awscli ## Ubuntu, Debian and Linux Mint Run the following command to verify installation. $ aws --version

  3. Copy Files from Linux to S3 Bucket Once AWS CLI is installed on your system, you can run the following command to list the contents of specific S3 bucket. $ aws s3 ls s3://<S3bucketName> Here is the command to copy file from your EC2 Instance’s Linux system to Amazon S3 bucket. $ aws s3 cp /full/path/to/file s3://<S3BucketName> This will copy the file to the root folder of your S3 bucket.

  4. Copy Files from Amazon S3 bucket to Linux If you want to copy files from Amazon S3 bucket to Linux, swap the path to file and Amazon S3 bucket in the above commands. # To copy the files from S3 to EC2 $ aws s3 cp s3://<S3BucketName>/filename /full/path/to/file Similarly, if you want to copy file from a subfolder in your S3 bucket, mention the subfolder after S3 bucket name. $ aws s3 cp s3://<S3BucketName>/data/filename /full/path/to/file

  5. Create Shell Scripts You can also add the above commands in a shell script to automate tasks. Replace S3_BUCKET_NAME and BACKUP_FILENAME with the name of Amazon S3 bucket and full path of file to be uploaded respectively. #/usr/bin/env bash S3_BUCKET_NAME="" BACKUP_FILENAME='/home/ubuntu/data.txt' ${AWSCMD} cp /tmp/${BACKUP_FILENAME} s3://${S3_BUCKET_NAME}/ if [ $? -eq 0 ]; then echo "File successfully uploaded to s3 bucket" else echo "Error in s3 upload" fi

  6. Thank You Visit for details https://fedingo.com/how-to-copy-files-from-linux-to-s3-bucket/

More Related