Edit serverless YAML templates in VSCode like a pro | Serverless IDE

Pavel Vlasov
Oct 26 · 3 min read
Photo by frank mckenna on Unsplash

I am a huge fan of serverless technologies and AWS Lambda in particular. It is just incredible how simple it is to build reliable and scalable infrastructures so fast.

But there is a problem. No matter if you work with Serverless Framework or AWS SAM you have to deal with YAML and CloudFormation.

And working with YAML is hard…

How does the typical serverless application development cycle look like?

Initialization You start with serverless create or sam init to put together a template.

Configuration

Then add a couple of lambda functions, DynamoDB table maybe. Oh, you probably forgot how to create a DynamoDB stream or how to enable server-side encryption. So you need to open docs.

Go to google.com, type DynamoDB Cloudformation hit I'm Feeling Lucky open AWS Docs, and do a few CMD+C/CMD+V into your template file.

Deployment

And now you are ready to deploy.

At this stage, the deployment framework will compile your code, put everything together into a zip archive and then send it over a network to AWS. It is a quite time-consuming task and might take a while. Once everything is done you get the message about invalid CloudFormation template.

And you have to go to step 2 again.

I have been struggling with it for a while. I explored multiple options and VSCode plugins but could not find a solution that will satisfy my needs. So I decided to build my own VSCode plugin.

Solution

I want to introduce you to Serverless IDE. The most advanced VSCode plugin for AWS CloudFormation and SAM.

The project started as a hard fork of vscode-yaml, which eventually was mainly rewritten and tuned for better support of CloudFormation.

The main capabilities are:

Smart autocompletion

In addition to properties and values completion, the plugin supports smart snippets for AWS resources. It handles the Globals template section in AWS SAM, so it will exclude fields that are already defined.

Go-to definitions and references

You can navigate between resources by CMD+hover over !Ref intrinsic function references.

Validation

Serverless IDE validates your template and highlights potential problems, including invalid resource references. In addition to that, it supports cfn-lint.

AWS documentation at a glance

This one is my favorite. You can get easy access to AWS documentation right in the editor.

The plugin provides limited serverless framework support but its external imports are not supported just yet, and some use-cases with plugins might not be supported as well.

The source code is available on Github.

Thanks for reading!

Hi! My name is Pavel and I’m a creator of ServerlessIDE.

If you like the idea, give it a try!

Found a bug? Raise an issue here.

Have a suggestion or question? You can always DM me on twitter.


Originally published at https://serverless-ide.com.

Pavel Vlasov

Written by

Teams advocate and #serverless enthusiast. Creator of Serverless IDE https://marketplace.visualstudio.com/items?itemName=ThreadHeap.serverless-ide-vscode

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade