title: Mass delete Cloudwatch log groups using Boto3 - delete_log_group
body: <p>I have a pretty lengthy list of cloudwatch log groups i need to delete....like close to a hundred. Since you have to delete them one at a time I thought a little python script could help me out but now im stuck.</p>
  
  <p>here's my script so far...</p>
  
  <pre><code>import boto3
  from botocore.exceptions import ClientError
  import json
  
  #Connect to AWS using default AWS credentials in awscli config
  cwlogs = boto3.client('logs')
  
  loglist = cwlogs.describe_log_groups(
      logGroupNamePrefix='/aws/lambda/staging-east1-'
  )
  
  #writes json output to file...
  with open('loglist.json', 'w') as outfile:
      json.dump(loglist, outfile, ensure_ascii=False, indent=4, 
  sort_keys=True)
  
  #Opens file and searches through to find given loggroup name
  with open("loglist.json") as f:
      file_parsed = json.load(f)
  
  for i in file_parsed['logGroups']:
      print i['logGroupName']
  
  
  #   cwlogs.delete_log_group(
  #       logGroupName='string'   &lt;---here is where im stuck
  #   )
  </code></pre>
  
  <p>How do I take the value of 'logGroupName' in i and convert it to a string that the delete_log_group command can use and iterate through to delete all of my log groups I need to be gone?
  I tried using json.loads and it errored out with the following...</p>
  
  <p><em>Traceback (most recent call last):
  File "CWLogCleaner.py", line 18, in 
  file_parsed = json.loads(f)
  File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/<strong>init</strong>.py", line 339, in loads
  return _default_decoder.decode(s)
  File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 364, in decode
  obj, end = self.raw_decode(s, idx=_w(s, 0).end())</em></p>
  
  <p>Or am I totally going about this the wrong way?</p>
  
  <p>TIA</p>