Skip to content

Commit 074d122

Browse files
Bugfix/fix minor documentation issues (#203)
* Fix docs for current AWS CLI and current AWS Lambda runtimes * provided has to be either provided.al2023 or provided.al2 * AWS CLI2 has changed the param format * add docs about building on arm64 * minor docs update * use proper JSON in example * add hint on how to update example Lambda
1 parent 934d254 commit 074d122

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

README.md

+13-5
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ static invocation_response my_handler(invocation_request const& req)
6868
"error type here" /*error_type*/);
6969
}
7070

71-
return invocation_response::success("json payload here" /*payload*/,
71+
return invocation_response::success("{\"message:\":\"I fail if body length is bigger than 42!\"}" /*payload*/,
7272
"application/json" /*MIME type*/);
7373
}
7474

@@ -130,13 +130,19 @@ And finally, create the Lambda function:
130130
```
131131
$ aws lambda create-function --function-name demo \
132132
--role <specify role arn from previous step here> \
133-
--runtime provided --timeout 15 --memory-size 128 \
133+
--runtime provided.al2023 --timeout 15 --memory-size 128 \
134134
--handler demo --zip-file fileb://demo.zip
135135
```
136+
> **N.B.** If you are building on `arm64`, you have to explicitly add the param `--architectures arm64`, so that you are setting up the proper architecture on AWS to run your supplied Lambda function.
136137
137138
And to invoke the function:
138139
```bash
139-
$ aws lambda invoke --function-name demo --payload '{"answer":42}' output.txt
140+
$ aws lambda invoke --function-name demo --cli-binary-format raw-in-base64-out --payload '{"answer":42}' output.txt
141+
```
142+
143+
You can update your supplied function:
144+
```bash
145+
$ aws lambda update-function-code --function-name demo --zip-file fileb://demo.zip
140146
```
141147

142148
## Using the C++ SDK for AWS with this runtime
@@ -150,7 +156,7 @@ Any *fully* compliant C++11 compiler targeting GNU/Linux x86-64 should work. Ple
150156
- Use Clang v3.3 or above
151157

152158
## Packaging, ABI, GNU C Library, Oh My!
153-
Lambda runs your code on some version of Amazon Linux. It would be a less than ideal customer experience if you are forced to build your application on that platform and that platform only.
159+
Lambda runs your code on some version of Amazon Linux. It would be a less than ideal customer experience if you are forced to build your application on that platform and that platform only.
154160

155161
However, the freedom to build on any linux distro brings a challenge. The GNU C Library ABI. There is no guarantee the platform used to build the Lambda function has the same GLIBC version as the one used by AWS Lambda. In fact, you might not even be using GNU's implementation. For example you could build a C++ Lambda function using musl libc.
156162

@@ -196,10 +202,12 @@ curl_easy_setopt(curl_handle, CURLOPT_CAINFO, "/etc/pki/tls/certs/ca-bundle.crt"
196202
```bash
197203
$ aws lambda create-function --function-name demo \
198204
--role <specify role arn here> \
199-
--runtime provided --timeout 15 --memory-size 128 \
205+
--runtime provided.al2023 --timeout 15 --memory-size 128 \
200206
--handler demo
201207
--code "S3Bucket=mys3bucket,S3Key=demo.zip"
202208
```
209+
> **N.B.** See hint above if you are building on `arm64`.
210+
203211
1. **My code is crashing, how can I debug it?**
204212
205213
- Starting with [v0.2.0](https://github.com/awslabs/aws-lambda-cpp/releases/tag/v0.2.0) you should see a stack-trace of the crash site in the logs (which are typically stored in CloudWatch).

examples/demo/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ static invocation_response my_handler(invocation_request const& req)
99
"error type here" /*error_type*/);
1010
}
1111

12-
return invocation_response::success("json payload here" /*payload*/,
12+
return invocation_response::success("{\"message:\":\"I fail if body length is bigger than 42!\"}" /*payload*/,
1313
"application/json" /*MIME type*/);
1414
}
1515

0 commit comments

Comments
 (0)