Updated on 2023-11-21 GMT+08:00

Configuring the Network

Introduction

Functions can be configured to access resources in Virtual Private Clouds (VPCs) or to access the Internet through source network address translation (SNAT) by binding elastic IP addresses. When editing a function, you can configure it to allow it to access a VPC.

Configuring VPC Access

Procedure

  1. Log in to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
  2. Click the function to be configured to go to the function details page.
  3. Choose Configuration > Network, enable VPC Access, and specify a VPC and subnet.
    1. For details on how to create a VPC and a subnet, see Creating a VPC.
    2. Specify an agency with VPC administrator permissions for the function. For details, see Configuring Agency Permissions.
    3. You can bind functions in a project to up to four different subnets in any VPCs. (Each project has a unique 32-digit project ID, which is allocated when your account is created. The project IDs of your account and IAM user are the same.)
  4. Click Save.

Accessing the Internet from a VPC

By default, functions deployed in a VPC are isolated from the Internet. If a function needs to access both internal and external networks, add a NAT gateway for the VPC.

Prerequisites

  1. You have created a VPC and a subnet according to Creating a VPC.
  2. You have obtained an EIP according to Assigning an EIP.

Procedure

  1. In the left navigation pane of the management console, choose Network > NAT Gateway to go to the NAT Gateway console. Then click Create NAT Gateway.
  2. On the displayed page, enter gateway information, select a VPC (for example, vpc-01) and subnet, and confirm and submit the settings. For details, see Creating a NAT Gateway.
  3. Click the NAT gateway name. On the details page that is displayed, click Add SNAT Rule, set the rule, and click OK.