On AWS using Terraform
Describes production grade infrastructure provisioning using Terraform on AWS cloud
This guide provisions a production-shaped Hyperswitch stack entirely on AWS, using Terraform modules from hyperswitch-suite composed with a Terragrunt Stack.
Architecture at a glance
Networking
VPC, Subnets, Route53, Cloudfront, Proxies, NAT etc.
Storage
RDS, Elasticache, s3
Compute
EC2, EKS cluster
Managed resources
KMS, Cloudwatch, WAF, IAM, etc.
The Terraform stack provision the AWS infrastructure. Argo CD then deploys the required applications on top of that infrastructure
Prerequisites
Install and authenticate, from official sources:
Step 1 — Define the Infra stack using Terragrunt/Terraform
hyperswitch-suite repo ships a reference stack at terraform/aws/catalog/stacks/dev/terragrunt.stack.hcl. Reading that file is recommended.
Save the file in the following path of your repository terraform/aws/live:
Your file should look like below and please update the values in that file as per the requirement, which would have been done in finalizing stack blueprint,
Step 2 — Generate & Bootstrap
The following step generates terragrunt section required for the stack setup
Check the directory, you should be seeing all the modules required for the hyperswitch-stack in that folder.
Step 3 — Plan & Apply
Since modules are dependent on other modules, we need to run terragrunt in phases, below are the phases in the order one has to apply. Please skip items based on the requirement.
Reply yes only when the plan shows creates and nothing else.
Step 4 — Create the logical databases and its users
We have 4 applications, which needs database of its own. Generate every password with openssl rand -base64 32
hyperswitch-app (the OLTP Router)
superposition
decision-engine
locker (the card vault)
Lets go one by one.
Hyperswitch App
Fetch host from terragrunt output --working-dir database and login into the database and create user.
Database Schema Creation
Superposition
Fetch host from terragrunt output --working-dir application-stack/apps/superposition and login into the database and create user.
Database Schema Creation
Decision Engine
Fetch host from terragrunt output --working-dir application-stack/apps/decision-engine and login into the database and create user.
Database Schema Creation
Locker
Fetch host from terragrunt output --working-dir application-stack/locker and login into the database and create user.
Database Schema Creation
Step 5 — Create secrets
Create following secrets in AWS secret manager and update the KMS encrypted sensitive data of respective application over there
hyperswitch-app
prod/hyperswitch
recon
prod/hyperswitch-recon
revenue-recovery
prod/revenue-recovery
Step 6 - Validation
Output decides the validation. Exit code 0 = no changes, 1 = error, 2 = changes
Last updated
Was this helpful?

