Skip to content
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

Bugfix/fix minor documentation issues #203

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static invocation_response my_handler(invocation_request const& req)
"error type here" /*error_type*/);
}

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

Expand Down Expand Up @@ -130,13 +130,19 @@ And finally, create the Lambda function:
```
$ aws lambda create-function --function-name demo \
--role <specify role arn from previous step here> \
--runtime provided --timeout 15 --memory-size 128 \
--runtime provided.al2023 --timeout 15 --memory-size 128 \
--handler demo --zip-file fileb://demo.zip
```
> **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.

And to invoke the function:
```bash
$ aws lambda invoke --function-name demo --payload '{"answer":42}' output.txt
$ aws lambda invoke --function-name demo --cli-binary-format raw-in-base64-out --payload '{"answer":42}' output.txt
```

You can update your supplied function:
```bash
$ aws lambda update-function-code --function-name demo --zip-file fileb://demo.zip
```

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

## Packaging, ABI, GNU C Library, Oh My!
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.
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.

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.

Expand Down Expand Up @@ -196,10 +202,12 @@ curl_easy_setopt(curl_handle, CURLOPT_CAINFO, "/etc/pki/tls/certs/ca-bundle.crt"
```bash
$ aws lambda create-function --function-name demo \
--role <specify role arn here> \
--runtime provided --timeout 15 --memory-size 128 \
--runtime provided.al2023 --timeout 15 --memory-size 128 \
--handler demo
--code "S3Bucket=mys3bucket,S3Key=demo.zip"
```
> **N.B.** See hint above if you are building on `arm64`.

1. **My code is crashing, how can I debug it?**

- 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).
Expand Down
2 changes: 1 addition & 1 deletion examples/demo/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ static invocation_response my_handler(invocation_request const& req)
"error type here" /*error_type*/);
}

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

Expand Down
Loading