Skip to content
Merged
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
69 changes: 63 additions & 6 deletions docs/getting-started/quickstart.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Quickstart

Create and deploy your first durable function using the AWS CLI. This guide covers
TypeScript and Python.
TypeScript, Python, and Java.

!!! note "Adding all your dependencies to the deployment package"

Expand All @@ -24,6 +24,10 @@ TypeScript and Python.

- Python 3.13+

=== "Java"

- Java 17+ and Maven 3.8+

## Create the execution role

Create an IAM role that grants your function permission to perform checkpoint
Expand Down Expand Up @@ -65,11 +69,6 @@ Note the role ARN returned. You'll need it in the next step.

## Write the durable function

!!! note "Using Java?"

Java durable functions currently only deploy in container images. See
[Quickstart for Container Image](quickstart-container-image.md).

=== "TypeScript"

Save as `index.mjs`
Expand All @@ -86,6 +85,14 @@ Note the role ARN returned. You'll need it in the next step.
--8<-- "examples/python/getting-started/quickstart.py"
```

=== "Java"

Save as `QuickstartFunction.java`

```java
--8<-- "examples/java/getting-started/quickstart.java"
```

The wait here is for 10 seconds just for an easy quick example, but it could as easily
be 10 days without incurring extra compute.

Expand Down Expand Up @@ -133,6 +140,56 @@ execution role you just created.
--durable-config '{"ExecutionTimeout": 900, "RetentionPeriodInDays": 1}'
```

=== "Java"

Set up a Maven project with the following `pom.xml` dependencies:

```xml
<dependency>
<groupId>software.amazon.lambda.durable</groupId>
<artifactId>aws-durable-execution-sdk-java</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-core</artifactId>
<version>1.4.0</version>
</dependency>
Comment thread
yaythomas marked this conversation as resolved.
```

Add the `maven-shade-plugin` to produce a fat jar with all dependencies bundled:

```xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.6.2</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals><goal>shade</goal></goals>
</execution>
</executions>
</plugin>
```

Build the fat jar and deploy:

```console
mvn clean package -DskipTests

aws lambda create-function \
--function-name my-durable-function \
--runtime java21 \
--role arn:aws:iam::123456789012:role/durable-function-role \
--handler QuickstartFunction::handleRequest \
--zip-file fileb://target/*.jar \
--durable-config '{"ExecutionTimeout": 900, "RetentionPeriodInDays": 1}'
```

### Publish a version

You must invoke a durable functions with a published version or alias to ensure
Expand Down