• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

AWS get all regions

 
Ranch Hand
Posts: 91
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I am using AWS SDK for developing an application, I am inputting the instance-id and getting it's details.
The problem I am facing is that it would show the instance id in the region that I am specifying, and not search through all the regions, if i don't specify a region then it takes the default region and if the instance is not present in the region it doesn't output anything.
The solution for this i believe is to take the region also as variable and I have been trying to do so but failed. I have tried :


and this :


for describing regions, the correct method is this which outputs all the regions and the endpoints:


What could I possibly do to take the regoin as a variable?
Thanks in advance.
 
Bartender
Posts: 1210
25
Android Python PHP C++ Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

arushi tomar wrote:The problem I am facing is that it would show the instance id in the region that I am specifying, and not search through all the regions, if i don't specify a region then it takes the default region and if the instance is not present in the region it doesn't output anything.


One client instance always contacts a single region. If your application wants to manage instances in multiple regions, easiest way is to create multiple clients.
Read http://docs.aws.amazon.com/AWSSdkDocsJava/latest/DeveloperGuide/java-dg-region-selection.html to understand how to select a region for a client.
 
arushi tomar
Ranch Hand
Posts: 91
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Karthik Shiraly wrote:



"clientConfig cannot be resolved to a variable" but what about this?
 
Karthik Shiraly
Bartender
Posts: 1210
25
Android Python PHP C++ Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

"clientConfig cannot be resolved to a variable" but what about this?


Code snippets are meant to be understood, not blindly copied. Trying to use a variable without creating it first is a mistake in any java application, not just AWS related ones. Have you really understood that code snippet before using it?
 
arushi tomar
Ranch Hand
Posts: 91
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Karthik Shiraly wrote:

"clientConfig cannot be resolved to a variable" but what about this?


Code snippets are meant to be understood, not blindly copied. Trying to use a variable without creating it first is a mistake in any java application, not just AWS related ones. Have you really understood that code snippet before using it?



Yes I have resolved it. Thanks. :-)
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic