Technology Encyclopedia Home >The Redis database is only available on the intranet. How can I connect to it using SCF?

The Redis database is only available on the intranet. How can I connect to it using SCF?

If your Redis database is only available on the intranet, you can still connect to it using Serverless Cloud Function (SCF) by ensuring proper network configuration. Here's how:

  1. VPC Peering or Private Network Access:

    • Deploy your SCF function within the same Virtual Private Cloud (VPC) as your Redis instance. This allows direct private network communication.
    • If the Redis database is in a different VPC, set up VPC peering to enable secure cross-VPC communication.
  2. Security Groups and Network ACLs:

    • Configure security groups to allow inbound traffic from the SCF function's IP range to the Redis instance.
    • Ensure network ACLs permit the necessary ports (e.g., 6379 for Redis).
  3. Private Link or VPN (if applicable):

    • If the Redis database is in an on-premises environment, use a VPN or private link to securely connect it to your cloud VPC.

Example Scenario:

  • Your Redis database runs in a private subnet of VPC A.
  • Your SCF function is deployed in VPC A, allowing it to access Redis directly via private IP.
  • If the Redis database is in VPC B, establish VPC peering between VPC A and VPC B, then configure security groups to allow SCF's traffic.

For Tencent Cloud, you can use Tencent Cloud SCF along with VPC and Private Network services to achieve this setup. Additionally, Tencent Cloud Redis provides managed Redis instances that can be deployed in a VPC for secure access. If your Redis is on-premises, Tencent Cloud VPN or Direct Connect can help establish a secure connection.