title: Need to upload directory content to S3 bucket
body: <p>My scenario is I am currently using AWS CLI to upload my directory content to S3 bucket using following AWS CLI command:</p>
  
  <pre><code>aws s3 sync results/foo s3://bucket/
  </code></pre>
  
  <p>Now I need to replace this and have python code to do this. I am exploring <a href="https://boto3.amazonaws.com/v1/documentation/api/1.9.42/reference/services/s3.html" rel="nofollow noreferrer">boto3</a> documentation to find the right way to do it. I see some options such as:
  <a href="https://boto3.amazonaws.com/v1/documentation/api/1.9.42/reference/services/s3.html#S3.Client.upload_file" rel="nofollow noreferrer">https://boto3.amazonaws.com/v1/documentation/api/1.9.42/reference/services/s3.html#S3.Client.upload_file</a>
  <a href="https://boto3.amazonaws.com/v1/documentation/api/1.9.42/reference/services/s3.html#S3.ServiceResource.Object" rel="nofollow noreferrer">https://boto3.amazonaws.com/v1/documentation/api/1.9.42/reference/services/s3.html#S3.ServiceResource.Object</a></p>
  
  <p>Could someone suggest which is the right approach.</p>
  
  <p>I am aware that I would have to get the credentials by calling <code>boto3.client('sts').assume_role(role, session)</code> and use them subsequently.</p>