Walkthrough of Serverless v1.0.0 Alpha-1
The Serverless team has just announced the first alpha of version 1 of their framework which is very exciting as it introduces new, interesting changes.
Let’s take a closer look at what’s new and how version 1 will work!
Services vs. Projects
Serverless v0 used a “project” terminology to group functions, resources and everything your fully fledged application needs inside one large codebase.
However cloud applications are different nowadays.
Patterns such as “Microservices” or even “Nanoservices” have emerged and large companies such as Netflix or Spotify are already embracing these new architectures to be way more agile. They have many small codebases where teams can work independently on. No more headaches because of conflicts or code which breaks the whole application.
Serverless v1 follows this direction. Starting with Serverless v1 you think in independent “services” rather than “projects”. One service can be deployed on one provider and encapsulates corresponding functions, events and resources.
You should read this blog post by the Serverless team to learn more about v1 and the “services” concept.
serverless.yaml
v1 introduces the serverless.yaml file as the main part of your new Serverless service.
This file includes all the necessary information about your service.
It includes the used plugins, the functions and it’s events (such as e.g. http events) and even custom provider resources.
Here’s an example of a sample serverless.yaml file:
service: first_service
provider: aws
plugins:
- additional_plugin
- another_plugin
functions:
hello:
handler: handler.hello
events:
- s3: bucketName
- schedule: rate(10 minutes)
- http:
path: users/create
method: GET
Want to add another event?
Just add it to the events section and redeploy your service.
Want to remove a function?
Remove it from the file and redeploy the service.
It’s that easy.
Just try it
It would be great if you try the alpha and give the Serverless team feedback!
Just visit the “documentation” in the v1 branch of the Serverless repository to read how you can install the alpha on your machine.
Furthermore there’s also a guide which will guide you through the development of your first Serverless v1 service!
Conclusion
The first alpha is out! Make sure to grab it and play around with it! Feel free to report bugs and join the discussion in the issues!