This section describes how to allow Function Compute to access RDS.
Your Function Compute service runs with a dynamic IP address. Therefore, we recommend that you do not allow Function Compute to access ApsaraDB for RDS (Relational Database Service) by using a whitelist. If you add all IP addresses to the whitelist, risks may occur.
Function Compute supports the Virtual Private Cloud (VPC) feature. You can enable VPC access for the Function Compute service to securely access resources in a VPC.
You can place the RDS instances in a VPC, and enable the VPC feature for Function Compute to access resources in the VPC. The Function Compute service can then securely access the RDS instance in the VPC.
This section describes the steps included in the sample. This sample allows Function Compute to securely access the RDS instance in the VPC.
Create a VPC.
Create a security group.
Create an RDS instance.