Skip to content

Commit 0bcc004

Browse files
authored
Update CLI instructions to use cargo-lambda with the output-format flag (#446)
This gives people the ability to get the zip file directly after building the function without having to run an extra command
1 parent 0d6b25a commit 0bcc004

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,18 @@ You can find the `bootstrap` binary for your function under the `target/lambda`
9292

9393
#### 2.1. Deploying with the AWS CLI
9494

95-
First, you will need to create a ZIP archive of your Lambda function. For example, if you are using the `basic` example and aarch64-unknown-linux-gnu as your target, you can run:
95+
First, you will need to create a ZIP archive of your Lambda function. Cargo-lambda can do that for you automatically when it builds your binary if you add the `output-format` flag. For example, if you are using the `basic` example and aarch64-unknown-linux-gnu as your target, you can run:
9696

9797
```bash
98-
zip -j lambda.zip target/lambda/basic/bootstrap
98+
cargo lambda build --release --target aarch64-unknown-linux-gnu --output-format zip
9999
```
100100

101-
Now that we have a deployment package (`lambda.zip`), we can use the [AWS CLI](https://aws.amazon.com/cli/) to create a new Lambda function. Make sure to replace the execution role with an existing role in your account!
101+
Now that we have a deployment package (`target/lambda/basic/bootstrap.zip`), we can use the [AWS CLI](https://aws.amazon.com/cli/) to create a new Lambda function. Make sure to replace the execution role with an existing role in your account!
102102

103103
```bash
104104
$ aws lambda create-function --function-name rustTest \
105-
--handler doesnt.matter \
106-
--zip-file fileb://./lambda.zip \
105+
--handler bootstrap \
106+
--zip-file fileb://./target/lambda/basic/bootstrap.zip \
107107
--runtime provided.al2 \ # Change this to provided.al if you would like to use Amazon Linux 1.
108108
--role arn:aws:iam::XXXXXXXXXXXXX:role/your_lambda_execution_role \
109109
--environment Variables={RUST_BACKTRACE=1} \

0 commit comments

Comments
 (0)