

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

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

在 AWS Lambda 中停止執行中的耐用函數執行。

執行 ARN 應採用 StartDurableExecution 傳回的格式，或在執行日誌中找到。

**注意**  
此命令需要存取 AWS 登入資料。

## Usage
<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 Resource Name (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`  
啟用/停用 Beta 版功能。

`--debug`  
開啟偵錯記錄以列印 CLI AWS SAM 產生的偵錯訊息，並顯示時間戳記。

`-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()"
```