28
Quick tip - S3 sync
What’s s3 sync? The s3 sync is one command of the aws-cli which allows synchronize files with a bucket. The complete command is: aws s3 sync ./ s3://bucket_name --delete
Explain in details this command:
I believe that following situations s3 sync can help you:
Let’s talk about the situations above and explain how s3 sync can help you.
First situation: your application running in machine and write log files in disk, but disk is full and you can’t delete log files of your application
In this scenery your application writes log files in disk, ok. But it is necessary to remove these files because the machine disk is full and can’t delete log files. One solution to resolve this problem:
aws s3 sync ./ s3://bucket_name --delete
Explain command above:
Second situation: you configured your database and made backups of the database because you didn't use management database service
In this scenery you need to generate backup daily from the database and store one place to another moment access, case needs. The solution to resolve this problem:
mysqldump -u username -p database_name > ./backup_$(date +"%m-%d-%Y").sql
aws s3 sync ./ s3://bucket_name --delete
Explain commands above:
Third situation: you deploy the react application in s3. You execute build and upload files in s3 where s3 hosted frontend application
You deploy a manually react application in s3 where s3 hosts a frontend application. The solution to resolve this problem deploy manually:
npm run build
cd ./build
aws s3 sync ./ s3://bucket_name
Explain commands above: