API: s3:PutPublicAccessBlock Access Denied

Hi Team,

  Type: AWS::S3::Bucket
  Properties:
    BucketName: ${self:provider.contentBucket}
    PublicAccessBlockConfiguration:
      BlockPublicAcls: true
      BlockPublicPolicy: true
      IgnorePublicAcls: true
      RestrictPublicBuckets: true
    VersioningConfiguration:
      Status: Enabled
    CorsConfiguration:
      CorsRules:
        - AllowedHeaders:
            - "*"
          AllowedMethods:
            - "GET"
            - "PUT"
          AllowedOrigins:
            - "*"
          MaxAge: 3000
          ExposedHeaders:
            - x-amz-version-id
            - Server

I have a serverless file I am getting error API: s3:PutPublicAccessBlock Access Denied in jenkins. I have configured role with s3:PutPublicAccessBlock for deployment. I have set BlockPublicPolicy: true in the above bucket.

Can you please guide me on this.

Thanks,