Thursday, July 21, 2011

BitNami RubyStack now more Cloud-ready than ever

BitNami RubyStack is one of our most popular stacks and it enables anyone to be up and running with a Ruby on Rails environment in no time. It comes in three flavors: as a native installer, a virtual appliance or an Amazon Machine Image.

For those of you using RubyStack to power their Cloud development, you will be happy to know that the latest version of RubyStack has bundled and configured out-of-the-box support for Amazon's recently announced AWS SDK for Ruby. This SDK allows you to build Ruby applications that tap into the cost-effective, scalable, and reliable AWS cloud. It ships example code and a Quick Guide to get started in minutes using AWS infrastructure services.

For instance, you can do the following to upload files to Amazon Simple Storage Service (Amazon S3):

 1. Install BitNami RubyStack in your machine. Windows, OS X and Linux are supported.

 2. Go to Start -> BitNami RubyStack -> Ruby Console on Windows or run the "rubyconsole.sh" script on OS X or Linux.

 3. Download the sample files from GitHub: 

$ git clone git://github.com/amazonwebservices/aws-sdk-for-ruby.git 
$ cd aws-sdk-for-ruby/samples/ 

 4. Create a file named config.yml in the samples directory as follows:

# Fill in your AWS Access Key ID and Secret Access Key 
# http://aws.amazon.com/security-credentials 
access_key_id: REPLACE_WITH_ACCESS_KEY_ID 
secret_access_key: REPLACE_WITH_SECRET_ACCESS_KEY 

5. Run a sample script with the Ruby interpreter. For example, to run the "s3/upload_file.rb" sample:

$ echo "Hello, World!" > helloworld.txt 
$ ruby s3/upload_file.rb unique-bucket-name helloworld.txt 

You can also find a sample script to start and login to a AWS EC2 machine at "ec2/run_instance.rb".

 $ ruby ec2/run_instance.rb 
Using AMI: ami-8c1fece5 
Generated keypair ruby-sample-1311166524, fingerprint: d2:11:ff:36:ce:6c:64:da:58:58:35:15:3b:f0:33:d1:fb:89:58:55 
Using security group: ruby-sample-1311166532 
Launched instance i-818d59e0, status: running 

 If you are a PHP developer, the AWS SDK for PHP is already included in the Stack.