We recently used Serverless to handle the deployment of Lambda features in our AWS environment, but for each unique feature that is deployed, a new S3 bucket is created. This is inefficient, and for each stack created without a server, one bucket would be ideal. Is there any way to do this from the serverless.yml file? I tried to execute the following configurations of yml files for resources without any success.
1 - listing the bucket as a resource for use in yml
resources:
Resources:
ServerlessBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: serverless-test-bucket
Conclusion:
Serverless: Packaging service...
Serverless: Removing old service versions...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading service .zip file to S3...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
............Serverless: Deployment failed!
Serverless Error ---------------------------------------
An error occurred while provisioning your stack: ServerlessBucket
- serverless-test-bucket already exists.
2 - Trying to reference a bucket in yml
resources:
Resources:
ServerlessBucket:
Type: AWS::S3::Bucket
Properties:
Ref: serverless-test-bucket
Conclusion:
Serverless: Packaging service...
Serverless: Removing old service versions...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading service .zip file to S3...
Serverless: Updating Stack...
Serverless Error ---------------------------------------
Template format error: Unresolved resource dependencies
[serverless-test-bucket] in the
Resources block of the template
Raiju source
share