title: SageMaker example access denied
body: <p>I am running the <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/ex1-train-model-create-training-job.html" rel="nofollow noreferrer">k-means example in SageMaker</a>:</p>
  <pre class="lang-py prettyprint-override"><code>from sagemaker import KMeans
  
  data_location = 's3://{}/kmeans_highlevel_example/data'.format(bucket)
  output_location = 's3://{}/kmeans_example/output'.format(bucket)
  
  kmeans = KMeans(role=role, 
                  train_instance_count=2,
                  train_instance_type='ml.c4.8xlarge',
                  output_path=output_location,
                  k=10, 
                  data_location=data_location)
  </code></pre>
  <p>When I run this line, it appears access denied error.</p>
  <pre><code>%%time
  
  kmeans.fit(kmeans.record_set(train_set[0]))
  </code></pre>
  <p>The error returns:</p>
  <blockquote>
  <p>ClientError: An error occurred (AccessDenied) when calling the
  PutObject operation: Access Denied</p>
  </blockquote>
  <p>I also read other questions, but their answers do not solve my problem.<br />
  Would you please look at my case?</p>