I need to backup an AWS EBS-volume without downtime.
C: driver works the OS, on
D: driver works a web service, i need to backup only
The web service is a Delphi SOAP application used for download some files according to request, eg.:
(in this case the web service responds with the
foo.zip file, located in
On each request, this application writes some files (session files and log files) in
D:\dir\temp\. This is a problem, because take a snapshot of in use volume it's not safe, from AWS docs:
You can take a snapshot of an attached volume that is in use. However, snapshots only capture data that has been written to your Amazon EBS volume at the time the snapshot command is issued. If you can pause any file writes to the volume long enough to take a snapshot, your snapshot should be complete.
My idea is implement in my web service a read only mode, based on the existence of a file in a directory.
procedure onRequest(Sender: TObject; Request: TWebRequest; Response: TWebResponse; var Handled: Boolean); begin FReadOnlyMode := FileExists('D:\dir\flag\read_only_mode.txt'); // ... other code
On each request the service check if the file exists and if it exists, the server going in the readonly mode and don't write anything (no log file, no session file.).
The backup strategy is based on a nightly in Windows cron task, that execute a batch file, eg.
:: 1. stop all web service writes operation echo.>D:\dir\flag\read_only_mode.txt :: 2. Use sync.exe for flush all data to disk D sync.exe d :: 3. Use Amazon CLI for snapshot the volume: aws ec2 create-snapshot --volume-id vol-XXXXXXXXXX --description "D snapshot." :: 4. Remove `read_only_mode` flag: del /F /Q D:\dir\flag\read_only_mode.txt
The question is: my EBS snapshots will be consistent?
I'm new on AWS any other suggestions are appreciated!
Sorry for my bad english