A Golang script created for backup of archives to AWS S3.
cayohollanda@pc:~$ aws-backup -b bucket-name -p /folder/to/upload -z name-of-the-zip.zip
or
cayohollanda@pc:~$ aws-backup --bucket bucket-name --path /folder/to/upload --zip name-of-the-zip.zip
- The script compress the folder which is passed as a parameter, after this, upload the compressed archive to bucket on AWS S3
- To configure AWS Credentials, you need to install the AWS CLI package and configure it
cayohollanda@pc:~$ sudo apt-get install awscli
- After that, you need to run the command to configure credentials, with this command, you will pass a Access Key ID, Secret Key ID, Region name and Output Format (default is json)
cayohollanda@pc:~$ aws configure
- After configure AWS Credentials, your pc stay prepared to use the script.
One solution to automate the backup of archives is use a Cron
- Build a Go script to an executable
cayohollanda@pc:~$ go build main.go
- Now, install the cron (if not have installed)
cayohollanda@pc:~$ sudo apt-get install cron
- After that, access the file to configure a schedules
cayohollanda@pc:~$ crontab -e
- Schedule as you prefer, save and h4v3 fun!