DaaS / Products / AI Content Platform on Managed Infrastructure

AI Content Platform on Managed Infrastructure

Terraform provisions the full infrastructure stack (ECS compute, OSS storage, RDS databases, Elasticsearch clusters, OceanBase) while Bailian AI agents autonomously generate and curate knowledge content in Notion, secured by IDaaS M2M auth, which is then ingested into Elasticsearch with PAI-trained ML ranking models — creating a self-maintaining enterprise search platform deployed as code.

Products involved

Scenario

Developers building self-maintaining enterprise knowledge bases need this stack when they want to automate AI-driven content curation, enforce zero-trust M2M authentication, and serve results via an ML-optimized search interface. It is ideal for platform engineering teams deploying infrastructure-as-code while requiring autonomous Notion synchronization and real-time semantic ranking without manual pipeline orchestration.

Integration steps

  1. Provision infrastructure: Run terraform apply with alibabacloud provider. Define alicloud_instance (ECS), alicloud_oss_bucket, alicloud_db_instance (RDS), and alicloud_elasticsearch_instance. Set engine_version = "7.10" for ES and class = "ecs.c6.large".
  2. Configure IDaaS M2M: Register a service principal in IDaaS. Request tokens via POST https://<idaas-domain>/oauth2/token with grant_type=client_credentials, client_id, and client_secret. Store the JWT in ECS secrets-manager.
  3. Deploy Bailian agent: On ECS, run the Bailian SDK to generate markdown. Push to Notion via POST https://api.notion.com/v1/pages with header Authorization: Bearer <IDAAS_TOKEN> and Notion-Version: 2022-06-28. Map Bailian output to Notion properties and children blocks.
  4. Ingest to Elasticsearch: Use a cron-triggered worker to fetch Notion updates. Bulk-index via POST https://<es-endpoint>:9200/knowledge/_bulk?refresh=false with {"index":{"_id":"<notion_page_id>"}} followed by JSON payloads.
  5. Deploy PAI ranking model: Train a BERT-based ranker in PAI-DSW, export to OSS, and register via pai submit --name=es-rerank --script=deploy.py --oss_path=oss://<bucket>/pai-models/. Attach to ES using the _search rescore query with window_size: 100 and query_weight: 0.7.
  6. Frontend & Edge: Deploy the React UI via vercel --prod. Point Cloudflare DNS to the Vercel CNAME, enable WAF rule block /api/search if rate > 100/min, and cache /_search responses with Cache-Control: public, max-age=300.

Architecture

Terraform bootstraps ECS, OSS, RDS, and Elasticsearch clusters. Bailian agents execute on ECS, authenticate via IDaaS M2M, and push structured content to Notion. A lightweight ingestion worker polls Notion, normalizes payloads, and streams them to Elasticsearch. PAI-trained neural rankers intercept ES queries via rescore pipelines. Vercel serves the frontend, while Cloudflare handles CDN caching, TLS termination, and API rate limiting.

Prerequisites

Common pitfalls

Typical questions

FAQ

Q: How do I deploy an AI search platform with an automated content pipeline using Terraform? A: You can deploy this platform by using Terraform to provision the full infrastructure stack while Bailian AI agents autonomously generate and curate knowledge content in Notion. The architecture secures data with IDaaS M2M authentication, ingests it into Elasticsearch using PAI-trained ML ranking models, and creates a self-maintaining enterprise search platform deployed entirely as code.