SQL backups to AWS s3 bucket

  • Hello All,

    I currently have backup files that are sent to AWS using batch files embedded in windows tasks.

    In addition I have a purge task which deletes old backup files after an X amount of days.

    Now the issue since the purge tasks runs every night and it needs to keep running I worry that it can delete files which still haven't been uploaded to AWS since some of the files are big (>>>600 GB )

    This is my current script which uploads files & logs a trail into a text doc.

    @echo START - ABC: %date% %time% >> P:\Aws_times\Daily\ABC\ABCAWSDaily.txt

    aws s3 sync P:\Backups\Daily\ABC s3://backups-daily/ABC

    @echo END - ABC : %date% %time% >> P:\Aws_times\Daily\ABC\ABCAWSDaily.txt

    This is my purging script which deletes files older than 3 days

    forfiles -p "P:\Backups\Daily" -s -m *.* -d -3 -c "cmd /c del @path"

    Now my questions are:

    1. How do I add a script which deletes a file ONLY after it's been uploaded to AWS?

    2.In the log files (ABCAWSDaily.txt), there's only time, how do I script it for it to tell me which exactly files have been uploaded?

    3. Can this be done by just editing the batch command or do I need to use powershell & if so since I'm a newbie how do I go about it?

    Please let me know if this is clear.

    Any help regarding this would be appreciated.

    To know where you're heading, you gotta know where you been :alien:

  • Hello JnrDbaK,

    You can now export .bak file from a EC2 instance running SQL Server to S3. 

    http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/SQLServer.Procedural.Importing.html 

    But if you want to code everything by you check my GitHub https://github.com/mariopoeta/backupsqlservertos3

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply