Iml syntax for writing to multiple S3 buckets

Can write to S3 bucket no problem, but when I try to get single Lambda to write different things to different buckets, i get errors. Can someone tell me what the syntax is please?

  iamRoleStatements:
    - Effect: Allow
      Action:
        - 's3:PutObject'      #Permission to write to s3
        - 's3:PutObjectAcl'   #Permission to make written images public (etc.)
      Resource: 'arn:aws:s3:::${self:custom.bucket}/*'

If I have a custom.bucket2, how do I write this? AWS documentation suggests using fn::jn, but I tried a bunch of different ways, and always got an error

You’re very close… Just make the value of the Resource property an array like so:

  iamRoleStatements:
    - Effect: Allow
      Action:
        - 's3:PutObject'      #Permission to write to s3
        - 's3:PutObjectAcl'   #Permission to make written images public (etc.)
      Resource: 
        - 'arn:aws:s3:::${self:custom.bucket}/*'
        - 'arn:aws:s3:::${self:custom.bucket2}/*'

Hope it helps.