class AWS::AutoScaling::LaunchConfigurationCollection

def create name, image, instance_type, options = {}

Returns:
  • (LaunchConfiguration) -

Options Hash: (**options)
  • :associate_public_ip_address (Boolean) --
  • :spot_price (String) --
  • :iam_instance_profile (String) --
  • :user_data (String) -- The user data available to
  • :security_groups (Array, Array) --
  • :ramdisk_id (String) -- The ID of the ramdisk to
  • :key_pair (KeyPair, String) -- The keypair to launch
  • :kernel_id (String) -- The ID of the kernel to
  • :detailed_instance_monitoring (Boolean) --
  • :block_device_mappings (Array) --

Parameters:
  • options (Hash) --
  • instance_type (String) -- The type of instance (e.g.
  • image (EC2::Image, String) -- An {EC2::Image} or image id string.
  • name (String) -- The name of the launch configuration to create.
def create name, image, instance_type, options = {}
  client_opts = {}
  client_opts[:launch_configuration_name] = name
  client_opts[:image_id] = image_id_opt(image)
  client_opts[:instance_type] = instance_type
  client_opts[:instance_monitoring] = instance_monitoring_opt(options) if
    options.key?(:detailed_instance_monitoring)
  client_opts[:key_name] = key_name_opt(options) if options[:key_pair]
  client_opts[:security_groups] = security_groups_opt(options) if
    options.key?(:security_groups)
  client_opts[:user_data] = user_data_opt(options) if options[:user_data]
  [
    :iam_instance_profile,
    :spot_price,
    :kernel_id,
    :ramdisk_id,
    :block_device_mappings,
    :associate_public_ip_address
  ].each do |opt|
    client_opts[opt] = options[opt] if options.key?(opt)
  end
  client.create_launch_configuration(client_opts)
  LaunchConfiguration.new(name,
    :image_id => client_opts[:image_id],
    :instance_type => client_opts[:instance_type],
    :config => config)
end