Blog
Terraform
Qovery
AWS
4
minutes

Create Outstanding AWS Infrastructure with Terraform and Qovery

Terraform combined with Qovery is like giving superpower to DevOps and developers. I am super excited to launch a brand new GitHub repository with "ready-to-use" examples to deploy crazy AWS cloud architecture with Terraform and Qovery. Feel free to use them, modify them and share them with us and our community.
Romaric Philogène
CEO & Co-founder
Summary
Twitter icon
linkedin icon

It's an excellent way to familiarize yourself with Terraform, AWS, and how to use Qovery. Thousands of developers and DevOps build outstanding infrastructure on top of AWS. We are eager to share the best practices and ready-to-use architecture for your personal and professional projects.

If you are not familiar with Terraform and Qovery, watch our introduction video.

AWS architecture examples

The Terraform Examples can help you to jumpstart using AWS on production-ready infrastructure like the following one

Deploy an application with a PostgreSQL database on AWS and 3 environments (Production, Staging, Development)

Full Production, Staging and Dev environments on AWS with Kubernetes and RDS

Here is an example of what the Terraform looks like to create the production environment. Note: every environment is running into a dedicated VPC.

resource "qovery_aws_credentials" "my_aws_creds" {
organization_id = var.qovery_organization_id
name = "URL Shortener"
access_key_id = var.aws_access_key_id
secret_access_key = var.aws_secret_access_key
}

resource "qovery_cluster" "production_cluster" {
organization_id = var.qovery_organization_id
credentials_id = qovery_aws_credentials.my_aws_creds.id
name = "Production cluster"
description = "Terraform prod demo cluster"
cloud_provider = "AWS"
region = "us-east-2"
instance_type = "T3A_MEDIUM"
min_running_nodes = 3
max_running_nodes = 4
state = "RUNNING"

depends_on = [
qovery_aws_credentials.my_aws_creds
]
}

resource "qovery_cluster" "staging_cluster" {
organization_id = var.qovery_organization_id
credentials_id = qovery_aws_credentials.my_aws_creds.id
name = "Staging cluster"
description = "Terraform staging demo cluster"
cloud_provider = "AWS"
region = "us-east-2"
instance_type = "T3A_MEDIUM"
min_running_nodes = 3
max_running_nodes = 4
state = "RUNNING"

depends_on = [
qovery_aws_credentials.my_aws_creds
]
}

resource "qovery_cluster" "dev_cluster" {
organization_id = var.qovery_organization_id
credentials_id = qovery_aws_credentials.my_aws_creds.id
name = "Dev cluster"
description = "Terraform dev demo cluster"
cloud_provider = "AWS"
region = "us-east-2"
instance_type = "T3A_MEDIUM"
min_running_nodes = 3
max_running_nodes = 4
state = "RUNNING"

depends_on = [
qovery_aws_credentials.my_aws_creds
]
}


resource "qovery_project" "my_project" {
organization_id = var.qovery_organization_id
name = "Multi-env Project"

depends_on = [
qovery_cluster.production_cluster
]
}

resource "qovery_environment" "production" {
project_id = qovery_project.my_project.id
name = "production"
mode = "PRODUCTION"
cluster_id = qovery_cluster.production_cluster.id

depends_on = [
qovery_project.my_project
]
}

resource "qovery_database" "production_psql_database" {
environment_id = qovery_environment.production.id
name = "strapi db"
type = "POSTGRESQL"
version = "13"
mode = "MANAGED" # Use AWS RDS for PostgreSQL (backup and PITR automatically configured by Qovery)
storage = 10 # 10GB of storage
accessibility = "PRIVATE" # do not make it publicly accessible
state = "RUNNING"

depends_on = [
qovery_environment.production,
]
}

resource "qovery_application" "production_strapi_app" {
environment_id = qovery_environment.production.id
name = "strapi app"
cpu = 1000
memory = 512
state = "RUNNING"
git_repository = {
url = "https://github.com/evoxmusic/strapi-v4.git"
branch = "main"
root_path = "/"
}
build_mode = "DOCKER"
dockerfile_path = "Dockerfile"
min_running_instances = 1
max_running_instances = 1
ports = [
{
internal_port = 1337
external_port = 443
protocol = "HTTP"
publicly_accessible = true
}
]
environment_variables = [
{
key = "PORT"
value = "1337"
},
{
key = "HOST"
value = "0.0.0.0"
},
{
key = "DATABASE_HOST"
value = qovery_database.production_psql_database.internal_host
},
{
key = "DATABASE_PORT"
value = qovery_database.production_psql_database.port
},
{
key = "DATABASE_USERNAME"
value = qovery_database.production_psql_database.login
},
{
key = "DATABASE_NAME"
value = "postgres"
},
]
secrets = [
{
key = "ADMIN_JWT_SECRET"
value = var.strapi_admin_jwt_secret
},
{
key = "API_TOKEN_SALT"
value = var.strapi_api_token_salt
},
{
key = "APP_KEYS"
value = var.strapi_app_keys
},
{
key = "DATABASE_PASSWORD"
value = qovery_database.production_psql_database.password
}
]

depends_on = [
qovery_environment.production,
qovery_database.production_psql_database,
]
}

Check out the complete Terraform manifest file here.

Behind the scene, Qovery:

  1. Creates 3 Kubernetes clusters (`Production`, `Staging`, `Dev`) on your AWS account (VPC, Security Groups, Subnet, EKS/Kubernetes...)
  2. Creates Qovery Organization `Terraform Demo`
  3. Creates Qovery Project `Strapi V4`
  4. Creates Qovery Environment `production`
  5. Creates Qovery Database `strapi db` (RDS) for `Production`
  6. Application `strapi app` for `Production`
  7. Creates Qovery Environment `staging`
  8. Database `strapi db` (RDS) for `Staging`
  9. Application `strapi app` for `Staging`
  10. Environment `dev`
  11. Database `strapi db` (Container with EBS) for `Dev`
  12. Application `strapi app` for `Dev`
  13. Inject all the Secrets and Environment Variables used by the app for every environment
  14. Builds `strapi app` application for `Production`, `Staging` and `Dev` environments in parallel
  15. Pushes `strapi app` container image in your ECR registry for `Production`, `Staging` and `Dev` environments in parallel
  16. Deploys your PostgreSQL database for `Production` (AWS RDS), `Staging` (AWS RDS) and `Dev` (Container) environments in parallel
  17. Deploys `strapi app` on your `Production`, `Staging` and `Dev` EKS clusters
  18. Creates an AWS Network Load Balancer for all your clusters and apps
  19. Generates a TLS certificate for your app for all your apps
  20. Exposes publicly via HTTPS your Strapi app from `Production`, `Staging` and `Dev` through different endpoints

Terraform takes takes approximately 30 minutes per environment👍 So technically speaking you can have a Production, Staging and Dev environment in less than 2 hours and by letting Terraform and Qovery doing the job for your on your AWS account 😎

What's next?

Check out our Terraform Examples repository now and feel free to contribute.

Share on :
Twitter icon
linkedin icon
Ready to rethink the way you do DevOps?
Qovery is a DevOps automation platform that enables organizations to deliver faster and focus on creating great products.
Book a demo

Suggested articles

DevOps
 minutes
TPUs vs. GPUs: The DevOps Guide to AI Hardware Selection

Stop guessing on AI hardware. This DevOps guide details when to use TPUs vs. GPUs for optimal performance, cost, and framework compatibility in MLOps.

Mélanie Dallé
Senior Marketing Manager
Cloud
Business
10
 minutes
The DevOps Guide to Docker Monitoring: Tools, Best Practices, and Unified Observability

Stop tool sprawl. Compare top Docker monitoring tools (Prometheus, Datadog, Qovery) and learn how unified observability simplifies K8s debugging and speeds up feature delivery.

Romaric Philogène
CEO & Co-founder
Cloud
Heroku
Internal Developer Platform
Platform Engineering
9
 minutes
The Top 8 Tools to Build a Zero-Toil PaaS on Your Cloud

Stop managing K8s complexity. Discover the top 8 platform tools (Qovery, Rancher, Dokku) that let you build a customizable, zero-maintenance PaaS on your cloud.

Morgan Perry
Co-founder
Kubernetes
 minutes
How to Deploy a Docker Container on Kubernetes: Step-by-Step Guide

Simplify Kubernetes Deployment. Learn the difficult 6-step manual process for deploying Docker containers to Kubernetes, the friction of YAML and kubectl, and how platform tools like Qovery automate the entire workflow.

Mélanie Dallé
Senior Marketing Manager
Observability
DevOps
 minutes
Observability in DevOps: What is it, Observe vs. Monitoring, Benefits

Observability in DevOps: Diagnose system failures faster. Learn how true observability differs from traditional monitoring. End context-switching, reduce MTTR, and resolve unforeseen issues quickly.

Mélanie Dallé
Senior Marketing Manager
DevOps
Cloud
8
 minutes
6 Best Practices to Automate DevSecOps in Days, Not Months

Integrate security seamlessly into your CI/CD pipeline. Learn the 6 best DevSecOps practices—from Policy as Code to continuous monitoring—and see how Qovery automates compliance and protection without slowing development.

Morgan Perry
Co-founder
Heroku
15
 minutes
Top 10 Heroku Alternatives: When Simplicity Hits the Scaling Wall

Escape rising Heroku costs & outages. Compare top alternatives that deliver PaaS simplicity on your own cloud and scale without limits.

Mélanie Dallé
Senior Marketing Manager
Product
Infrastructure Management
Deployment
 minutes
Stop tool sprawl - Welcome to Terraform/OpenTofu support

Provisioning cloud resources shouldn’t require a second stack of tools. With Qovery’s new Terraform and OpenTofu support, you can now define and deploy your infrastructure right alongside your applications. Declaratively, securely, and in one place. No external runners. No glue code. No tool sprawl.

Alessandro Carrano
Head of Product

It’s time to rethink
the way you do DevOps

Say goodbye to DevOps overhead. Qovery makes infrastructure effortless, giving you full control without the trouble.