Skip to content

fix(docs): examples/extension-internal-flush: don't refer to a standalone layer arn for internal extension #980

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 1 commit into from
May 8, 2025
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
18 changes: 17 additions & 1 deletion examples/extension-internal-flush/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,29 @@ the Lambda service returns the response to the caller immediately. Extensions ma
without introducing an observable delay.

## Build & Deploy
Two deploy options for internal extensions:

1. Install [cargo-lambda](https://github.com/cargo-lambda/cargo-lambda#installation)
2. Build the extension with `cargo lambda build --release`
2. Build a function with the internal extension embedded with `cargo lambda build --release`
3. Deploy the function to AWS Lambda with `cargo lambda deploy --iam-role YOUR_ROLE`

The last command will give you an ARN for the extension layer that you can use in your functions.

## Build for ARM 64

Build the extension with `cargo lambda build --release --arm64`


## Test your Function

From your local:
```
cargo lambda watch
# in new terminal window
cargo lambda invoke --data-ascii '{"Records":[{"messageId":"MessageID_1","receiptHandle":"MessageReceiptHandle","body":"{\"a\":\"Test\",\"b\":123}"}]}'
```

If you have deployed to AWS using the commands in the 'Build & Deploy' section, you can also invoke your function remotely:
```
cargo lambda invoke extension-internal-flush --remote --data-ascii '{"Records":[{"messageId":"MessageID_1","receiptHandle":"MessageReceiptHandle","body":"{\"a\":\"Test\",\"b\":123}"}]}'
```
2 changes: 2 additions & 0 deletions examples/extension-internal-flush/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ async fn main() -> Result<(), Error> {

let handler = Arc::new(EventHandler::new(request_done_sender));

// TODO: add biased! to always poll the handler future first, once supported:
// https://github.com/tokio-rs/tokio/issues/7304
tokio::try_join!(
lambda_runtime::run(service_fn(|event| {
let handler = handler.clone();
Expand Down
Loading