Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ~/awesomeapp/lib/awesomeapp/infrastructure.rb
- module Awesomeapp
- module Infrastructure
- def self.spawn
- credentials = Aws::Credentials.new('SECRETKEY', 'PASSWORD')
- ec2_client = Aws::EC2::Client.new(region: 'us-east-1', credentials: credentials)
- resp = ec2_client.run_instances(
- image_id: 'ami-cd0f5cb6',
- min_count: 1,
- max_count: 1,
- key_name: 'awesomeapp.id_rsa',
- instance_type: 't2.micro',
- )
- resp.instances.first
- end
- end
- end
Add Comment
Please, Sign In to add comment