Where i can get the source code for create a security group in aws or openstack

i not familiar with chef just now i started to explore… my task is i have chef
client/server and hosted chef setup also, from this i have to connect the
Amazon EC2 and create a security group (i had a account in aws) only and enable
port for that respective group. i go through the aws cookbook, we should
install the plugin for that but i need to know apart from aws cookbook and
plugins, any cookbook or any ruby sample code with out any plugins for
available to connect with aws and create security group only if it is possible,
please post the respective code or the cookbook name. i go through the code in
mailing list and tested its not working…

code in my ruby file:

def run

   $stdout.sync = true
   $name = groop
   aws_access_key_id = XXXXXXXXXXXX
   aws_secret_access_key = XXXXXXXXXXXXXXXX
   name = hai


  secgroup_def = { :name => config[:name], :description

=>config[:description], :ip_permissions => nil, :owner_id => nil }
conn = Fog::Compute.new(
:provider => ‘AWS’,
:aws_access_key_id =>
Chef::Config[:knife][:aws_access_key_id],
:aws_secret_access_key =>
Chef::Config[:knife][:aws_secret_access_key],
:region => locate_config_value(:region)
)
# conn = connection.create()
secgroup = conn.security_groups.new(secgroup_def)

end