linux - Amazon EC2 and eventmachine encryption issues

09
2013-08
  • Tom Irving

    I'm testing out an Amazon EC2 instance (Amazon Linux AMI 2011.09, EBS boot, 32-bit architecture with Amazon EC2 AMI Tools.) to see if it'll serve my purposes.

    I've written a small backend in Ruby (which runs great on my Mac), using eventmachine and em-http-request.

    When I try to run this on the EC2 instance, I get the following error:

    what(): Encryption not available on this event-machine

    I'm pretty sure this has something to do with the em-http-request, because I get a log output which is just before a https request.

    I've read online it something to do with event-machine linking to openssl properly and I'm wondering how I should do that?

    At the moment, I'm installing the dev tools with:

    sudo yum groupinstall "Development Tools"

    Ruby:

    sudo yum install ruby-devel

    I'm then installing rubygems with this:

    wget http://...rubygems.1.8.15.tgz

    tar -xvf rubygems.1.8.15

    cd rubygems.1.8.15

    ruby setup.rb

    Installing the gems:

    sudo gem install eventmachine

    sudo gem install em-http-request

    This all seems to work just fine, no errors so far. The error comes when I attempt to run the ruby file.

    Any ideas?

  • Answers
  • harrymc

    I do not use this software, but I found this eventmachine 0.12.8 release note which says:

    EM.ssl? will check if the reactor was built with ssl support
    

    This thread suggests the following code :

    EM.ssl?
      puts "yes"
    else
      puts "no"
    end
    

    If you get "no" then you need to compile your own eventmachine, or use another release.

    If SSL was available in previous releases and not in the latest, and you wish to complain about, this is the address.

  • Tom Irving

    Turns out the pre-release EventMachine supports SSL with no additional steps.

    It can be installed with:

    gem install eventmachine --pre

    Make sure you remove the old EventMachine as well, otherwise it's used instead.


  • Related Question

    static ip - Using Amazon EC2 as a webserver with a specific IP address
  • JudoWill

    I'm trying to create a personal/professional website within a college domain. From the university I've requested a static IP address which is directed to this website name: "http://lastname.someuniversity.edu". I would like to setup an Amazon EC2 instance to host a website.

    I know how to create/administer the website on the EC2 instance - I just don't know how to get the EC2 instance to talk to the university (and vice-versa). The IT person at the university wasn't terribly helpful.

    I'm familiar with how to setup a local machine to run as the webserver but am not sure how to get the Amazon EC2 instance to 'sit inside" the university.

    Any ideas?


  • Related Answers
  • George

    From your description, you would need to request that the your domain name, "lastname.someuniversity.edu", be pointed to the static address (Elastic IP address) assigned by Amazon. This would be done with by asking the university's DNS administrator to assign the 'A' record to the Amazon EIP. It is unlikely they would be willing to do this but you won't know until you ask.

    A static IP address from the university would only be applicable if the server was managed by the university themselves. Most large organizations prefer to maintain control of their domains.

  • Josh

    It'll have to be done at the university end using a redirection (either by CNAME or URL). If you have access to files on the university server then just add an automatic redirect using an index.html, something like this:

    <html>
    <head>
    <meta http-equiv="Refresh" content="0;url=178.19.145.123" />
    </head>
    
    <body>
    <h1>Error: Wrong page.</h1>
    <h2>The main site is hosted at: <a href="178.19.145.123">Amazon EC2</a></h2>
    <p>You should be instantly redirected to the correct server, if not, click the lonk above.</p>
    </body>
    </html>
    

    Although CNAME would be the prefered method.