Transfer files from EC2 to S3

Transfer files from EC2 to S3

This tutorial talked about how to transfer files from EC2 to S3.

Create IAM

  1. Login to your IAM dashboard, create a group with s3 full access permission.
  2. Create a user and assign to the group

Aws configure

Login to your ec2 instance, you need to configure aws with following command.

[[email protected] html]$ aws configure
AWS Access Key ID [None]: XXXXXXXXXXXXXXXXXXX
AWS Secret Access Key [None]: XXXXXXXXXXXXXXXXX
Default region name [None]:  enter
Default output format [None]:  enter

 

Test your connection

Test the following command to your S3 bucket and folder.

[[email protected] html]$ aws s3 ls s3://migratefolder/temp/
2016-04-04 05:53:49          0 
[[email protected] html]$ 

 

Transfer file

Now you can transfer file from your ec2 to s3.

[[email protected] html]$ aws s3 cp abc.tgz s3://migratefolder/temp/
upload: ./abc.tgz to s3://migratefolder/temp/abc.tgz

 

Download file from S3 to Ec2

Repeat the aws configure step, and download the file with corresponse command.

[[email protected] html]$ aws s3 cp s3://migratefolder/temp/abc.tgz abc.tgz

 

Reference

http://docs.aws.amazon.com/cli/latest/reference/s3/cp.html

Write a Reply or Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.