pulumi-hasura-aws-eks-example
pulumi-hasura-aws-eks-example copied to clipboard
Sample Pulumi Configuration to deploy Hasura to AWS EKS
Demo Kubernetes AWS Deployment Using Pulumi
Example on deploying Hasura on AWS EKS using Pulumi
Requirements
Deployed Resources
- AWS VPC
- AWS ECR Container for Hasura (with Migrations)
- AWS EKS Kubeternetes Cluster
- AWS RDS PostgreSQL Instance
- No public access only access allowed from EKS Cluster using Securtiy Group.
- AWS ElasticCache Redis Instance
- No public access only access allowed from EKS Cluster using Securtiy Group.
Kubernetes Instances/Components
- Namespace
- Hasura Instance
- Hasura Backend Plus
- Secrets Including Postgres and Redis Connection details
- Nginx Ingress (Using Helm)
Planned Features
- GitHub Actions
- Deployment of Dockerised Node App (using ECR) for Hasura Event Triggers
- Automatic SSL/certs
Fun Instructions
cd infrastructurepulumi uppulumi stack output kubeconfig > kubeconfigs/test.jsonKUBECONFIG=./kubeconfigs/test.json kubectl get pods --namespace=`pulumi stack output namespace`KUBECONFIG=./kubeconfigs/test.json kubectl scale deployment/hasura --replicas=2 --namespace=`pulumi stack output namespace`
Accessing services
KUBECONFIG=./kubeconfigs/test.json kubectl get ingresses --namespace=`pulumi stack output namespace`curl -H 'Host: graphql.pulumi.demo.com' <YOUR_INGRESS_ADDRESS>/healthzcurl -H 'Host: auth.pulumi.demo.com' <YOUR_INGRESS_ADDRESS>/healthz
Hasura Backend Plus Commands
Register User
curl --location --request POST '<YOUR_INGRESS_ADDRESS>/auth/local/register' \
--header 'Host: auth.pulumi.demo.com' \
--header 'Content-Type: application/json' \
--header 'Cache-Control: no-cache' \
--data-raw '{
"username": "testuser",
"password": "testpassword"
}'
Login User
curl --location --request POST '<YOUR_INGRESS_ADDRESS>/auth/local/login' \
--header 'Host: auth.pulumi.demo.com' \
--header 'Content-Type: application/json' \
--header 'Cache-Control: no-cache' \
--data-raw '{
"username": "testuser",
"password": "testpassword"
}'
Bring Down Resources
pulumi destroy --yes