def create_subnet_group(name, description, subnet_ids=None, subnet_names=None, tags=None, region=None, key=None, keyid=None, profile=None):
 if (not _exactly_one((subnet_ids, subnet_names))):
  raise SaltInvocationError("Exactly one of either 'subnet_ids' or 'subnet_names' must be provided.")
 conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
 if (not conn):
  return False
 if subnet_group_exists(name, tags, region, key, keyid, profile):
  return True
 if subnet_names:
  subnet_ids = []
  for n in subnet_names:
   r = __salt__['boto_vpc.get_resource_id']('subnet', n, region=region, key=key, keyid=keyid, profile=profile)
   if ('id' not in r):
    log.error("Couldn't resolve subnet name {0} to an ID.".format(subnet_name))
    return False
   subnet_ids += [r['id']]
 try:
  ec = conn.create_cache_subnet_group(name, description, subnet_ids)
  if (not ec):
   msg = 'Failed to create ElastiCache subnet group {0}'.format(name)
   log.error(msg)
   return False
  log.info('Created ElastiCache subnet group {0}'.format(name))
  return True
 except boto.exception.BotoServerError as e:
  log.debug(e)
  msg = 'Failed to create ElastiCache subnet group {0}'.format(name)
  log.error(msg)
  return False

def create_subnet_group ( name , description , subnet_ids = None , subnet_names = None , tags = None , region = None , key = None , keyid = None , profile = None ) : if ( not _exactly_one ( ( subnet_ids , subnet_names ) ) ) : raise SaltInvocationError ( "Exactly one of either 'subnet_ids' or 'subnet_names' must be provided." ) conn = _get_conn ( region = region , key = key , keyid = keyid , profile = profile ) if ( not conn ) : return False if subnet_group_exists ( name , tags , region , key , keyid , profile ) : return True if subnet_names : subnet_ids = [ ] for n in subnet_names : r = __salt__ [ 'boto_vpc.get_resource_id' ] ( 'subnet' , n , region = region , key = key , keyid = keyid , profile = profile ) if ( 'id' not in r ) : log . error ( "Couldn't resolve subnet name {0} to an ID." . format ( subnet_name ) ) return False subnet_ids += [ r [ 'id' ] ] try : ec = conn . create_cache_subnet_group ( name , description , subnet_ids ) if ( not ec ) : msg = 'Failed to create ElastiCache subnet group {0}' . format ( name ) log . error ( msg ) return False log . info ( 'Created ElastiCache subnet group {0}' . format ( name ) ) return True except boto . exception . BotoServerError as e : log . debug ( e ) msg = 'Failed to create ElastiCache subnet group {0}' . format ( name ) log . error ( msg ) return False
create an rds subnet group cli example to create an rds subnet group:: salt myminion boto_rds .