title: S3 bucket access denied from Jenkins
body: <p>I am trying to upload build files from Jenkins to S3 Bucket. I wanted only Cloudfront &amp; the user <code>deployer</code> to have access to the bucket, the policy is as follows:</p>
  
  <pre><code>{
      "Version": "2008-10-17",
      "Id": "PolicyForCloudFrontPrivateContent",
      "Statement": [
          {
              "Sid": "1",
              "Effect": "Allow",
              "Principal": {
                  "AWS": "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity XXXXXXXXXX"
              },
              "Action": "s3:GetObject",
              "Resource": "arn:aws:s3:::samplebucket/*"
          },
          {
              "Sid": "2",
              "Effect": "Allow",
              "Principal": {
                  "AWS": [
                      "arn:aws:iam::1234567890:user/deployer"
                  ]
              },
              "Action": [
                  "s3:*"
              ],
              "Resource": [
                  "arn:aws:s3:::samplebucket",
                  "arn:aws:s3:::samplebucket/*"
              ]
          }
      ]
  }
  </code></pre>
  
  <p>This policy is not allowing the <code>deployer</code> to upload objects to S3. Whereas if i set the bucket access to public, i am able to successfully upload the objects from Jenkins. I don't want my buckets to be public.</p>