✨ Deploy AWS RDS instances & asynchronously follow-up ✨
Deploy an RDS database with specific details:
RDSInstance db = new RDSInstance.Builder()
.setDBUsername("<DB-USER-NAME>")
.setDBPassword("<DB-USER-PASSWORD>")
.setDBName("<DB-NAME>")
.setDBStorage(5)
.setDBClass("<RDS-CLASS>")
.setDBEngine("<DATABASE-TYPE>")
.setClient(
"<ACCESS-KEY>",
"<SECRET-KEY>",
"<REGION>"
)
.build()
.createDB()
.asyncAwaitAvailable()
.thenApply(newDB -> {
System.out.println(newDB.getInstanceID() + "(" + newDB.getARN() + ") " + "is now available");
// ...
return newDB;
}).join();
Deploy an RDS database with configured / AWS SDK defaults:
RDSInstance db = new RDSInstance.Builder()
.useConfigDefaults()
.useDefaultClient()
.build()
.createOrConnectDB()
.asyncAwaitAvailable()
.thenApply(newDB -> {
System.out.println(newDB.getInstanceID() + "(" + newDB.getARN() + ") " + "is now available");
// ...
return newDB;
}).join();
- AWS Java SDK
- Snake Yaml
- Junit 4 (optional testing)
- Login to the AWS CLI on the desired machine (this is typically automatic on an EC2) & use the
.useDefaultClient()
builder for client authentication - Either configure the
rds-config.yml
file or specify manually the required builder fields (as shown above) to build your desired AWS RDS instance
- Authenticate your AWS Client manually with the required builder fields as seen in
.setClient()
- Either configure the
rds-config.yml
file or specify manually the required builder fields (as shown above) to build your desired AWS RDS instance
Configure the rds-config.yml
file with all the desired AWS client credentials & RDS instance build information
AWS_ACCESS_KEY: UNSET
AWS_SECRET_KEY: UNSET
AWS_REGION: UNSET
RDS_ID: UNSET
RDS_USERNAME: UNSET
RDS_PASSWORD: UNSET
RDS_TYPE: UNSET
RDS_ENGINE: UNSET
RDS_STORAGE: UNSET
EXAMPLE CONFIG:
AWS_ACCESS_KEY: AKIATMGJSDAGSAHV
AWS_SECRET_KEY: J9YFIxOhEYfnmlFNLJdfsfbfasbf
AWS_REGION: us-west-1
RDS_ID: newdatabase
RDS_USERNAME: operator
RDS_PASSWORD: ohfsadjbviabfdi8hf128
RDS_TYPE: db.t2.micro
RDS_ENGINE: postgres
RDS_STORAGE: 5
Configuring the above file is optional if you intend on using the build-setter methods shown in the first above code example to authenticate into AWS.