Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions docs/getting-started/development-environment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Development Environment

## Development workflow

```mermaid
flowchart LR
subgraph dev["Development (Local)"]
Comment thread
yaythomas marked this conversation as resolved.
direction LR
A["1. Write Function"]
B["2. Write Tests"]
C["3. Run Tests"]
end

subgraph prod["Production (AWS)"]
direction LR
D["4. Deploy"]
E["5. Test in Cloud"]
end

A --> B --> C --> D --> E

style dev fill:#e3f2fd
style prod fill:#fff3e0
```

10 changes: 8 additions & 2 deletions docs/getting-started/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,11 @@ concepts introduced here.

- [Key Concepts](key-concepts.md) Understand durable execution, checkpoints, replay, and
the DurableContext before writing code
- [Quick Start](quick-start.md) Install the SDK, write your first durable function, and
test it locally
- [Quickstart](quickstart.md) Install the SDK, write your first durable function, and
deploy it with the AWS CLI
- [Quickstart for Container Image](quickstart-container-image.md) Deploy a durable
function in a container image
- [Manage Executions](manage-executions.md) List, inspect, stop, update, and delete
durable functions and executions
- [Development Environment](development-environment.md) Development workflow, SDK
installation, and testing setup
122 changes: 122 additions & 0 deletions docs/getting-started/manage-executions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# Manage Executions
Comment thread
yaythomas marked this conversation as resolved.

Use the AWS CLI to inspect, stop, update, and clean up durable functions and their
executions.

## List executions

```console
aws lambda list-durable-executions-by-function \
--function-name my-durable-function
```

## Get execution details

```console
aws lambda get-durable-execution \
--durable-execution-arn <execution-arn>
```

## Get execution history

View the checkpoint history for an execution:

```console
aws lambda get-durable-execution-history \
--durable-execution-arn <execution-arn>
```

## Stop an execution

```console
aws lambda stop-durable-execution \
--durable-execution-arn <execution-arn>
```

## Update function code

After updating your code, publish a new version and point your alias to it.

=== "Zip (TypeScript/Python)"

```console
aws lambda update-function-code \
--function-name my-durable-function \
--zip-file fileb://function.zip

aws lambda wait function-updated \
--function-name my-durable-function

aws lambda publish-version \
--function-name my-durable-function

aws lambda update-alias \
--function-name my-durable-function \
--name prod \
--function-version <new-version>
```

=== "Container image (Java)"
Comment thread
yaythomas marked this conversation as resolved.

```console
aws lambda update-function-code \
--function-name my-durable-function \
--image-uri 123456789012.dkr.ecr.us-east-1.amazonaws.com/my-durable-function:latest

aws lambda wait function-updated \
--function-name my-durable-function

aws lambda publish-version \
--function-name my-durable-function

aws lambda update-alias \
--function-name my-durable-function \
--name prod \
--function-version <new-version>
```

Running executions will continue to use the version they started with. New invocations
use the updated alias.

If you're still actively developing and you don't want to publish a new version each
time you update, you could use `LATEST$` just during development, but please be very
aware that executions might not replay correctly (or even fail) if the underlying code
changes during running executions. Always use numbered versions or aliases in
production.

## View logs

```console
aws logs tail /aws/lambda/my-durable-function --follow
```

## Delete durable functions

```console
aws lambda delete-function --function-name my-durable-function

aws iam detach-role-policy \
--role-name durable-function-role \
--policy-arn arn:aws:iam::aws:policy/service-role/AWSLambdaBasicDurableExecutionRolePolicy

aws iam delete-role --role-name durable-function-role
```

If you deployed as a container image, also
[delete the image](https://docs.aws.amazon.com/AmazonECR/latest/userguide/delete_image.html)
from ECR:

```console
aws ecr batch-delete-image \
--repository-name my-durable-function \
--image-ids imageTag=latest
```

Replace `latest` with the tag you pushed if you used a different tag. To delete multiple
tags at once, specify each with a separate `imageTag=` argument:

```console
aws ecr batch-delete-image \
--repository-name my-durable-function \
--image-ids imageTag=latest imageTag=v1.0.0
```
Loading
Loading