> For the complete documentation index, see [llms.txt](https://smallso.gitbook.io/tencent-cloud-sdk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://smallso.gitbook.io/tencent-cloud-sdk/python-docs/serverless-database/class-and-method/client/set-instance-extranet.md).

# set\_instance\_extranet 方法

命名空间和模块：tencent.cloud.serverless.database.client

## 简要

设置给的无服务器数据库实例是否允许通过外联网（公网）访问。

```python
def set_instance_extranet(self,
    region_id: str,
    instance_id: str,
    instance_extranet: bool = True
)
```

## 参数

该方法具有以下参数，其参数名、参数类型和参数描述如下：

| 参数                 | 类型   | 必选 | 描述                                                                     |
| ------------------ | ---- | -- | ---------------------------------------------------------------------- |
| region\_id         | str  | 是  | <p>设置的无服务器数据库实例所在数据中心园区唯一标识符。</p><p>例如：<code>ap-shanghai</code></p>    |
| instance\_id       | str  | 是  | <p>设置的无服务器数据库实例唯一标识符。</p><p>例如：<code>postgres-8nb6q9hm</code></p>      |
| instance\_extranet | bool | 否  | <p>无服务器数据库实例是否允许通过外联网（公网）访问。</p><p>如果忽略该参数，默认值为 <code>True</code>。</p> |

## 返回值

该方法没有返回值。

## 异常

该方法可能会主动引发以下异常类型：

#### ValueError

参数值或类型不符合预期。

## 示例

接下来我们将通过一段 Python 代码向您演示如何使用该方法：

```python
client.set_instance_extranet(
    region_id = 'ap-shanghai',
    instance_id = 'postgres-8nb6q9hm',
    instance_extranet = True
)
```

## 适用于

#### Tencent Cloud SDK for Python

基础软件包：tencent-cloud-sdk-serverless-database >= 0.1.1
