List of usage examples for com.amazonaws.services.rds.model DeleteDBInstanceRequest setSkipFinalSnapshot
public void setSkipFinalSnapshot(Boolean skipFinalSnapshot)
A value that indicates whether to skip the creation of a final DB snapshot before the DB instance is deleted.
From source file:beanstalk.BeansDatabase.java
License:Apache License
public boolean deleteDatabase(String AWSKeyId, String AWSSecretKey, String dbIdentifier) {//throws Exception { boolean ret = false; // credentials = new PropertiesCredentials(BeanstalkDeployNoGUI.class.getResourceAsStream("AwsCredentials.properties")) BasicAWSCredentials basic_credentials = new BasicAWSCredentials(AWSKeyId, AWSSecretKey); // SimpleDBUtils simpledb= new SimpleDBUtils(); AmazonRDSClient rDSClient = new AmazonRDSClient(basic_credentials); // RestoreDBInstanceFromDBSnapshotRequest req= new RestoreDBInstanceFromDBSnapshotRequest(); // req.setDBName("dbname"); // req.setPort(3306); DescribeDBInstancesRequest ddbi = new DescribeDBInstancesRequest(); DBInstance dbins = new DBInstance(); dbins.getEndpoint();//from w w w. j a va 2s .c o m DeleteDBInstanceRequest delRequest = new DeleteDBInstanceRequest(dbIdentifier); // rDSClient.restoreDBInstanceFromDBSnapshot(req); delRequest.setSkipFinalSnapshot(true); rDSClient.deleteDBInstance(delRequest); return ret; }
From source file:com.cloudera.director.aws.rds.RDSProvider.java
License:Apache License
@Override public void delete(RDSInstanceTemplate template, Collection<String> virtualInstanceIds) throws InterruptedException { if (virtualInstanceIds.isEmpty()) { return;/*from ww w . j a va 2 s .co m*/ } 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); } } }