def show_delvol_on_destroy(name, kwargs=None, call=None):
 if (call != 'action'):
  raise SaltCloudSystemExit('The show_delvol_on_destroy action must be called with -a or --action.')
 if (not kwargs):
  kwargs = {}
 instance_id = kwargs.get('instance_id', None)
 device = kwargs.get('device', None)
 volume_id = kwargs.get('volume_id', None)
 if (instance_id is None):
  instance_id = _get_node(name)['instanceId']
 params = {'Action': 'DescribeInstances', 'InstanceId.1': instance_id}
 data = aws.query(params, location=get_location(), provider=get_provider(), opts=__opts__, sigver='4')
 blockmap = data[0]['instancesSet']['item']['blockDeviceMapping']
 if (not isinstance(blockmap['item'], list)):
  blockmap['item'] = [blockmap['item']]
 items = []
 for (idx, item) in enumerate(blockmap['item']):
  device_name = item['deviceName']
  if ((device is not None) and (device != device_name)):
   continue
  if ((volume_id is not None) and (volume_id != item['ebs']['volumeId'])):
   continue
  info = {'device_name': device_name, 'volume_id': item['ebs']['volumeId'], 'deleteOnTermination': item['ebs']['deleteOnTermination']}
  items.append(info)
 return items

def show_delvol_on_destroy ( name , kwargs = None , call = None ) : if ( call != 'action' ) : raise SaltCloudSystemExit ( 'The show_delvol_on_destroy action must be called with -a or --action.' ) if ( not kwargs ) : kwargs = { } instance_id = kwargs . get ( 'instance_id' , None ) device = kwargs . get ( 'device' , None ) volume_id = kwargs . get ( 'volume_id' , None ) if ( instance_id is None ) : instance_id = _get_node ( name ) [ 'instanceId' ] params = { 'Action' : 'DescribeInstances' , 'InstanceId.1' : instance_id } data = aws . query ( params , location = get_location ( ) , provider = get_provider ( ) , opts = __opts__ , sigver = '4' ) blockmap = data [ 0 ] [ 'instancesSet' ] [ 'item' ] [ 'blockDeviceMapping' ] if ( not isinstance ( blockmap [ 'item' ] , list ) ) : blockmap [ 'item' ] = [ blockmap [ 'item' ] ] items = [ ] for ( idx , item ) in enumerate ( blockmap [ 'item' ] ) : device_name = item [ 'deviceName' ] if ( ( device is not None ) and ( device != device_name ) ) : continue if ( ( volume_id is not None ) and ( volume_id != item [ 'ebs' ] [ 'volumeId' ] ) ) : continue info = { 'device_name' : device_name , 'volume_id' : item [ 'ebs' ] [ 'volumeId' ] , 'deleteOnTermination' : item [ 'ebs' ] [ 'deleteOnTermination' ] } items . append ( info ) return items
do not delete all/specified ebs volumes upon instance termination cli example: .