title: give public read and view access to s3 bucket objects using cloudformation template
body: <p>I am writing a AWS cloudformation template to receive a file inside a s3 bucket from Kinesis Firehose. I have gave public read access to the bucket (bucket is public) but when i access the file inside the bucket using object URL, i get "The XML file does not appear to have any style associated with it" error and it says access denied. However the object (JSON file) is downloadable. </p>
  
  <p>I have given full access to the s3 bucket</p>
  
  <pre><code>Resources:
  
  # Create s3 bucket
  MyS3Bucket:
   Type: AWS::S3::Bucket
   Properties:
      BucketName: health-app-buckett
      AccessControl: PublicRead
  
  # Create Role
  S3BucketRole:
   Type: 'AWS::IAM::Role'
   Properties:
    AssumeRolePolicyDocument:
      Statement:
        - Effect: Allow
          Principal:
            Service:
              - s3.amazonaws.com
          Action:
            - 'sts:AssumeRole'
  
  #Create policy for bucket
  S3BucketPolicies:
   Type: 'AWS::IAM::Policy'
   Properties:
    PolicyName: S3BucketPolicy
    PolicyDocument:
      Statement:
        - Sid: PublicReadForGetBucketObjects
          Effect: Allow
          Action: 's3:GetObject'
          Resource: !Join
            - ''
            - - 'arn:aws:s3:::'
              - !Ref MyS3Bucket
              - /*
    Roles:
      - !Ref S3BucketRole
  </code></pre>
  
  <p>I want to be able to view the file using Object URL</p>