How do programmatically create fields for content types, and ADD them to the the content type form Say I have this field, "map_description". I know I would this function to define the field: 

$field = array(
  'field_name' =&gt; 'map_description',
  'cardinality' =&gt; 1,
  'type' =&gt; 'text',
);
field_create_field($field);


And I have this code which I'm not sure what it does but I'm told that I'll need it:

 $instance = array(
    'field_name' =&gt; 'map_description',
    'label' =&gt; 'The map description.',
    'bundle' =&gt; 'my_content_type',
    'entity_type' =&gt; 'node',
    'widget' =&gt; array(
    'type' =&gt; 'text_textfield',
 );
 field_create_instance($instance)


Those two code bits are both in my install hook and run when I install the module. But while the fields are in fact created, I have to manually assign them to the content type via "manage fields", is there a way to have the fields automatically assigned to the content type?
You're almost there.

From your code:

'bundle' =&gt; 'my_content_type',


Replace my_content_type with the name of the content type you want it attached to.

Here's a full example of adding a Alias text field to the Article content type. (from monarchdigital.com)

/**
 * Update hook to add a field to a node.
 */
function my_module_update_7000() {
  $field_name = 'field_alias';
  // Make sure the field doesn't already exist.
  if (!field_info_field($field_name)) {
    // Create the field.
    $field = array(
      'field_name' =&gt; $field_name,
      'type' =&gt; 'text',
      'settings' =&gt; array('max_length' =&gt; 64),
    );
    field_create_field($field);

    // Create the instance.
    $instance = array( 'field_name' =&gt; $field_name,
      'entity_type' =&gt; 'node',
      'bundle' =&gt; 'article',
      'label' =&gt; 'Alias',
      'description' =&gt; 'The article alias.',
      'required' =&gt; TRUE,
    );
    field_create_instance($instance);

    watchdog('my_module', t('!field_name was added successfully.', array('!field_name' =&gt; $field_name)));
  }
  else {
    watchdog('my_module', t('!field_name already exists.', array('!field_name' =&gt; $field_name)));
  }
}