Skip to content

Commit 269e680

Browse files
authored
Merge branch 'master' into maxday/add-unit-tests-in-ci
2 parents 30ca9d6 + 074d122 commit 269e680

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static invocation_response my_handler(invocation_request const& req)
8585
"error type here" /*error_type*/);
8686
}
8787

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

@@ -147,13 +147,19 @@ And finally, create the Lambda function:
147147
```
148148
$ aws lambda create-function --function-name demo \
149149
--role <specify role arn from previous step here> \
150-
--runtime provided --timeout 15 --memory-size 128 \
150+
--runtime provided.al2023 --timeout 15 --memory-size 128 \
151151
--handler demo --zip-file fileb://demo.zip
152152
```
153+
> **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.
153154
154155
And to invoke the function:
155156
```bash
156-
$ aws lambda invoke --function-name demo --payload '{"answer":42}' output.txt
157+
$ aws lambda invoke --function-name demo --cli-binary-format raw-in-base64-out --payload '{"answer":42}' output.txt
158+
```
159+
160+
You can update your supplied function:
161+
```bash
162+
$ aws lambda update-function-code --function-name demo --zip-file fileb://demo.zip
157163
```
158164

159165
## Using the C++ SDK for AWS with this runtime
@@ -167,7 +173,7 @@ Any *fully* compliant C++11 compiler targeting GNU/Linux x86-64 should work. Ple
167173
- Use Clang v3.3 or above
168174

169175
## Packaging, ABI, GNU C Library, Oh My!
170-
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.
176+
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.
171177

172178
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.
173179

@@ -213,10 +219,12 @@ curl_easy_setopt(curl_handle, CURLOPT_CAINFO, "/etc/pki/tls/certs/ca-bundle.crt"
213219
```bash
214220
$ aws lambda create-function --function-name demo \
215221
--role <specify role arn here> \
216-
--runtime provided --timeout 15 --memory-size 128 \
222+
--runtime provided.al2023 --timeout 15 --memory-size 128 \
217223
--handler demo
218224
--code "S3Bucket=mys3bucket,S3Key=demo.zip"
219225
```
226+
> **N.B.** See hint above if you are building on `arm64`.
227+
220228
1. **My code is crashing, how can I debug it?**
221229
222230
- 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

Lines changed: 1 addition & 1 deletion
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)