

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# sam remote execution stop
<a name="sam-cli-command-reference-sam-remote-execution-stop"></a>

在 AWS Lambda 中停止正在运行的持久函数执行。

执行 ARN 应采用执行日志返回 StartDurableExecution 或在执行日志中找到的格式。

**注意**  
此命令需要访问 AWS 凭证。

## 用法
<a name="ref-sam-cli-remote-execution-stop-usage"></a>

```
$ sam remote execution stop DURABLE_EXECUTION_ARN [OPTIONS]
```

## 必需的参数
<a name="ref-sam-cli-remote-execution-stop-arguments"></a>

`DURABLE_EXECUTION_ARN`  
要停止执行的持久函数的 Amazon 资源名称 (ARN)。

## 选项
<a name="ref-sam-cli-remote-execution-stop-options"></a>

`--error-message TEXT`  
与已停止的执行关联的错误消息。

`--error-type TEXT`  
要与已停止的执行关联的错误类型。

`--error-data TEXT`  
要与已停止的执行关联的错误数据。

`--stack-trace TEXT`  
堆栈跟踪条目。可以多次指定此选项。

`--region TEXT`  
设置服务的 AWS 区域（例如，`us-east-1`）。

`--profile TEXT`  
从您的凭证文件中选择一个特定的个人资料以获取 AWS 凭证。

`--config-env TEXT`  
在配置文件中指定默认参数值的环境名称。默认值：`default`

`--config-file TEXT`  
包含默认参数值的配置文件。默认值：`samconfig.toml`

`--save-params`  
将通过命令行提供的参数保存到配置文件中。

`--beta-features / --no-beta-features`  
启用/禁用测试版功能。

`--debug`  
打开调试日志以打印 AWS SAM CLI 生成的调试消息并显示时间戳。

`-h, --help`  
显示此消息并退出。

## 示例
<a name="ref-sam-cli-remote-execution-stop-examples"></a>

在没有错误详情的情况下停止执行：

```
$ sam remote execution stop arn:aws:lambda:us-east-1:123456789012:function:MyFunction:$LATEST/durable-execution/my-execution-name/my-execution-id
```

停止执行并显示错误消息，然后键入：

```
$ sam remote execution stop arn:aws:lambda:us-east-1:123456789012:function:MyFunction:$LATEST/durable-execution/my-execution-name/my-execution-id --error-message "Execution cancelled" --error-type "UserCancellation"
```

使用完整的错误详细信息和堆栈跟踪停止执行：

```
$ sam remote execution stop arn:aws:lambda:us-east-1:123456789012:function:MyFunction:$LATEST/durable-execution/my-execution-name/my-execution-id --error-message "Task failed" --error-type "TaskFailure" --error-data '{"reason":"timeout"}' --stack-trace "at function1()" --stack-trace "at function2()"
```