https://github.com/krk/hello-aws-lambda-cpp
Example usage of AWS Lambdas with C++ using aws-lambda-cpp
https://github.com/krk/hello-aws-lambda-cpp
aws aws-lambda cpp cpp14 hello-world
Last synced: 2 months ago
JSON representation
Example usage of AWS Lambdas with C++ using aws-lambda-cpp
- Host: GitHub
- URL: https://github.com/krk/hello-aws-lambda-cpp
- Owner: krk
- License: apache-2.0
- Created: 2019-07-15T19:25:50.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-07-15T19:35:01.000Z (almost 7 years ago)
- Last Synced: 2025-04-08T21:37:03.680Z (about 1 year ago)
- Topics: aws, aws-lambda, cpp, cpp14, hello-world
- Language: Makefile
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Hello aws-lambda-cpp!
Uses [aws-lambda-cpp](https://github.com/awslabs/aws-lambda-cpp) library to handle a request to an [AWS Lambda](https://aws.amazon.com/lambda/).
## Usage
1. Build lambda package as `hello.zip`.
2. Give necessary permissions.
3. Create lambda.
4. Invoke lambda.
### Build
```bash
make build-in-docker
```
### Give Permissions
```bash
aws iam create-role \
--role-name lambda-cpp-demo \
--assume-role-policy-document file://trust-policy.json
aws iam attach-role-policy --role-name lambda-cpp-demo --policy-arn arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
```
### Create Lambda
```bash
aws lambda create-function \
--function-name hello-world \
--role arn:aws:iam::$AWS_ACCOUNT_ID:role/lambda-cpp-demo \
--runtime provided \
--timeout 15 \
--memory-size 128 \
--handler hello \
--zip-file fileb://from_docker/hello.zip
```
### Invoke Lambda
``` bash
aws lambda invoke --function-name hello-world --payload '{ }' output.txt
```