This week's book giveaway is in the Agile forum.
We're giving away four copies of Head First Agile and have Andrew Stellman & Jennifer Greene on-line!
See this thread for details.
Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

AWS get all regions  RSS feed

 
arushi tomar
Ranch Hand
Posts: 91
3
  • Mark post as helpful
  • send pies
  • 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.
 
Karthik Shiraly
Bartender
Posts: 1210
25
Android C++ Java Linux PHP Python
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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
  • 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 C++ Java Linux PHP Python
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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
  • 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. :-)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!