Recently, the AWS Serverless Developer Advocate team released the Serverless Snippets Collection. A new Serverless Land Snippet page makes it easier to find, copy, and share common code that can enhance productivity in serverless application development.
The Serverless Snippets Collection is intended to enable community-driven and maintained reusable, tested, and recommended snippets. Serverless snippets can be used by developers to find and integrate tools, code examples, and Amazon CloudWatch Logs Insights queries to aid in their development. In addition, developers can write their own snippets leveraging the GitHub repo and contribute them to the site using standard GitHub pull requests.
Source: https://aws.amazon.com/blogs/compute/introducing-the-new-aws-serverless-snippets-collection/
The snippets can contain code from various languages such as .NET, Node.js, and TypeScript, and developers can include multiple languages within a single snippet. Furthermore, snippet type has tags to filter by snippet type, programming language, AWS service, or custom tags to make searching snippets easy. And lastly, each snippet has a custom interface.
The current snippet types available on the code snippet page are CloudWatch Logs Insights, Integration, and Tools. The first contains several CloudWatch Logs Insights queries that can help developers analyze their applications faster and include tags such as memory, latency, duration, or errors. The integration snippets provide integration code between AWS services, such as Amazon S3 integration. And finally, tool snippets include detailed instructions on installing the tool and example usage with additional resource links.
Doug Toppin, a senior cloud infrastructure architect at Amazon Web Services, tweeted:
It is always helpful to find a code snippet that you can use as an example for doing something in AWS (and might do everything that you need). #serverlessland recently added the Serverless Snippets Collection, and it is great for exactly that.
In addition, in another tweet, Toppin expresses the benefit of the code snippets:
With some of them, like the CloudWatch Logs Insights examples, you can launch them right into your account. With others, you can see them in multiple languages, which is great for learning. They are all excellent and working examples to do useful things.
With AWS Serverless code snippets, the Developer Advocate team enhances the available resources for developers next to the recently added Step Functions Workflow collection.
Lastly, more details on developing serverless applications are available on the Serverless Land website.