List of usage examples for com.amazonaws.services.rds AmazonRDSClient createDBSnapshot
@Override
public DBSnapshot createDBSnapshot(CreateDBSnapshotRequest request)
Creates a DBSnapshot.
From source file:br.com.objectos.aws.rds.maven.plugin.CreateSnapshotMojo.java
License:Apache License
private void execute0() throws MojoExecutionException { AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey); AmazonRDSClient client = new AmazonRDSClient(credentials); CreateDBSnapshotRequest createDBSnapshotRequest = new CreateDBSnapshotRequest() .withDBInstanceIdentifier(dBInstanceIdentifier).withDBSnapshotIdentifier(dBSnapshotIdentifier); info("Starting RDS Snapshot '%s' at '%s'", dBSnapshotIdentifier, dBInstanceIdentifier); long startTime = System.currentTimeMillis(); DBSnapshot snapshot = client.createDBSnapshot(createDBSnapshotRequest); info("Backing up... please wait."); while (!isDone(snapshot)) { try {// w w w. j a v a2 s.c om Thread.sleep(5000); snapshot = describeSnapshot(client); if (snapshot == null) { break; } } catch (InterruptedException e) { throw new MojoExecutionException("Interrupted while waiting", e); } } long endTime = System.currentTimeMillis(); info("Snapshot took %d ms", endTime - startTime); }