Introduction

Integrating Amazon Aurora PostgreSQL with CTO.ai provides a solution that enhances database performance, scalability, and reliability. This blog post explores this integration, outlining the benefits and providing a detailed guide with code configurations.

Amazon Aurora PostgreSQL

Amazon Aurora PostgreSQL is a fully managed relational database engine compatible with PostgreSQL. It offers the performance and availability of high-end commercial databases at a lower cost.

Integration Benefits with CTO.ai

  • Automated Testing: Ensures database changes don't disrupt existing functionalities.
  • Scalability: Handles increased workloads efficiently.
  • High Availability: Combines Amazon Aurora's fault-tolerant architecture with CTO.ai's pipelines.
  • Security: Enhances security in database management processes.

Integration Steps

Amazon Aurora PostgreSQL Setup

  • Create an Instance:
  • Log in to AWS Management Console.
  • Navigate to RDS, select Create Database.
  • Choose Amazon Aurora, and select the PostgreSQL-compatible edition.
  • Follow setup instructions. Select your configuration settings and cluster storage configuration.

Network and Security Configuration:

  • Set up a Virtual Private Cloud (VPC).
  • Modify the security group to allow inbound traffic on PostgreSQL's port (default 5432) from your CI/CD pipeline.

Set up CTO.ai

  • Create a CTO.ai Account: Sign up and connect your GitHub repository with CTO.ai.

  • Install the Ops CLI by running the npm install -g @cto.ai/ops in your local machine.

    The CTO.ai ops CLI acts as the integration point between your command line workflows and the CTO.ai platform, providing a framework for implementing ChatOps-based workflows that integrate with your existing processes. It allows you to build, publish, and run Commands, Pipelines, and Services workflows from the comfort of your terminal, manage your Configs and Secrets stores, and invite members to your CTO.ai team.

  • Log in to your account using ops account:signin Running this command triggers a browser-based sign-in flow that allows you to log in to your account as you would on the web, as well as sign in with OAuth providers like GitHub.
  • In your GitHub repository, create a Config File called ops.yml: This file contains CTO.ai's instructions, steps, and commands for your project.
  • In your config settings in CTO.ai, add the Aurora database config value you will reference in your ops.yml file.

Here the name of my config key is DEV_AWS_ECS_FARGATE_STATE, and the JSON value will be in this format:

{
  "devawsecsfargatestate"::rds:us-west-1:303658152295:cluster:dev-aws-ecs-fargate-devawsecsfargatedb763ab67d-sgb65oooykwx"
}

CTO.ai Ops yaml File

After creating your Aurora database in AWS, create your ops.yml file and put the value of the name of your configs in the configs section in the ops.yml file. In this tutorial, we will be using the CTOai Fargate workflow, which is an opensource in this GitHub repository. In the configs section, add your configurations for the Aurora database you created.

version: "1"
commands:
  - name: setup-aws-ecs-fargate:0.3.2
    run: ./node_modules/.bin/ts-node /ops/src/setup.ts
    description: "setup an environment"
    env:
      static:
        - STACK_TYPE=aws-ecs-fargate
        - AWS_REGION=us-west-1
        - JSII_DEPRECATED=quiet
      secrets:
        - AWS_ACCESS_KEY_ID
        - AWS_SECRET_ACCESS_KEY
        - AWS_ACCOUNT_NUMBER
      configs:
        - DEV_AWS_ECS_FARGATE_STATE
        - STG_AWS_ECS_FARGATE_STATE
        - PRD_AWS_ECS_FARGATE_STATE
        - DEV_AWS_ECS_FARGATE_CLUSTER_VAULT_ARN
        - STG_AWS_ECS_FARGATE_CLUSTER_VAULT_ARN
        - PRD_AWS_ECS_FARGATE_CLUSTER_VAULT_ARN
        - DEV_AWS_ECS_FARGATE_SERVICE_VAULT_ARN
        - STG_AWS_ECS_FARGATE_SERVICE_VAULT_ARN
        - PRD_AWS_ECS_FARGATE_SERVICE_VAULT_ARN

This configuration sets up the necessary environment for deploying and managing AWS ECS Fargate infrastructure and integrates it with Amazon Aurora PostgreSQL. When you are done, deploy it and set up your infrastructure using the ops build . command.


Conclusion

Integrating Amazon Aurora PostgreSQL with CTO.ai enables database management and application deployment. It ensures databases are always in sync with applications, reduces errors, and automates deployment, allowing development teams to focus on feature building. Get started with our open-source workflows today.