Amazon CloudSearch Gem - ruby

Is there a gem other than:
https://github.com/wellbredgrapefruit/asari
https://github.com/spokesoftware/aws_cloud_search
for using aws cloud search in ruby? I'm trying to evaluate which one to use and want to make sure I'm not missing the_gem_one_that_everyone_uses.

There's also Cloudsearchable: https://github.com/awslabs/cloudsearchable
It provides AR-like query building syntax and a simple API for mapping ActiveModel-like objects to a Cloudsearch index.

Related

Searching by tag in Hadoop 2.6.5 using YarnClient

I might be missing something here, but I think there is no way to search by applicationTags in Hadoop 2.6.5.
The 2.6.5 docs here: https://hadoop.apache.org/docs/r2.6.5/api/org/apache/hadoop/yarn/client/api/YarnClient.html have no mention of application tags.
However the most recent versions of Hadoop do:
https://hadoop.apache.org/docs/stable/api/org/apache/hadoop/yarn/client/api/YarnClient.html
abstract List<ApplicationReport> getApplications(Set<String> applicationTypes, EnumSet<YarnApplicationState> applicationStates, Set<String> applicationTags)
I am pretty sure there is no way to do this without using the REST API instead of YarnClient; I'm avoiding the REST API for a few reasons (I can't find a way to test with it using mini clusters due to a bug I think, and also the YarnClient is convenient if it's already there instead of me making a rest client myself)

How to execute query over Amazon Athena with Ruby?

how to connect Amazon Athena with Ruby and execute query over Amazon Athena and get result.
we not able to find any gem or example with help us to connect Amazon Athena in ruby.
Please provide any reference using which we can use to build connection with Amazon Athena and build a custom query executor in Ruby.
just to clarify my application on production so changing SDK from Ruby to JRuby is not a suitable option for me.
Per May 19th 2017, Amazon Athena supports query execution via SDK and CLI.
Ruby API client for Athena documentation # docs.aws.amazon.com
Source code of aws-sdk-athena # github.com/aws/aws-sdk-ruby
I found that the official Amazon SDK for athena was a bit complicated, so I made a new gem called Athens that wraps the SDK in a nicer interface:
conn = Athens::Connection.new(database: 'sample')
query = conn.execute("SELECT * FROM mytable")
If using JRuby is not acceptable, there is another option that could work - but be warned that it's not 100% Ruby!
You could set up a Java Lambda function that encapsulates the query logic, taking in search parameters and then connecting directly to Athena using the JDBC driver.
Then call the Lambda function from Ruby - either via HTTP or through the Ruby client.
Using Lambda function is good alternative but if some one not like to pay additional service amount then batter to implment small application with jetty using rest service in JAVA with sql query as parameter and response text as output(your prefer format) will give you workaround to move on.
JRuby is required. Athena offers only JDBC driver. It works only in JRE.

AWS ruby sdk: how to create a security group with relaxed (permit all) permissions

I have installed the AWS ruby sdk.
gem install aws-sdk
Within irb:
require aws-sdk
Now I want to create a security group with all packets permitted both incoming and outgoing.
How can I do this?
After looking at the documentation, I believe you would need to make three calls to authorize_ingress to accomplish this:
security_group.authorize_ingress(:tcp, 0..65535)
security_group.authorize_ingress(:udp, 0..65535)
security_group.authorize_ingress(:icmp, 0..65535)

Determine S3 Bucket Region

I'm using the AWS Ruby SDK v2 to access various buckets across a couple of regions. Is it possible to determine the region of (at runtime) of each bucket before I access it, so I can avoid the error below, which I get if I configure the AWS S3 client with the wrong region?
The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.
I know I can shell out and use the command below and parse the response, but ideally, I want to stay within the Ruby SDK.
aws s3api get-bucket-location
I couldn't find any official document for this, but from the aws-sdk spec you should be able to use following code to get the region
client = Aws::S3::Client.new()
resp = client.get_bucket_location(bucket: bucket_name)
s3_region = resp.data.location_constraint
This one is calling the same API as aws s3api get-bucket-location
For aws-sdk (2.6.5), it is:
client.get_bucket_location(bucket: bucket_name).location_constraint
But then, now, how we get a list of buckets that belong to a specific region?

How to connect tire to an external server?

It should have been easy to find but somehow we didn't find out
How to connect tire* to an external server?
*Tire is A rich Ruby API and DSL for the ElasticSearch search engine
if you mean different than localhost:9200, it should be something like this
require 'tire'
Tire.configure { url "http://ec2-232-10-73-111.compute-1.amazonaws.com:9200" }

Resources