Add existing s3 bucket permission to lambda

Hey,

New to serverless setup and doing some web scraping. I need to save an image to an s3 bucket that is pre-existing and cannot be remade.

When trying to save I get an access denied.

How do I add permissions to the serverless-stack setup for the bucket in question?

I probably need to give more information but am not sure what you may need to help.

Sorry for the noob question

Thanks,

found the answer through a bit of trial and error but ultimately in the stack i needed to add api.attachPermissions(["s3"])
and everything just worked

1 Like