

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 在 Amazon Bedrock 中刪除代理程式的別名
<a name="agents-alias-delete"></a>

若要了解如何刪除代理程式的別名，請選擇您偏好方法的標籤，然後遵循下列步驟：

------
#### [ Console ]

**刪除別名**

1.  AWS 管理主控台 使用具有使用 Amazon Bedrock 主控台之許可的 IAM 身分登入 。接著，開啟位於 [https://console.aws.amazon.com/bedrock](https://console.aws.amazon.com/bedrock) 的 Amazon Bedrock 主控台。

1. 從左側導覽窗格選取**代理程式**。接著，在**代理程式**區段中選擇代理程式。

1. 若要選擇要刪除的別名，請在**別名**區段中，選擇您要刪除之別名旁的選項按鈕。

1. 選擇 **刪除**。

1. 此時會出現對話方塊，警告您刪除的後果。若確認要刪除別名，請在輸入欄位中輸入 **delete**，然後選擇**刪除**。

1. 橫幅即會出現，通知您正在刪除別名。刪除完成時，會出現成功橫幅。

------
#### [ API ]

若要刪除代理程式的別名，請使用 [Amazon Bedrock 代理人建置時期端點](https://docs.aws.amazon.com/general/latest/gr/bedrock.html#bra-bt)傳送 [DeleteAgentAlias](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_DeleteAgentAlias.html) 請求。依預設，`skipResourceInUseCheck` 參數為 `false`，如果資源正在使用中，則會停止刪除。如果將 `skipResourceInUseCheck` 設定為 `true`，即使資源正在使用中，也會刪除資源。

```
    def delete_agent_alias(self, agent_id, agent_alias_id):
        """
        Deletes an alias of an Amazon Bedrock agent.

        :param agent_id: The unique identifier of the agent that the alias belongs to.
        :param agent_alias_id: The unique identifier of the alias to delete.
        :return: The response from Amazon Bedrock Agents if successful, otherwise raises an exception.
        """

        try:
            response = self.client.delete_agent_alias(
                agentId=agent_id, agentAliasId=agent_alias_id
            )
        except ClientError as e:
            logger.error(f"Couldn't delete agent alias. {e}")
            raise
        else:
            return response
```

如需詳細資訊，請參閱[Hello Amazon Bedrock 代理人](bedrock-agent_example_bedrock-agent_Hello_section.md)。

------