Serverless framework lifehack that could save you hundreds of hours

Today, 1st October 2022, Ukraine is still bravely fighting for democratic values, human rights and peace in whole world. Russians ruthlessly kill all civilians in Ukraine including childs and destroy their cities. We are uniting against Putinโ€™s invasion and violence, in support of the people in Ukraine. You can help by donating to Ukrainian's army.

Image for a hint

Assume you don't know how to write something in serverless.yml. Or you are not sure. Or you wrote it but it still not working.

Here is the idea:

If you could know how others do it you would be able to make the same, right?

And it is possible.

For example, you don't know how to specify bucket resources in the Policy attached. But you know that there might be tons of opensource projects which use serverless and need to grant s3:PutObject to be able to upload the file into S3 bucket.

So just go to GitHub and type in search:

Searching using GitHub

Scroll down to any file named serverless.yml and you will see this:

Example in code

We were looking for serverless.yml file, because they guarantee that framework is serverless. Raw CloudFormation files might also have .yml extension but in same time they are not fully compatible with serverless. E.g. they use Sub function which allows to substitute variables using '${var}' but $-rs clash with serverless variables. BTW there is even plugin that overcomes it by using # instead of $

Ivan Borshchov profile picture
Sep 15, 2021
by Ivan Borshchov
Did it help you?
Yes !

Best related