title: Code Build Access denied while downloading artifact from S3
body: <p>My CodeBuild is configured with CodePipeline. S3 is my artifact store. I continue to get an Access denied message despite having attached IAM roles with sufficient access. </p>
  
  <p>Screenshot of the error message </p>
  
  <p><a href="https://i.stack.imgur.com/oH0d5.png" rel="noreferrer"><img src="https://i.stack.imgur.com/oH0d5.png" alt="Code Build Error message"></a></p>
  
  <p>I have already checked the service role associated with Codebuild. It has the following policy attached to it.</p>
  
  <pre><code>{
  "Version": "2012-10-17",
  "Statement": [
      {
          "Effect": "Allow",
          "Resource": [
              "arn:aws:logs:ap-southeast-1:682905754632:log-group:/aws/codebuild/Build",
              "arn:aws:logs:ap-southeast-1:682905754632:log-group:/aws/codebuild/Build:*"
          ],
          "Action": [
              "logs:CreateLogGroup",
              "logs:CreateLogStream",
              "logs:PutLogEvents"
          ]
      },
      {
          "Effect": "Allow",
          "Resource": [
              "arn:aws:s3:::codepipeline-ap-southeast-1-*"
          ],
          "Action": [
              "s3:PutObject",
              "s3:GetObject",
              "s3:GetObjectVersion"
          ]
      }
  ]
  </code></pre>
  
  <p>}</p>
  
  <p>But when I test it using the IAM policy validator I get the following error message.</p>
  
  <p><a href="https://i.stack.imgur.com/C838h.png" rel="noreferrer"><img src="https://i.stack.imgur.com/C838h.png" alt="enter image description here"></a></p>
  
  <p>Based on the accepted answer to this question the policy that I currently have should allow me to get the artifacts from S3 without any problems - <a href="https://stackoverflow.com/questions/48225778/aws-codebuild-fails-while-downloading-source-message-access-denied">AWS Codebuild fails while downloading source. Message: Access Denied</a></p>
  
  <p>How do I get rid of the access denied message?</p>