'Dry Run Amazon AWS RDS query

Assume I've created an object AmazonRDS with the AmazonRDSClient object like this:

AmazonRDS amazonRDS = AmazonRDSClient.builder();

This code will use the default region and credentials I have defined in my environment. I would like to poll each AWS region to check the RDS instances running in each region.

Something similar to this:

RegionUtils.getRegionsForService(AmazonRDS.ENDPOINT_PREFIX)
.flatmap(p -> amazonRDS.describeDBInstances().getDBInstances())

If I don't have permissions to access the resource, amazon will responde with a forbidden response (translate in Java to an Exception).

My question: Is it possible to make a "dry run" query like the aws cli from Java to allow me to verify that I have permissions before doing the real query.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source