The following command helps in copying or moving the files from Jump Server / EC2 instance to the S3 bucket.
To move file from EC2 to S3
aws s3 mv backup.sql s3://yourbucket.mysqlbackups/yourinstancebucket/
To copy file from EC2 to S3
aws s3 cp backup.sql s3://yourbucket.mysqlbackups/yourinstancebucket/
Before you run the aforementioned commands, take note of the following.
- The buckets need to be present in S3.
- To complete the task, you must possess the necessary authorizations.
- If you move a file, it will be moved from its existing location.
- The files will be accessible in both EC2 and S3 if you copy them.