

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

This page provides reference information for the AWS Serverless Application Model Command Line Interface (AWS SAM CLI) `sam remote execution` command.

For an introduction to the AWS SAM CLI, see [What is the AWS SAM CLI?](what-is-sam-overview.md#what-is-sam-cli)

The `sam remote execution` command allows you to manage and inspect remote durable function executions running in AWS Lambda.

**Note**  
These commands require access to AWS credentials.

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

```
$ sam remote execution <subcommand> <options>
```

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

`--help, -h`  <a name="sam-cli-command-reference-sam-remote-execution-options-help"></a>
Show this message and exit.

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

`get`  <a name="sam-cli-command-reference-sam-remote-execution-subcommands-get"></a>
Get details of a durable execution. For more information, see [sam remote execution get](sam-cli-command-reference-sam-remote-execution-get.md).

`history`  <a name="sam-cli-command-reference-sam-remote-execution-subcommands-history"></a>
Get execution history of a durable function execution. For more information, see [sam remote execution history](sam-cli-command-reference-sam-remote-execution-history.md).

`stop`  <a name="sam-cli-command-reference-sam-remote-execution-subcommands-stop"></a>
Stop a durable function execution. For more information, see [sam remote execution stop](sam-cli-command-reference-sam-remote-execution-stop.md).

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

Retrieve the details of a specific durable function execution from AWS Lambda.

The execution ARN should be in the format returned by Invoke or found in execution logs.

**Note**  
This command requires access to AWS credentials.

## Usage
<a name="ref-sam-cli-remote-execution-get-usage"></a>

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

## Required Arguments
<a name="ref-sam-cli-remote-execution-get-arguments"></a>

`DURABLE_EXECUTION_ARN`  
The Amazon Resource Name (ARN) of the durable function execution to retrieve details for.

## Options
<a name="ref-sam-cli-remote-execution-get-options"></a>

`--format [summary|json]`  
Output format. Default: `summary`

`--region TEXT`  
Set the AWS Region of the service (for example, `us-east-1`).

`--profile TEXT`  
Select a specific profile from your credential file to get AWS credentials.

`--config-env TEXT`  
Environment name specifying default parameter values in the configuration file. Default: `default`

`--config-file TEXT`  
Configuration file containing default parameter values. Default: `samconfig.toml`

`--save-params`  
Save the parameters provided via the command line to the configuration file.

`--beta-features / --no-beta-features`  
Enable/Disable beta features.

`--debug`  
Turn on debug logging to print debug messages generated by AWS SAM CLI and display timestamps.

`-h, --help`  
Shows this message and exits.

## Examples
<a name="ref-sam-cli-remote-execution-get-examples"></a>

Get execution details with default summary format:

```
$ sam remote execution get 'arn:aws:lambda:us-east-1:123456789012:function:my-function:$LATEST/durable-execution/c63eec67-3415-4eb4-a495-116aa3a86278/1d454231-a3ad-3694-aa03-c917c175db55'
```

Get execution details in JSON format:

```
$ sam remote execution get 'arn:aws:lambda:us-east-1:123456789012:function:my-function:$LATEST/durable-execution/c63eec67-3415-4eb4-a495-116aa3a86278/1d454231-a3ad-3694-aa03-c917c175db55' --format json
```

**Note**  
You must ensure that control characters in the execution ARN like `$` are escaped properly when using shell commands.

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

Retrieve the execution history of a specific durable function execution from AWS Lambda.

The execution ARN should be in the format returned by StartDurableExecution or found in execution logs.

**Note**  
This command requires access to AWS credentials.

## Usage
<a name="ref-sam-cli-remote-execution-history-usage"></a>

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

## Required Arguments
<a name="ref-sam-cli-remote-execution-history-arguments"></a>

`DURABLE_EXECUTION_ARN`  
The Amazon Resource Name (ARN) of the durable function execution to retrieve history for.

## Options
<a name="ref-sam-cli-remote-execution-history-options"></a>

`--format [table|json]`  
Output format. Default: `table`

`--region TEXT`  
Set the AWS Region of the service (for example, `us-east-1`).

`--profile TEXT`  
Select a specific profile from your credential file to get AWS credentials.

`--config-env TEXT`  
Environment name specifying default parameter values in the configuration file. Default: `default`

`--config-file TEXT`  
Configuration file containing default parameter values. Default: `samconfig.toml`

`--save-params`  
Save the parameters provided via the command line to the configuration file.

`--beta-features / --no-beta-features`  
Enable/Disable beta features.

`--debug`  
Turn on debug logging to print debug messages generated by AWS SAM CLI and display timestamps.

`-h, --help`  
Shows this message and exits.

## Examples
<a name="ref-sam-cli-remote-execution-history-examples"></a>

Get execution history with default table format:

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

Get execution history in JSON format:

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

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

Stop a running durable function execution in AWS Lambda.

The execution ARN should be in the format returned by StartDurableExecution or found in execution logs.

**Note**  
This command requires access to AWS credentials.

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

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

## Required Arguments
<a name="ref-sam-cli-remote-execution-stop-arguments"></a>

`DURABLE_EXECUTION_ARN`  
The Amazon Resource Name (ARN) of the durable function execution to stop.

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

`--error-message TEXT`  
Error message to associate with the stopped execution.

`--error-type TEXT`  
Error type to associate with the stopped execution.

`--error-data TEXT`  
Error data to associate with the stopped execution.

`--stack-trace TEXT`  
Stack trace entries. This option can be specified multiple times.

`--region TEXT`  
Set the AWS Region of the service (for example, `us-east-1`).

`--profile TEXT`  
Select a specific profile from your credential file to get AWS credentials.

`--config-env TEXT`  
Environment name specifying default parameter values in the configuration file. Default: `default`

`--config-file TEXT`  
Configuration file containing default parameter values. Default: `samconfig.toml`

`--save-params`  
Save the parameters provided via the command line to the configuration file.

`--beta-features / --no-beta-features`  
Enable/Disable beta features.

`--debug`  
Turn on debug logging to print debug messages generated by AWS SAM CLI and display timestamps.

`-h, --help`  
Shows this message and exits.

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

Stop execution without error details:

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

Stop execution with error message and type:

```
$ 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"
```

Stop execution with full error details and stack trace:

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