copy from rightscale_cookbook