Following are the steps to build a scalable GraphQL API over Serverless Aurora PostgreSQL with the help of ECS to run the docker image which will be deployed by AWS Cloudformation.
The idea is to deploy the Hasura Docker Image as a Elastic Cluster Service. This gives us ability to add compute tasks to the cluster whenever current CPU is not sufficient for serving the user requests. This behavior can be modified by changing
MaxContainers parameters in the CloudFormation Templates. Aurora Serverless PostgreSQL is a managed service from AWS which handles on-demand scaling, this supports our scalable Hasura Compute with the database layer needed.
One Click Launch CloudFormation Links
This launch URL, retrieves cloudformation template from AWS S3 and runs it to form the stack. On calling the URL, it calls the yaml file which consist of the instructions aws must use while creating the stack on cloudformation. You will have to fill in the details to name the database, set password and define the domain in case if you want to deploy Hasura with SSL and custom domain name.
Deploy Hasura with default DNS of Load Balancer
Deploy Hasura Engine with a auto generated DNS from Load Balancer. To access the deployed Hasura, go to EC2 dashboard on AWS and click on the created load balancer, now copy the DNS name and open it in a new tab.
Deploy Hasura with custom domain and SSL
Deploy Hasura Engine with custom domain name and SSL. Pre-requisites for this step would be to have a hosted zone setup in Route53 and SSL certificate issued from Amazon Certificate Manager.
- Serverless GraphQL with Hasura on AWS ECS over Aurora PostgreSQL
- Construct Your Own Launch Stack URL
For questions and suggestions, feel free to reach out to us on Twitter.
Are you planning to go to serverless? AntStack is a cloud computing service and consulting company primarily focusing on Serverless Computing. We help companies get up and running with serverless, and we’ll make sure that there are no limits.