HashiCorp Nomad and Vault: Dynamic Secrets
In a cloud-native environment, secrets management is a critical aspect of security. HashiCorp Vault is a popular tool for managing secrets and protecting
As part of my Bachelor Thesis “Serverless Architectures”, my boss Edmund wanted to support me and assigned me the task to implement a serverless function to gain a deeper understanding of the serverless concept. We decided to work with the Serverless Framework.
We wanted to trigger our deployment pipeline for our website, which is described in the article Womenintech Part 4: Continuous Delivery Of A Static Web Page With Jekyll, GitLab And AWS, through a simple slash command in our slack channel. The problem here was, that you can’t configure the slash command to send a HTTP POST request with a JSON payload. So we decided to use a simple serverless function which triggers our pipeline.
The Serverless Framework is a toolkit which is designed for operating serverless architectures and deploying centrally to AWS Lambda, Microsoft Azure, IBM OpenWhisk and some more providers. The first thing you need to do is install the Serverless Framework on your machine with the command ‘’’npm install -g serverless’’’. Afterwards you can choose between AWS Lambda, Microsoft Azure, IBM OpenWhisk and some more providers where your service should run. The most common supported programming languages are Node.js, Python, Java and some more.
To create a new service with a template you can use the command below (choose your favourite provider):
1serverless create --template aws-nodejs | azure-nodejs | openwhisk-nodejs --path path-of-project
The template you get is configured to return a simple text message. We wanted our function to send a HTTP POST request to an API endpoint. Therefor I rewrote the code to handle this and to use custom options.
Afterwards I tested the function to see if it works as expected:
1serverless invoke –f “name of function”
2
3serverless invoke –-function “name of function” (OpenWhisk)
Deploying the service to a provider can be achieved with the following command:
1serverless deploy (-v)
AWS and OpenWhisk use the ‘-v’ option, whereas Microsoft doesn’t.
After the deployment, we configured the slash-command to send an HTTP POST Request to the API where our function is located, when called.
OpenFaaS on the other side is a open source serverless framework to build serverless functions. They can be embedded in a Docker container, this means that you are not depended on the programming languages that are supported by your provider. To work with it you should setup OpenFaas with Docker Swarm or with Kubernetes.
In contrast to the other providers, OpenFaaS works with orchestration platforms such as Docker Swarm or Kubernetes. It does not depend on runtimes for each supported language, therefor you can run code in any programming language.
It was really interesting for me to figure out how easy it is to configure and work with serverless functions. I very appreciate it that my colleagues support me wherever they can and that they are assigning me tasks which help me to write my Bachelor Thesis.
You are interested in our courses or you simply have a question that needs answering? You can contact us at anytime! We will do our best to answer all your questions.
Contact us