Skip to content

Instantly share code, notes, and snippets.

@j3tm0t0
Last active April 16, 2017 00:23
Show Gist options
  • Save j3tm0t0/6496327 to your computer and use it in GitHub Desktop.
Save j3tm0t0/6496327 to your computer and use it in GitHub Desktop.
ec2 run instance with public ip in vpc
[1] pry(main)> require 'aws-sdk'
=> true
[2] pry(main)> ec2 = AWS.ec2
=> <AWS::EC2>
[3] pry(main)> ec2.client.run_instances(:image_id => 'ami-39b23d38' , :network_interfaces => [{:device_index => 0 , :subnet_id => 'subnet-6fa0f706', :associate_public_ip_address => true }], :min_count => 1, :max_count => 1 );
[4] pry(main)> ec2.instances.create(:image_id => 'ami-39b23d38' , :network_interfaces => [{:device_index => 0 , :subnet_id => 'subnet-6fa0f706', :associate_public_ip_address => true }]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment