You also can add export AWS_CONFIG_FILE=$HOME/.aws/config to ~/.bashrc file but it's optional.
To check that everything is working correctly:aws ec2 describe-regions

Note that you can also setup AWS cli differently, then I did it. For example you can use aws configure to create the config file or split the config and the credentials into separated files. More information can be found in the official AWS userguide.

The backup script

The backup script is very individual and depends on the system or the files you want to backup. To backup a jenkins CI server I use the following script (backup.sh):

The most important part in this script is the last line. Here the created tar.gz archive is moved to aws s3. If you want to run the script manually it is sufficient to write aws s3 mv .... But if you want to run this script using a cronjob you have to call aws with the fully qualified path. Otherwise the script will fail and say: "aws: command not found".
To find out the path to AWS cli simply use: which aws.

Of course the script has to be executable: chmod +x backup.sh.

The cronjob

Finally we can set up the cronjob.

crontab -e opens the crontab for your user.

If you want to run the backup every night at 12 o'clock add the follwing at the end of the crontab:

Notice the first line in the crontab above the actual cron definition. Here we have to provide the path to the config file, which we created earlier. Without this line aws could not access the config file. Also adding this variable in the backup.sh did not work in my case.