Make S3 object public after upload via Lambda.

If s3fs cannot read file, it is possible that ACL has issue. One method is make object public.

Step-by-Step Guide

We use ncml-lambda as bucket name. The following is Python lambda code.

  • s3 = boto3.resource('s3')
  • s3.meta.client.upload_file(tmpname, 'ncml-lambda', oname)
  • object_acl = s3.ObjectAcl('ncml-lambda', oname)
  • result = object_acl.put(ACL='public-read')