mercredi 23 septembre 2015

Java sdk to take Amazon RDS snapshot and Restore RDS with existing snapshot

I am trying to implement the following via amazon sdk.

  1. Take and store snapshot of an amazon RDS
  2. Restore amazon RDS with an existing snapshot

I need to do this via script /or calling api (java)

I did some analysis and got below code. Need to understand this at the very basic and implement the same.

public void restoreDBSnapshot(String rdsDev, String snapshotId,
        String subnetGroup, String availabilityZone) {
        RestoreDBInstanceFromDBSnapshotRequest restoreDBInstanceRequest = new RestoreDBInstanceFromDBSnapshotRequest();
         restoreDBInstanceRequest.setDBSnapshotIdentifier(snapshotId);
         restoreDBInstanceRequest.setDBName(rdsDev);
         restoreDBInstanceRequest.setDBSubnetGroupName(subnetGroup);
         restoreDBInstanceRequest.setAvailabilityZone(availabilityZone);
         LOG.info("Restoring RDS from backup snapshot");
         this.rds.restoreDBInstanceFromDBSnapshot(restoreDBInstanceRequest);
}

Aucun commentaire:

Enregistrer un commentaire