user3560393
user3560393

Reputation: 15

AWS AmazonEC2Client Specify multiple regions

I am using aws java sdk . I want to access information from multiple EC2 regions . There is a setRegion(RegionID) method available but it sets only one region . Is it possible to set multiple regions and get information from them ?

Upvotes: 0

Views: 347

Answers (1)

Naveen Vijay
Naveen Vijay

Reputation: 16482

You need to override the default end-point to view the information of the service from other region apart from the default region one specified. In other words you may specify the regional end-point every time i.e. call the service - get the info; change the endpoint and call the service again.

I have taken SQS as the explain the process.

Step 1 : Default end point already specified

Step 2 : Call the web service, get the info about the SQS - Service

Step 3 : Change the endpoint using the function setRegion(Region region)

Step 4 : Call the web service, get the info about the SQS - Service

PS :

  1. You can alternatively use setEndpoint(String endpoint) with the native - endpoint service URL [ sqs.us-east-1.amazonaws.com ]
  2. The similar setRegion and setEndPoint exists for other Services like SNS, RDS etc.

Upvotes: 1

Related Questions