daily pastebin goal
51%
SHARE
TWEET

Untitled

a guest May 16th, 2018 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. for region in region_list:
  2.     s3 = boto3.resource('s3', region)
  3.     s3_client = boto3.client('s3', region)
  4.         for bucket in s3.buckets.all():
  5.             s3_bucket = bucket
  6.             s3_bucket_name = s3_bucket.name
  7.             response = s3_client.get_bucket_tagging(Bucket=s3_bucket_name)
  8.             tagset = response['TagSet']
  9.                 if len(response['TagSet'])==0:
  10.                     print "s3 bucket not have tags, adding tags"
  11.                 else:
  12.                     pass
  13.    
  14. Traceback (most recent call last):
  15. File "C:Python27ec2info.py", line 235, in <module>
  16. response = s3_client.get_bucket_tagging(Bucket=s3_bucket_name)
  17. File "C:Python27libsite-packagesbotocoreclient.py", line 314, in
  18. _api_call
  19. return self._make_api_call(operation_name, kwargs)
  20. File "C:Python27libsite-packagesbotocoreclient.py", line 612, in
  21. _make_api_call
  22. raise error_class(parsed_response, operation_name)
  23. ClientError: An error occurred (NoSuchTagSet) when calling the
  24. GetBucketTagging operation: The TagSet does not exist
RAW Paste Data
Top