This tutorial talked about how to transfer files from EC2 to S3.
- Login to your IAM dashboard, create a group with s3 full access permission.
- Create a user and assign to the group
Login to your ec2 instance, you need to configure aws with following command.
[ec2-user@ip-xxx-xxx-xxx-xxx 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.
[ec2-user@ip-xxx-xxx-xxx-xxx html]$ aws s3 ls s3://migratefolder/temp/ 2016-04-04 05:53:49 0 [ec2-user@ip-XXX-XXX-XXX-XXX html]$
Now you can transfer file from your ec2 to s3.
[ec2-user@ip-xxx-xxx-xxx-xxx 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.
[ec2-user@ip-xxx-xx-xx-xxx html]$ aws s3 cp s3://migratefolder/temp/abc.tgz abc.tgz