This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

filter using tag aws ec2 java  RSS feed

 
arushi tomar
Ranch Hand
Posts: 91
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to filter my ec2 instances with a tag, I tried a lot of things and also found this as an accepted answer:

but I don't understand what is "my-keypair-name" and "key-name".

also I tried this:


but when I debug and check, the filter shows this value:

{Name: tag:Environment,Values: [Staging]}
and in console:

Caught Exception: The filter 'Environment' is invalid (Service: AmazonEC2; Status Code: 400; Error Code: InvalidParameterValue; Request ID: 9494e091-22e8-4295-b5ce-65ad8b4b776d)

but the correct format should be like this:

[i-1bed6aa3, {"name":"stopped","code":80}, [{"value":"Testing_Arushi_start and stop","key":"Name"},{"value":"Staging","key":"Environment"}]]
 
L Foster
Ranch Hand
Posts: 242
14
Android Angular Framework AngularJS Java Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, @Arushi Tomar,

My disclaimer: I know nothing about Amazon Web Services or Elastic Compute Cloud. An actual AWS/EC2 expert might cut through this in 5s. However, I might be able to offer you a lead.

http://docs.aws.amazon.com/AWSEC2/latest/CommandLineReference/ApiReference-cmd-DescribeInstances.html

This is a command line reference. Sometimes, documentation will be deeper in one section than in another, parallel section. Here, I am theorizing that they have gone into more detail on the command-line description, than on the Java description. Further, assuming (sorry, I know...) these concepts are the same for CLI and Java, you can probably try concepts more rapidly from the command line, than from the Java development cycle. You could try this filtering and see console output 3 or 4 times, in the span it would take to build and execute once in a programming language.

Once you 'see that it was good', you can plug your required values into the Java code.

I hope this helps you in your effort. It is only a suggestion. But, reading your post kind of kindles an interest in the Amazon cloud. I should be learning more about this.

Also, you might look around at other forums, because this might not be considered 'Beginning Java'.
 
arushi tomar
Ranch Hand
Posts: 91
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
L Foster wrote:Hello, @Arushi Tomar,


Thank you for your interest and reply. and yes, they have given so much in CLI and less in java, so I have to work hard in finding an appropriate solution through google or by trying different piece of codes for the same.

However, I did found a solution for the same, which is :

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!