title: Unable to select S3 folder as the source for CodePipeline on AWS
body: <p>I'm trying to setup a CI/CD pipeline on AWS using CodePipeline with the following setup</p>
  
  <p>Source: S3</p>
  
  <p>Build: CodeBuild</p>
  
  <p>Deploy: CodeDeploy</p>
  
  <p>Release: EC2 instance</p>
  
  <p>I've managed to finish the config by following <a href="https://docs.aws.amazon.com/codepipeline/latest/userguide/tutorials-simple-s3.html" rel="noreferrer">this link</a></p>
  
  <p>However my pipeline fails with the error message that </p>
  
  <pre><code>The object with key 'code-sashi/api' does not exist.
  </code></pre>
  
  <p>I have checked and confirmed that the bucket name is correct and there is a folder 'api' inside the bucket. </p>
  
  <p>The option to set this clearly states that I can enter either the S3 object key or an S3 folder. I would like to use an S3 folder in this case since my build artifact will only be ready after CodeBuild runs.</p>
  
  <p>However CodePipeline continues to look for an object key and ignores my folder.</p>
  
  <p>I have also tried setting the S3 folder as 'api', '/api', 'api/' and none of them work. I tried copying my files to the bucket directly and setting the folder as '/' which fails with a different error message that "object key cannot end with a trailing /"</p>
  
  <p>Based on this <a href="https://docs.aws.amazon.com/codebuild/latest/userguide/create-project.html#create-project-console" rel="noreferrer">link</a> I should be able to get all the contents of the bucket by S3 folder as '/'.</p>
  
  <p>If it helps, I am uploading files from Bitbucket private repository to S3 using Bitbucket Pipelines. Unfortunately CodePipeline cannot connect Bitbucket directly and hence the S3 workaround. Weird that CodeBuild has no problems connecting to a Bitbucket repository but it cannot do so if it is a part of CodePipeline.</p>
  
  <p><strong>Question</strong></p>
  
  <p>How do I configure CodePipeline correctly to get my files from 'code-sashi' bucket and 'api' folder? There will be other folders containing code in the future so I would like to hold all of them inside a single bucket.</p>