Web App Service allows you to orchestrate RDS resources. You can add RDS instances to your environment by configuring the database type, database version, storage type, and other required settings.
Web App Service provides surrogate and self-imported ApsaraDB for RDS instances. To prevent data loss, Web App Service will not release the attached ApsaraDB for RDS instance when you release an environment. You can log on to the ApsaraDB for RDS console to back up data and release these instances.
Web App Service uses Key Management Service (KMS) to create master keys to encrypt all database keys. Master keys created by Web App Service are free of charge. [DO NOT TRANSLATE] [DO NOT TRANSLATE]
ApsaraDB for RDS settings
Turn on the Enable RDS switch to attach an RDS instance.
- Surrogate Purchase: If you select this option, Web App Service will automatically purchase an ApsaraDB for RDS instance on your behalf after you configure a username, password, and other database-related settings. By default, Web App Service purchases a pay-as-you-go ApsaraDB for RDS instance on your behalf. After the process of a surrogate purchase is complete, you can change the billing method of the new instance to subscription in the ApsaraDB for RDS console. For information about pricing for ApsaraDB for RDS, see Pricing and billing items.
- Import: Before using Web App Service, you must first create ApsaraDB for RDS instances. Then, you can import an available instance to Web App Service. If you import an existing ApsaraDB for RDS instance, you do not need to configure the settings that are required when Web App Service purchases an ApsaraDB for RDS instance on your behalf. These settings include the instance type, database type and version, storage type, and storage capacity.
Turn off the Enable RDS switch to detach an RDS instance from an environment.
Note: If you disable RDS, Web App Service will not automatically release the attached RDS instance to prevent data loss. You can back up data and release the instance in the ApsaraDB for RDS console.
Database Type and Database Version
ApsaraDB for RDS supports a variety of database engines including MySQL, SQL Server, PostgreSQL, PPAS, and MariaDB TX. Several versions of each data engine are available. You can select a database version based on your business requirements. For more information, see Database engines.
- Basic: This edition provides a single node. It separates computing from storage and provides high performance at ultra-low costs.
- HA: This edition adopts a high-availability architecture that consists of a primary node and a secondary node. It is applicable to more than 80% of scenarios.
- Cluster: This edition is only available for ApsaraDB RDS SQL Server 2017 Enterprise. This edition leverages the AlwaysOn technology and provides one primary node, one secondary node, and a maximum of seven read-only nodes. This architecture allows you to perform horizontal scaling of a cluster to enhance read capabilities. When you purchase an RDS instance of the SQL Server 2017 Enterprise version, the HA architecture is applied by default. This architecture only includes a primary node, secondary node, and no read-only node.
- Finance: This edition uses a three-node architecture that includes one primary node and two secondary nodes. Data is replicated between the primary and secondary nodes to ensure data consistency and financial-grade reliability.
Storage types and storage capacity
- Local SSD (Recommended): indicates SSDs that reside in the same node as the database engine. You can store data on a local SSD to reduce I/O latency.
- SSD: indicates elastic block storage devices that are based on the distributed storage architecture. You can store data on SSDs to implement the compute-storage separation.
- ESSD: indicates next-generation disks that provide ultra-high performance. Enhanced SSDs (ESSDs) are based on the new-generation distributed block storage architecture. With 25 Gigabit Ethernet and remote direct memory access (RDMA) technologies, this architecture provides several benefits. These benefits include a maximum of one million random input/output operations per second (IOPS) for a single disk and low latency for single-line communication.
You can configure the storage capacity after you select a storage type.
Zone and VSwitch
Each zone is a distinct geographic location that resides in a region. Each zone has isolated power supplies and networks. A VSwitch is attached to a zone and used to connect RDS instances that reside in the zone. Multiple zones that reside in the same region are connected through high-speed links. The zone where you create an RDS instance can be the same as the zone where you create an ECS instance that runs an application. You can also create an RDS instance and ECS instance in different zones because no distinct difference between zones that reside in the same region.
- General: indicates RDS instances that are assigned exclusive memory and I/O resources. However, these RDS instances share CPU and storage resources with other RDS instances of the General type on the same physical host.
- Dedicated: indicates RDS instances that are assigned exclusive CPU, memory, storage, and I/O resources. These instances will not be affected by failures that occur on other instances that reside in the same physical host. The performance of these instances is persistent and stable. The Dedicated host type is the top level of the Dedicated type. Each RDS instance of this type occupies all the resources of a physical host.
You need to specify a database name in the Web App Service console. For surrogate instances, Web App Service will automatically create a database if the specified database does not exist in the RDS instance. For self-imported instances, you must ensure that the specified database is available on the RDS instance.
Account Name and Password
You need to specify an account name and password for a database in Web App Service. For surrogate instances, Web App Service will automatically create an account for you if no account is available on an RDS instance. For self-imported instances, you must ensure that the specified account is available on the RDS instance and is granted the required permissions.
Use the CLI tool to configure ApsaraDB for RDS
The CLI tool uses the Wpfile file to configure ApsaraDB for RDS instances. You can use the wpctl dump command to retrieve the Wpfile file of a deployment environment. You can add, modify, and remove RDS-related parameters. Then, you can use the apply command to apply the update.
RDS-related parameters are sorted into the resources.rds category of the Wpfile file. The following table provides a list of parameters and the description for each parameter.
|Parameter||Valid value||Default value||Description|
|enable||true and false||false||Specifies whether to enable RDS.|
|imported||true and false||false||Specifies whether to use an existing RDS instance.|
|rdsId||Valid RDS instance IDs||N/A||The ID of an RDS instance. If you need to import an existing RDS instance, you must specify the ID of the instance.|
|zoneId||Valid zone IDs||N/A||The ID of the zone where the RDS instance resides. You can call the DescribeRegions operation to query the zone of the RDS instance.|
|instanceChargeType||PrePaid and PostPaid||PostPaid||The payment method for the RDS instance.|
|periodUnit||Month and Year||Month||The subscription duration unit of the RDS instance. This parameter is required if the billing method of the RDS instance is subscription.|
||1||The subscription duration of the RDS instance. This parameter is required if the billing method of the RDS instance is subscription.|
|VSwitches||Valid VSwitch IDs.||N/A||The ID of the VSwitch in the zone where the RDS instance resides.|
|engine||Valid database types, including MySQL, SQLServer, PostgreSQL, PPAS, and MariaDB.||N/A||The database type.|
|engineVersion||Valid database versions:
||N/A||The database version of the RDS instance.|
|storageType||Valid storage types:
||N/A||The storage type of the RDS instance.|
|storageSize||Integers||100||The storage capacity of the RDS instance. Unit: GB.|
|dbInstanceClass||Valid instance types||N/A||The type of the RDS instance. For more information about valid instance types, see the ApsaraDB for RDS documentation.|
|databaseName||Strings.||webplus||The database name of the RDS instance.|
|characterSetName||Valid character sets:
||The character set of the RDS instance.|
|accountName||Strings||webplus||The database account name of the RDS instance.|
|accountPassword||Strings.||N/A||The password corresponding to the database account name.|
|category||Valid database editions:
||N/A||The database edition.|
Attach an RDS instance to an application
- WP_RDS_ENGINE: the database type such as MySQL.
- WP_RDS_CONNECTION_ADDRESS: the connection string of the database, for example, rm-xxxx.mysql.rds.aliyuncs.com
- WP_RDS_PORT: the port number that is used to connect to the database, for example, 3306
- WP_RDS_ACCOUNT_NAME: the username that is used to access the database
- WP_RDS_ACCOUNT_PASSWORD: the password corresponding to the username
- WP_RDS_DATABASE: the name of the database