# S3 permission error when creating a new stack

**URL:** https://forum.serverless.com/t/s3-permission-error-when-creating-a-new-stack/19035
**Category:** Serverless Framework
**Tags:** lambda
**Created:** [June 27, 2023, 12:36pm UTC](https://forum.serverless.com/t/s3-permission-error-when-creating-a-new-stack/19035 "2023-06-27T12:36:39Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![buzuli](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/buzuli/32/7545_2.png) [@buzuli](https://forum.serverless.com/u/buzuli)
#### Post date: [June 27, 2023, 12:36pm UTC](https://forum.serverless.com/t/s3-permission-error-when-creating-a-new-stack/19035/1 "2023-06-27T12:36:40Z")

</div>

When trying to deploy a new lambda, the lambda is not being created with permission to access the S3 bucket containing its code, so the CloudFormation stack creation fails.

```auto
✖ Stack SlackAssistant-dev failed to deploy (93s)
Environment: darwin, node 20.1.0, framework 3.32.2 (local), plugin 6.2.3, SDK 4.3.2
Credentials: Local, "<aws-profile>" profile
Docs: docs.serverless.com
Support: forum.serverless.com
Bugs: github.com/serverless/serverless/issues

Error:
CREATE_FAILED: SlackAssistantLambdaFunction (AWS::Lambda::Function)
Resource handler returned message: "Your access has been denied by S3, please make sure your request credentials have permission to GetObject for slackassistant-dev-serverlessdeploymentbucket-<salt>/serverless/SlackAssistant/dev/<ts>/SlackAssistant.zip. S3 Error Code: AccessDenied. S3 Error Message: Access Denied (Service: Lambda, Status Code: 403, Request ID: <id>)" (RequestToken: <token>, HandlerErrorCode: AccessDenied)

```

Here is the link to the serverless.yml file: [slack-assistant/serverless.yml at a526d1345d1468f4ad1b5522c51544fb98e8148f · joeledwards/slack-assistant · GitHub](https://github.com/joeledwards/slack-assistant/blob/a526d1345d1468f4ad1b5522c51544fb98e8148f/serverless.yml)

I expected that serverless would automatically give the Lambda the necessary permissions on the bucket. Perhaps there is some confusion with how resources are being named.
