I stupidly removed the s3 bucket for my serverless project. When I now try and deploy or remove my application I get this error: The specified bucket does not exist
How can I recreate the s3 bucket from Serverless?
Asked
Active
Viewed 1.7k times
23

Freid001
- 2,580
- 3
- 29
- 60
4 Answers
45
I needed to delete the stack from cloud formation, once done I was able to re-run serverless deploy successfully.

Freid001
- 2,580
- 3
- 29
- 60
-
Have you tried adding the bucket again? I think it might not be added in the cloud formation. – Priyam Gupta Jul 31 '17 at 12:21
-
1Deleting a production stack is not an option for some. So to recover the old bucket, go to the CloudFormation console for the stack in question, click the Resources tab, your bucket should be listed there somewhere. Just re-create it from the S3 console. – Joshua Kifer Apr 20 '19 at 19:27
4
Yes the serverless works like that only. When you deleted the s3 bucket it was not deleted from the stack entry hence it was failed. We should delete Stack entry as well from it if we are deleting the S3 bucket. From error handling we can also check if bucket exists or not.

Time
- 143
- 1
- 1
- 10
2
For production use this plugin
https://www.serverless.com/plugins/serverless-deployment-bucket
and set the bucket. it will create if it doesnt exist.
provider:
name: aws
region: us-east-1
runtime: provided.al2
stackName: buggy
deploymentBucket:
name: buggy-deploymentbucket
plugins:
- serverless-deployment-bucket

Danilo Kobold
- 2,562
- 1
- 21
- 31
0
I had a similar error and here is my solution
Run the following commands in you terminal from the project root directory.
serverless remove
or sls remove
serverless deploy
or sls deploy

Fonchu.
- 1