-1

I am using the AWS Java JDK and I wish to check if a VPC is within a certain region. The jdk provides an AmazonEC2.describeVpcs() request but it does not provide a means for filtering by region. Does anyone know of a workaround for this?

Steve Robinson
  • 452
  • 5
  • 9

1 Answers1

2

You should be able to set the region when building the AWS Client, before making the AmazonEC2.describeVpcs() call.

AmazonEC2 ec2 = AmazonEC2ClientBuilder.standard()
                    .withRegion(Regions.US_WEST_2)
                    .build();

More Info: https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/java-dg-region-selection.html

noqcks
  • 513
  • 5
  • 9