Skip to content

documented better developer experience #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Dec 16, 2018
Merged
Changes from 7 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
40 changes: 39 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,13 @@ fn my_handler(event: GreetingEvent, ctx: Context) -> Result<GreetingResponse, Ha
}
```

The code above is the same as the [basic example](https://github.com/awslabs/aws-lambda-rust-runtime/tree/master/lambda-runtime/examples/basic.rs) in the `lambda-runtime` crate. To deploy the basic sample as a Lambda function, we first build it with `cargo`. Since Lambda uses Amazon Linux, you'll need to target your executable for an `x86_64-linux` platform.
The code above is the same as the [basic example](https://github.com/awslabs/aws-lambda-rust-runtime/tree/master/lambda-runtime/examples/basic.rs) in the `lambda-runtime` crate.

### deployment

#### aws cli

To deploy the basic sample as a Lambda function using the aws cli, we first need to build it with `cargo`. Since Lambda uses Amazon Linux, you'll need to target your executable for an `x86_64-linux` platform.

```bash
$ cargo build -p lambda_runtime --example basic --release
Expand Down Expand Up @@ -86,6 +92,38 @@ $ aws lambda invoke --function-name rustTest \
$ cat output.json # Prints: {"message":"Hello, world!"}
```

#### serverless framework

You can optionally skip all of the manual building, renaming, and deploying steps above and use the [Serverless framework Rust plugin](https://github.com/softprops/serverless-rust). You can find an example
getting started template application [here](https://github.com/softprops/serverless-aws-rust).

Serverless application templates exist for a minimal [echo function](https://github.com/softprops/serverless-aws-rust), [http function](https://github.com/softprops/serverless-aws-rust-http), and [multi function service](https://github.com/softprops/serverless-aws-rust-multi).

To get started, just run the following commands to create a new lambda Rust application
and install project level dependencies.

```bash
$ serverless install \
--url https://github.com/softprops/serverless-aws-rust \
--name my-new-app \
&& cd my-new-app \
&& npm install --silent
```

Deploy it using the standard serverless workflow

```bash
# build, package, and deploy service to aws lambda
$ npx serverless deploy
```

Invoke it using serverless framework or a configured AWS integrated trigger source

```bash
$ npx serverless invoke -f hello -d '{"foo":"bar"}'
```


## lambda-runtime-client

Defines the `RuntimeClient` trait and provides its `HttpRuntimeClient` implementation. The client fetches events and returns output as `Vec<u8>`.
Expand Down