Skip to content

Instantly share code, notes, and snippets.

@actionjack
Forked from mza/validate.rb
Created January 30, 2013 10:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save actionjack/4672140 to your computer and use it in GitHub Desktop.
Save actionjack/4672140 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'fog'
require 'yaml'
config = YAML::load_file(File.dirname(__FILE__) + '/config.yml')
cf = Fog::AWS::CloudFormation.new(
:aws_access_key_id => config['key'],
:aws_secret_access_key => config['secret']
)
template = File.open(ARGV[0], 'rb')
template_contents = template.read
begin
response = cf.validate_template( "TemplateBody" => template_contents)
rescue Excon::Errors::BadRequest => e
puts "Validation error: 400 Bad request"
puts e.inspect
else
puts "Template validated successfully."
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment