title: Unable to upload artifact None referenced by CodeUri parameter of HelloWorldFunction resource
body: <p>I'm following <a href="https://itnext.io/creating-aws-lambda-applications-with-sam-dd13258c16dd" rel="noreferrer">this tutorial</a> to learn how to use <a href="https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html" rel="noreferrer">SAM</a>.</p>
  
  <p>Here's the code I have:</p>
  
  <p><em>template.yml</em>:</p>
  
  <pre><code>AWSTemplateFormatVersion : '2010-09-09'
  Transform: AWS::Serverless-2016-10-31
  Resources:
    HelloWorldFunction:
      Type: AWS::Serverless::Function
      Properties:
        Handler: index.handler
        Runtime: nodejs8.10
  </code></pre>
  
  <p><em>index.js</em></p>
  
  <pre><code>exports.handler = async function(event, context) {
      return 'Hello World!';
  };
  </code></pre>
  
  <p>When I run </p>
  
  <pre><code>sam package \
    --template-file template.yml \
    --output-template-file package.yml \
    --s3-bucket brian-test-sam
  </code></pre>
  
  <p>I got the error saying <code>Unable to upload artifact None referenced by CodeUri parameter of HelloWorldFunction resource.
  An error occurred (AccessDenied) when calling the PutObject operation: Access Denied</code></p>
  
  <p>Why does this happen?</p>
  
  <p>I've created the S3 bucket <code>brian-test-sam</code> on my AWS account. I've checked that my IAM user has <code>AmazonS3FullAccess</code> permission.</p>
  
  <p>The command </p>
  
  <pre><code>sam --debug package \                                                                                           &lt;aws:dev-bionime&gt;
    --template-file template.yml \
    --output-template-file package.yml \
    --s3-bucket brian-test-sam
  </code></pre>
  
  <p>says that the error was generated by <code>aws cloudformation package --output-template-file package.yml --s3-bucket brian-test-sam --template-file /path/to/my/files/helloworld/template.yml</code></p>
  
  <p>What is wrong with my cloudformation?</p>
  
  <p>My aws cli version is <code>aws-cli/1.16.169 Python/3.7.3 Darwin/18.6.0 botocore/1.12.159</code>. And my <code>npm</code> version is <code>6.10.1</code>.</p>