Skip to content

Commit

Permalink
Fix README links
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmsamson committed Oct 8, 2024
1 parent 32e11a1 commit 53f7b7b
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[//]: # (This file was autogenerated using `zio-sbt-website` plugin via `sbt generateReadme` command.)

[//]: # (So please do not edit it manually. Instead, change "docs/index.md" file or sbt setting keys)

[//]: # (e.g. "readmeDocumentation" and "readmeSupport".)

# ZIO Lambda
Expand All @@ -15,7 +17,7 @@ libraryDependencies += "dev.zio" %% "zio-json" % "0.6.2"
libraryDependencies += "dev.zio" %% "zio-lambda" % "1.0.4"

// Optional dependencies
libraryDependencies += "dev.zio" %% "zio-lambda-event" % "1.0.4"
libraryDependencies += "dev.zio" %% "zio-lambda-event" % "1.0.4"
libraryDependencies += "dev.zio" %% "zio-lambda-response" % "1.0.4"
```

Expand All @@ -37,9 +39,12 @@ object SimpleHandler extends ZIOAppDefault {
override val run =
ZLambdaRunner.serve(app)
}

```

zio-lambda depends on [**zio-json**](https://github.com/zio/zio-json) for decoding any event you send to it and enconding any response you send back to the Lambda service. You can either create your own data types or use the ones that are included in **zio-lambda-event** and **zio-lambda-response**.
zio-lambda depends on [**zio-json**](https://github.com/zio/zio-json) for decoding any event you send to it and
enconding any response you send back to the Lambda service. You can either create your own data types or use the ones
that are included in **zio-lambda-event** and **zio-lambda-response**.

The last step is to define the way your function will be invoked. There are three ways, detailed below:

Expand All @@ -52,12 +57,13 @@ Each release will contain a zip file ready to be used as a lambda layer) and you

1. Create an AWS Lambda function and choose the runtime where you provide your own bootstrap on Amazon Linux 2

![create-lambda](docs/https://user-images.githubusercontent.com/14280155/164102664-3686e415-20be-4dd9-8979-ea6098a7a4b9.png)
![create-lambda](https://user-images.githubusercontent.com/14280155/164102664-3686e415-20be-4dd9-8979-ea6098a7a4b9.png)
2. Run `sbt GraalVMNativeImage/packageBin`, we'll find the binary present under the `graalvm-native-image` folder:

![binary-located](docs/https://user-images.githubusercontent.com/14280155/164103337-6645dfeb-7fc4-4f7f-9b13-8005b0cddead.png)
![binary-located](https://user-images.githubusercontent.com/14280155/164103337-6645dfeb-7fc4-4f7f-9b13-8005b0cddead.png)

3. Create the following bootstap file (which calls out to the binary) and place it in the same directory alongside the binary:
3. Create the following bootstap file (which calls out to the binary) and place it in the same directory alongside the
binary:
```bash
#!/usr/bin/env bash

Expand All @@ -66,7 +72,7 @@ Each release will contain a zip file ready to be used as a lambda layer) and you
./zio-lambda-example
```

![bootstrap-alongside-native-binary](docs/https://user-images.githubusercontent.com/14280155/164103935-0bf7a6cb-814d-4de1-8fa1-4d0d54fb6e88.png)
![bootstrap-alongside-native-binary](https://user-images.githubusercontent.com/14280155/164103935-0bf7a6cb-814d-4de1-8fa1-4d0d54fb6e88.png)

4. Now we can zip both these files up:
```log
Expand All @@ -77,11 +83,11 @@ Each release will contain a zip file ready to be used as a lambda layer) and you

5. Take `upload.zip` and upload it to AWS Lambda and test your function:

![lambda-ui](docs/https://user-images.githubusercontent.com/14280155/164104747-039ec584-d3e2-4b47-884d-ff88977e2b53.png)
![lambda-ui](https://user-images.githubusercontent.com/14280155/164104747-039ec584-d3e2-4b47-884d-ff88977e2b53.png)

6. Test everything out to make sure everything works:

![test-ui](docs/https://user-images.githubusercontent.com/14280155/164104858-a720ac55-b9bb-47ec-af70-c4bd5eb5bed3.png)
![test-ui](https://user-images.githubusercontent.com/14280155/164104858-a720ac55-b9bb-47ec-af70-c4bd5eb5bed3.png)

## Deployment of native image binary in a Docker container

Expand Down Expand Up @@ -114,15 +120,16 @@ docker push <your-particular-ecr-image-repository>:<your-tag>

Here is an example:

![image-uploaded](docs/https://user-images.githubusercontent.com/14280155/164120591-68a78d19-c56b-4793-96b8-cfe567443063.png)
![image-uploaded](https://user-images.githubusercontent.com/14280155/164120591-68a78d19-c56b-4793-96b8-cfe567443063.png)

Create a Lambda function and choose container image:

![lambda-create-container-image](docs/https://user-images.githubusercontent.com/14280155/164120637-9c827736-26a8-4c65-92d4-2919157bbda6.png)
![lambda-create-container-image](https://user-images.githubusercontent.com/14280155/164120637-9c827736-26a8-4c65-92d4-2919157bbda6.png)

![image](docs/https://user-images.githubusercontent.com/14280155/164120764-2c736a46-29e3-488c-ba6a-e2b69ef51792.png)
![image](https://user-images.githubusercontent.com/14280155/164120764-2c736a46-29e3-488c-ba6a-e2b69ef51792.png)

Please note that because you incur the overhead of your native binary residing within a Docker container, there is more overhead than the other approach of deploying the binary straight to AWS Lambda
Please note that because you incur the overhead of your native binary residing within a Docker container, there is more
overhead than the other approach of deploying the binary straight to AWS Lambda

## Documentation

Expand All @@ -141,6 +148,7 @@ See the [Code of Conduct](https://zio.dev/about/code-of-conduct)
Come chat with us on [![Badge-Discord]][Link-Discord].
[Badge-Discord]: https://img.shields.io/discord/629491597070827530?logo=discord "chat on discord"
[Link-Discord]: https://discord.gg/2ccFBr4 "Discord"
## License
Expand Down

0 comments on commit 53f7b7b

Please sign in to comment.