Skip to content

jhtran/ec2-signature

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code borrowed from fog (https://github.com/geemus/fog).

This gem will simply generate the AWS EC2 signature so that you can use your own HTTP methods and libraries to POST/GET to your choice of AWS/EC2 compatible API servers such as Eucalyptus, OpenNebula, OpenStack.  Apparently, most of the AWS/EC2 API gems out there are not compatible with the aforementioned cloud frameworks, due to running on a custom port they do not account for that when generating the signature.  Fog had implemented a compatible signature method, however, I did not want to use the EXCON http library implemented in it so I extracted the signature method only for use with my own choice of HTTP library.

##############################
####  OpenStack Example 1 ####
##############################

require 'ec2-signature'
# pass a hash containing your aws auth params to new obj
mysig = EC2Signature.new( {
            :awsaccessid => 'abcde12345fiow13jlaf1',
            :awssecretkey => '1380adj13j43jklj32a',
            :ec2url => 'http://myec2server:8773/services/Cloud'
          } )
# to generate a signature only, provide the query action you want to issue to your ec2 provider
mysig.sign 'DescribeImages'
signature = mysig.signature
# OR use the example net/http post method to post your signature to the ec2_url specified above
mysig.submit 'DescribeImages'   # will parse the xml body and return a data hash


##############################
####  OpenStack Example 2 ####
##############################
# opennebula's aws/ec2 api implementation has a diff path for admin cmds
mysig.path = '/services/Admin'
# generate only the signature if you want:
mysig.sign 'DescribeUser', {'Name' => 'jsmith', }
signature = mysig.signature
# OR use the example net/http post method to post your signature to the ec2_url specified above
mysig.submit 'DescribeUser', {'Name' => 'jsmith', }

About

generate an auth signature for use against Amazon EC2, and compatible, APIs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages