A developer building an application (e.g., e-commerce or content platform) uses RDS as the primary transactional database and OpenSearch as the search/analytics engine, and needs to configure access control and credentials for both services as part of the same infrastructure setup.
Developers building e-commerce or content platforms use ApsaraDB RDS for ACID-compliant transactional workloads and Alibaba Cloud OpenSearch for low-latency full-text search and analytics. This guide shows how to provision and secure access credentials for both services within a single VPC-bound infrastructure setup, ensuring least-privilege access and unified credential management.
``bash aliyun rds CreateAccount --DBInstanceId rm-uf6wjk5xxxxxx --AccountName app_rw --AccountPassword 'SecurePass123!' --AccountType Normal aliyun rds GrantAccountPrivilege --DBInstanceId rm-uf6wjk5xxxxxx --AccountName app_rw --DBName ecommerce_db --AccountPrivilege ReadWrite ``
``bash aliyun ram CreateUser --UserName opensearch-app aliyun ram AttachPolicyToUser --PolicyName AliyunOpenSearchReadOnlyAccess --UserName opensearch-app ``
``bash curl -X POST "https://opensearch.cn-hangzhou.aliyuncs.com/v4/openapi/instances/os-xxxxx/api-keys" \ -H "Authorization: Bearer <STS_TOKEN>" \ -d '{"name": "app-search-key", "description": "App search access", "permissions": ["read", "write"]}' ``
SecurityIPList and OpenSearch NetworkConfig.OPENSEARCH_API_KEY). Configure your ORM and search client to use these values at startup.RDS acts as the authoritative system of record, handling synchronous CRUD operations and enforcing relational constraints. Application writes trigger asynchronous data synchronization (via Alibaba Cloud DTS or application-level CDC) into OpenSearch indices. OpenSearch handles high-concurrency search queries, aggregations, and analytics, returning results to the application without impacting RDS transactional throughput.
AliyunRDSFullAccess and AliyunOpenSearchFullAccess policiesaliyun configure)ConnectionRefused or Timeout errors.AliyunOpenSearchFullAccess instead of a least-privilege policy exposes cluster management endpoints to the application runtime.