title: Searching s3 for a bucket using boto3
body: <p>I'm trying to create a python script that uploads a file to an s3 bucket. The catch is that I want this script to go to s3 and search through all the buckets and find a bucket that contains a certain keyword in its name and upload the file to that bucket.</p>
  <p>I currently have this:</p>
  <pre><code>import boto3
  import json
  
  BUCKET_NAME = 'myBucket'
  
  with open('my-file.json', 'rb') as json_file:
      data = json.load(json_file)
      
      s3 = boto3.resource('s3')
      s3.Bucket(BUCKET_NAME).put_object(Key='banner-message.json', Body=json.dumps(data))
      print (&quot;File successfully uploaded.&quot;) 
  </code></pre>
  <p>This script successfully uploads the file to s3. But, as you can see, the bucket name I pass in has to be the same exact match as the s3 bucket. I want to be able to search through all the buckets in s3 and find the bucket that contains the keyword I pass in.</p>
  <p>For example, in this case, I want to be able to pass in 'myBucke' and have it search s3 for a bucket that contain that. 'myBucket' contains 'myBucke', so it uploads it to that. Is this possible?</p>