I'm a new to Amazon Web Services (AWS) and want to create an Amazon Elastic Block Store (EBS) snapshot with the AWS SDK for PHP. I wrote the following code:
$aws = Aws::factory($config);
$ec2 = $aws->get('Ec2');
$ec2->createSnapshot( array('VolumeId'=>'vol-11c22825','Description'=>'My Description') );
The snapshot is created correctly , but I'm concerned about data integrity. Is there a better way to create a consistent snapshot with the PHP SDK?
If you want to be completely consistent you need to freeze the filesystem. This can be done if you are running the script locally but you might need to issue a command via ssh if running remotely.
You might be interested in this: https://github.com/alestic/ec2-consistent-snapshot