Sha256: 11f75ab8921101ca41198873be6a9f36262b80180abc4a347cc634b64d1402c3
Contents?: true
Size: 1.25 KB
Versions: 2
Compression:
Stored size: 1.25 KB
Contents
require 'yaml' require 'active_support/core_ext/hash' module Forger class Create < Base include AwsServices include ErrorMessages def run Profile.new(@options).check! Hook.run(:before_run_instances, @options) sync_scripts_to_s3 puts "Creating EC2 instance #{@name.color(:green)}" info = Info.new(@options, params) info.ec2_params if @options[:noop] puts "NOOP mode enabled. EC2 instance not created." return end resp = run_instances(params) instance_id = resp.instances.first.instance_id info.spot(instance_id) puts "EC2 instance with profile #{@name.color(:green)} created: #{instance_id} 🎉" puts "Visit https://console.aws.amazon.com/ec2/home to check on the status" info.cloudwatch(instance_id) Waiter.new(@options.merge(instance_id: instance_id)).wait end def run_instances(params) ec2.run_instances(params) rescue Aws::EC2::Errors::ServiceError => e handle_ec2_service_error!(e) end def sync_scripts_to_s3 upload = Script::Upload.new(@options) upload.run end # params are main derived from profile files def params @params ||= Params.new(@options).generate end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
forger-3.0.2 | lib/forger/create.rb |
forger-3.0.1 | lib/forger/create.rb |