Developing lambdas - AWS SAM with VSCode and Linux

From EnigmaGuy Wiki
Revision as of 17:27, 7 June 2020 by Enigmaguy (talk | contribs) (Created page with "= IN DEVELOPMENT = = Developing lambdas with AWS SAM, Linux, and VS Code = == Why this solution == When I first started to develop a lambda functions it was a small one. I...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

IN DEVELOPMENT

Developing lambdas with AWS SAM, Linux, and VS Code

Why this solution

When I first started to develop a lambda functions it was a small one. I mostly developed them from a web console and exported files which I saved into a git repository. Soon I started to work on more complex functions that contained several files, lambda layers, and connection to other services such as Amazon Aurora. Soon development in web console becomes a headache. A small window with no debugging and autocomplete facilities where on every iteration I had to export function and save into a git repository. At the end of development, I had to write the Cloudformation template, test it, and deploy it. Every small change meant exporting code, saving into a git repository, zipping files, and deploying with test stack into a cloud.

Soon I decided to try AWS SAM. It got me a little excited. I have got a code in Visual Studio Code with all functionalities like access to a git repository, Python Linter, Python debugger, autocomplete, access to local MySQL database with integrated PHPMyAdmin, and deploying an application into AWS was a matter of one click.

Why Windows VSCode with Ubuntu Linux in HyperV?

To be honest I love Linux. It is so powerful tool where you can customize everything. I worked as Linux admin for more than ten years so I feel pretty much at home. But at the same time, I hate Linux for its graphical interface and working functionality on the computer. Linux is great on the server or command line but has major shortcomings as the main operating system at desktop computer or laptop. Let's name a few - not well functioning sleep mode on laptops, sometimes trouble with a clipboard in GUI, terrible remote access in GUI (Remote Desktop in Windows is one hundred times better than VNC) and the worst - missing a large number of productivity apps (Office 365, etc...)

For the desktop I strongly prefer Windows and I changed my opinion about Microsoft since it started to support open source a lot. I have tried Windows Subsystem for Linux (WSL) and I cannot recommend it for this scenario. The trouble with WSL is not only that it is terribly slow (that does not matter so much for app development, just installing tools takes too long). The main trouble is that WSL is a container service.

That means you cannot install Docker into WSL and have to install it into Windows. You also cannot install any other service such as MySQL. For these reasons, I have decided to use HyperV with Ubuntu 20.04. I also do not recommend using VirtualBox because HyperV offers you the functionality to start your virtual machine during boot without any modifications.

And reasons for the Visual Studio Code? I love it, simply. I used to be a fan of VIM but VIM is just an editor, not a complete IDE. I found that the main benefit of Visual Studio Code lays in the number of available extensions, particularly in one I like most - Remote SSH development. It is so easy to connect your Visual Studio Code editor with Linux not mentioning you can very easily use an integrated terminal window for your Linux server in HyperV.