Simplify Framework vs. Terraform For AWS Lambda Serverless Deployment Model

Dinh-Cuong DUONG
3 min readJul 15, 2021

This article aims to have a quick look at Terraform and the other Serverless framework to see what is the right tool in a right place. Terraform is a great Infrastructure as Code from HashiCorp that helps your organization deploying an agnostic cloud/on-premise software solution. But is it really an agnostic Infrastructure as Code tool?

Tool Installation

  1. Simplify-CLI requires a node environment
    npm install simplify-cli -g
  2. Terraform can install from binary: https://www.terraform.io/downloads.html

Setup Environment

Both tools support an init command for setting up the local setting and the cloud environment configuration to deploy resources.

simplify-cli init

Its command line will prompt you to set up the environment (.env):

To use Terraform, you must learn its configuration-code file format. So that you can know how to set up the AWS Cloud provider, the credentials, the deployment region, etc.,

terraform init

It’s pretty straightforward to use a *.tf file when you have learned one programming language before.

A terraform IaC configuration for AWS Cloud

Additionally, Terraform uses a special configuration-code file format, it provides two commands for linting and validating the file written content

  • terraform fmt
  • terraform validate

Create a Project

To deploy your serverless function code, we’ve created a simple NodeJS project in the same folder we’ve initialized by those tools:

/TestProject/src/index.js

Deploy Function

By using simplify-cli, this tool is a Serverless Deployment framework. Hence, there is no required configuration need. One simple command line works:

simplify-cli deploy — function TestLambda — location TestProject — source src

With terraform, we need to declare the lambda function and its role policy in *.tf. Attention!!! Where does the dist/2021–07–15.zip file come from?

Before running the “terraform apply” command, the function code needs to be baked into a zip file before it can be sent to AWS Cloud. Terraform doesn’t support any autonomous code reference likes AWS CDK or other serverless frameworks.

Looking into the specific serverless definition section, you can see all those lines are vendor lock-in definitions for AWS. Here is an Azure function resource definition in Terraform *.tf:

Conclusion

In a community discussion of https://discuss.hashicorp.com, the agnostic thing of Terraform is the use of Consistent Workflow across environments.

“Terraform is cloud-agnostic in that it works with multiple cloud providers. Terraform enables developers to maintain the same workflow when provisioning resources across cloud/infrastructure providers.”

What is a Terraform Workflow?

The workflows of Terraform are built on top of five key steps: Write, Init, Plan, Apply and Destroy. Nevertheless, their details and actions vary between workflows.

If you are deploying multiple infrastructures and the resources of one infrastructure depend on the other infrastructure, the Terraform workflow “depends” parameters, which will help you in this situation. If you use another tool, an orchestration script such as Bash/Shell, NodeJS or Python is always your best friend and it can deal with almost harden, cyclic references, unsupported features like zipping a function code.

DevOps Engineer is a role to fulfill the gap between Software Developers and System Operators in a means of system orchestration and infrastructure automation. DevOps with Terraform will help him to build a Cloud Agnostic Software System which is built on Docker/Kubernetes so that the Software Stacks above the Agnostic Layer will be run without vendor lock-in by using OpenSource Software Technology over Docker instances.

Cloud-Native-based solutions such as AWS Lambda Serverless architecture model that use the advantages of AWS Cloud Provider to speed up the time-to-market, minimizing the infrastructure cost, the operation complexity, and security compliance of your products. Delivering fast and reliable is important than building an agnostic solution with a huge “agnostic” cost at the scaling-up stage of new business development.

--

--

Dinh-Cuong DUONG

(MSc) Cloud Security | Innovator | Creator | FinTech CTO | Senior Architect.