Hi
severless / AWS noob here.
I have started with a simple version of a function (hello) which stores some data in an s3 bucket. This all worked fine.
Next I added a function that I wanted to get triggered whenever a s3 object is stored. The resulting severless.yaml looks like this:
service: aws-nodejs
provider:
name: aws
runtime: nodejs6.10
iamRoleStatements:
- Effect: "Allow"
Action:
- "s3:*"
Resource: "arn:aws:s3:::test-s3bucket2/*"
functions:
hello:
handler: handler.hello
stored:
handler: handler.stored
events:
- s3: test-s3bucket2
resources:
Resources:
NewResource:
Type: AWS::S3::Bucket
Properties:
BucketName: test-s3bucket2
Now after I deploy it again I get an error that the bucket already exists:
$ sls deploy -s dev
Serverless: Packaging service...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service .zip file to S3 (598 B)...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
....................Serverless: Deployment failed!
Serverless Error ---------------------------------------
An error occurred while provisioning your stack: S3BucketTests3bucket2
- test-s3bucket2 already exists in stack arn:aws:cloudformation:us-east-1:339468856116:stack/aws-nodejs-dev/498e8ca0-4c6b-11e7-9da6-50fae98b1835.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Forums: forum.serverless.com
Chat: gitter.im/serverless/serverless
Your Environment Information -----------------------------
OS: darwin
Node Version: 7.10.0
Serverless Version: 1.13.2
This brings me to some questions:
- What does the error really say / mean? Removing the resource section from the yaml didn’t help.
- How are (s3) resources handled? What is the proposed way of working with these?
- How is cloudformation handling these? Are these calls not idempotent?
Thanks
Matthias