This sample application contains full Terraform deployments for the three major cloud platforms, namely: Amazon Web Services (AWS), Microsoft Azure (AZ), and Google Cloud Platform (GCP).
The goal of this project is to make those three deployments as homogeneous as possible to be able to compare the differences. Since not all cloud platforms offer the same features and work similarly, the resulting architectures differ slightly. Another aim was to make the deployments self-contained (they deploy the function code and frontend automatically), use only Serverless services as well as move all common parts out of the deployment (shared OpenAPI config and code).
The goals of the Terraform deployments in this project are:
- Use only Serverless services
- Use standards like OpenAPI
- Make the architectures as homogeneous as possible
- Self-contained / Move common parts out of the deployment
The application itself is a simple text analysis service that comes with a web-based frontend:
The relevant parts of this repository are:
Folder/File | Description |
---|---|
.devcontainer/ | The vscode devcontainer for this project |
.github/ | Reamd resources |
.vscode/ | vscode settings |
aws/ | The AWS deployment |
azure/ | The Azure deployment |
common/ | Common parts of the deployments |
common/api/ | The OpenAPI config |
common/function/ | The code for the FaaS function |
common/website/ | The static website for the frontend |
common/mime-types.json | The MIME type definitions for uploads |
gcp/ | The GCP deployment |
justfile | The just configuration |
You can start up this project rather quickly using the vscode devcontainers, which are based on Docker.
Using the command runner just, apply the Terraform configuration using just apply <folder>
, with aws
, gcp
or azure
as the folder name.
The application requires a frontend (a static website) and backend (based on Function as a Service (FaaS) offerings). The frontend needs to be served using a Content Delivery Network (CDN) to improve stability and page speeds. The FaaS function of the backend should sit behind an API Gateway.
- Functions can be called directly, bypassing the API Gateway
- Terraform currently only supports one origin per API Gateway
- Functions don't support ES6-style JavaScript modules (Azure/azure-functions-nodejs-worker#104). However, this feature is in preview https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-node#ecmascript-modules
- Google requires a load balancer in front of the CDN, which can get expensive
- There is no Google-provided domain/certificate for the CDN, so an IPv4 has to be provisioned
- The Google API Gateway only supports OpenAPI v2, not v3. Therefore the api-spec-converter has te be used to convert the OpenAPI definition (using
API-spec-converter --from=openapi_3 --to=swagger_2 --syntax=yaml openapi.yaml
).