/** * Requests deletion of the instance, without creating a final snapshot or deleting any other related * snapshots. * <p/> * Caller must wait for status=deleted or DBInstanceNotFoundException afterwards. */ public DBInstance deleteInstance(String instanceName) { LOGGER.debug("deleteDBInstance(instanceName: " + instanceName + ")"); StopWatch stopWatch = new StopWatch(); try { stopWatch.start(); DeleteDBInstanceRequest request = new DeleteDBInstanceRequest(instanceName); request.setSkipFinalSnapshot(true); return awsRdsClient.deleteDBInstance(request); } finally { stopWatch.stop(); LOGGER.debug("deleteDBInstance time elapsed: " + stopWatch); } }
@Override public void delete(RDSInstanceTemplate template, Collection<String> virtualInstanceIds) throws InterruptedException { if (virtualInstanceIds.isEmpty()) { return; } for (String virtualInstanceId : virtualInstanceIds) { LOG.info(">> Terminating {}", virtualInstanceId); DeleteDBInstanceRequest request = new DeleteDBInstanceRequest() .withDBInstanceIdentifier(virtualInstanceId); if (template.isSkipFinalSnapshot().or(false)) { request.setSkipFinalSnapshot(true); } else { String snapshotIdentifier = String.format("%s-director-final-snapshot-%d", virtualInstanceId, System.currentTimeMillis()); request.setFinalDBSnapshotIdentifier(snapshotIdentifier); } try { DBInstance deletedDbInstance = client.deleteDBInstance(request); LOG.info("<< Result {}", deletedDbInstance); } catch (DBInstanceNotFoundException e) { LOG.warn("<< Instance {} was not found, assuming already deleted", virtualInstanceId); } } }
/** * @inheritDoc */ @Override public void terminateInstance( String instanceName, Identity identity ) { AmazonRDS rds = ActivityUtils.createClient( AmazonRDSClient.class, identity ); try { rds.deleteDBInstance( new DeleteDBInstanceRequest( instanceName ).withSkipFinalSnapshot( true ) ); } catch ( DBInstanceNotFoundException e ) { } }
public void delete(String dbInstanceIdentifier) { DBInstance dbInstance = client.deleteDBInstance( new DeleteDBInstanceRequest(dbInstanceIdentifier).withSkipFinalSnapshot(true) ); System.out.println(dbInstance); }
public void deleteDBInstance(String dbInstanceIdentifier) { DeleteDBInstanceRequest request = new DeleteDBInstanceRequest(); request.setDBInstanceIdentifier(dbInstanceIdentifier); rdsClient.deleteDBInstance(request); }