Created
May 1, 2019 06:40
-
-
Save mkuehle/fb80bf8c92e2ae905df4c2a028b0eb04 to your computer and use it in GitHub Desktop.
Amazon RDS Instanz mit Snapshot ID erstellen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private DBInstance createRdsInstance(String snapshotIdentifier) { | |
String newRdsInstanceId = "mk-dev-" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyMMdd-HHmm")); | |
logger.info("Erstelle neue RDS Stage Instance mit ID: {}", newRdsInstanceId); | |
AmazonRDS client = createAmazonRdsClient(); | |
RestoreDBInstanceFromDBSnapshotRequest request = new RestoreDBInstanceFromDBSnapshotRequest() | |
.withPubliclyAccessible(true) | |
.withDBInstanceIdentifier(newRdsInstanceId) | |
.withDBSnapshotIdentifier(snapshotIdentifier) | |
.withMultiAZ(false) | |
.withDBInstanceClass("db.t3.small") | |
.withAvailabilityZone("eu-central-1b") | |
.withDBSubnetGroupName("default"); | |
DBInstance instance = client.restoreDBInstanceFromDBSnapshot(request); | |
client.shutdown(); | |
return instance; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment